feat(project): 하위 업무도 업무처럼 팝업에서 똑같이 편집(아사나식)
하위 업무를 누르면 상위 업무가 아니라 그 하위 업무 자신의 팝업이 열려
제목·담당자·우선순위·마감일·설명·첨부·댓글·팔로워·하위 업무를 업무와
똑같이 고친다.
- 여는 곳: 보드 카드 하위 업무 줄 클릭 / 우클릭 "열기", 업무 팝업 하위
업무 줄의 › 버튼, 공유 링크(/project/t/{id} 가 하위 업무 자신을 연다)
- 제목 위에 상위 업무 경로(누르면 상위 업무로), 세션 칸·프로젝트 연결은 숨김
- GET /api/tasks/{id} 에 parent_title 추가
- 저장해도 보드 목록에 카드로 끼어들지 않게 mergeTask 에서 제외
- 정적 파일 버전 20260925e
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+58
-5
@@ -3292,7 +3292,8 @@
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
showContextMenu(e.clientX, e.clientY, [
|
||||
{ label: "열기 (상위 업무)", onClick: function () { openTaskModal(t); } },
|
||||
{ label: "열기", onClick: function () { openTaskById(sub.id); } },
|
||||
{ label: "상위 업무 열기", onClick: function () { openTaskModal(t); } },
|
||||
{
|
||||
label: sub.completed_at ? "완료 취소" : "완료로 표시",
|
||||
onClick: function () { row.querySelector(".pj-card-sub-check").click(); },
|
||||
@@ -3486,6 +3487,9 @@
|
||||
}
|
||||
if (e.target.closest(".pj-card-sub-check")) return;
|
||||
if (!canManage) return;
|
||||
// 하위 업무 줄을 누르면 상위 업무가 아니라 그 하위 업무 팝업(아사나식).
|
||||
const subRow = e.target.closest(".pj-card-sub");
|
||||
if (subRow) { e.stopPropagation(); openTaskById(parseInt(subRow.dataset.subId, 10)); return; }
|
||||
// 담당자/마감일 칩을 누른 경우엔 업무 팝업 대신 그 자리 편집기를 연다.
|
||||
const hitAssignee = e.target.closest(".pj-card-assignee");
|
||||
if (hitAssignee) { e.stopPropagation(); openAssigneePicker(t, e.clientX, e.clientY); return; }
|
||||
@@ -3919,7 +3923,8 @@
|
||||
delete patch.context_project_id; // 행의 맥락은 그대로
|
||||
tasks[i] = Object.assign({}, x, patch);
|
||||
});
|
||||
if (!found && !(opts && opts.noInsert)) {
|
||||
// 하위 업무(팝업에서 저장·완료)는 목록에 넣지 않는다 — 넣으면 보드에 카드로 뜬다.
|
||||
if (!found && !base.parent_task_id && !(opts && opts.noInsert)) {
|
||||
// 방금 만든 업무 — 맥락이 없으면 visibleTasks() 필터에 걸려 다음
|
||||
// 동기화 때까지 화면에 안 나왔다. 원래 소속 맥락으로 넣는다.
|
||||
if (base.context_project_id == null) base.context_project_id = base.project_id;
|
||||
@@ -4140,7 +4145,10 @@
|
||||
const detail = res.task;
|
||||
if (currentTaskId === task.id) showFollowers(task, detail.followers);
|
||||
if (subtaskBlock) {
|
||||
subtaskBlock.setContext({ taskId: task.id, projectId: task.project_id, canDelete: canDelete });
|
||||
subtaskBlock.setContext({
|
||||
taskId: task.id, projectId: task.project_id, canDelete: canDelete,
|
||||
onOpen: function (sub) { openTaskById(sub.id); },
|
||||
});
|
||||
subtaskBlock.render(detail.subtasks || []);
|
||||
}
|
||||
if (linksBlock) {
|
||||
@@ -4220,13 +4228,51 @@
|
||||
showFollowers(null, null); // 상세를 받으면(loadTaskExtras) 다시 그린다
|
||||
el("pj-attach-block").hidden = !task;
|
||||
el("pj-comment-block").hidden = !task;
|
||||
// 하위 업무도 업무와 같은 팝업·같은 편집(아사나식). 다른 점은 세 가지 —
|
||||
// 제목 위에 상위 업무 경로, 세션 칸 없음(하위 업무는 세션이 없다),
|
||||
// 다른 프로젝트 연결(멀티호밍) 없음.
|
||||
const isSub = !!(task && task.parent_task_id);
|
||||
const parentBtn = el("pj-t-parent");
|
||||
if (parentBtn) {
|
||||
parentBtn.hidden = !isSub;
|
||||
parentBtn.dataset.parentId = isSub ? String(task.parent_task_id) : "";
|
||||
const pt = isSub && tasks.find(function (x) { return x.id === task.parent_task_id; });
|
||||
el("pj-t-parent-title").textContent = isSub ? (task.parent_title || (pt && pt.title) || "상위 업무") : "";
|
||||
}
|
||||
const stageCell = document.querySelector(".pj-meta-cell-stage");
|
||||
if (stageCell) stageCell.style.display = isSub ? "none" : "";
|
||||
if (subtaskBlock) el("pj-subtask-block").hidden = !task;
|
||||
if (linksBlock) el("pj-links-block").hidden = !task;
|
||||
if (linksBlock) el("pj-links-block").hidden = !task || isSub;
|
||||
if (task) { loadAttachments(task.id); loadComments(task.id); loadTaskExtras(task); }
|
||||
openSlidePanel(taskModal);
|
||||
taskSnapshot = taskFormSnapshot();
|
||||
}
|
||||
|
||||
// id 로 업무 팝업 열기 — 하위 업무(보드 카드의 하위 업무 줄, 팝업 안 하위 업무
|
||||
// 목록, 상위 업무 경로)에서 쓴다. 보드 목록(tasks)에는 최상위 업무만 있으므로
|
||||
// 없으면 서버에서 받아 연다(상세 응답엔 parent_title 도 들어 있다).
|
||||
// 팝업에서 다른 업무로 넘어갈 때 저장 안 한 수정이 있으면 먼저 묻는다.
|
||||
async function openTaskById(id) {
|
||||
if (!taskModal.hidden && isTaskDirty()) {
|
||||
const go = await window.erpConfirm(
|
||||
"수정한 내용이 저장되지 않았습니다. 저장하지 않고 이동할까요?",
|
||||
{ okText: "이동", cancelText: "취소" }
|
||||
);
|
||||
if (!go) return;
|
||||
}
|
||||
const t = tasks.find(function (x) { return x.id === id && x.context_project_id === x.project_id; }) ||
|
||||
tasks.find(function (x) { return x.id === id; });
|
||||
if (t) { openTaskModal(t); return; }
|
||||
try {
|
||||
const res = await api("GET", "/project/api/tasks/" + id);
|
||||
if (res && res.task) openTaskModal(res.task);
|
||||
} catch (e) { showToast("업무를 열 수 없습니다: " + e.message, "error"); }
|
||||
}
|
||||
if (el("pj-t-parent")) el("pj-t-parent").addEventListener("click", function () {
|
||||
const pid = parseInt(el("pj-t-parent").dataset.parentId, 10);
|
||||
if (pid) openTaskById(pid);
|
||||
});
|
||||
|
||||
// 마감일 — 달력 아이콘 버튼(날짜가 있으면 옆에 "09/25(목)"). 진짜 값은 숨긴
|
||||
// #pj-t-due(input[type=date])가 들고 있어 저장·변경감지 코드는 그대로다.
|
||||
function syncDueBtn() {
|
||||
@@ -4902,7 +4948,7 @@
|
||||
enhanceAssigneeSelect(addAssignee);
|
||||
const addDue = el("pj-subtask-add-due");
|
||||
const addBtn = el("pj-subtask-add");
|
||||
let taskId = null, projectId = null, canDeleteFn = function () { return false; }, onChange = null;
|
||||
let taskId = null, projectId = null, canDeleteFn = function () { return false; }, onChange = null, onOpen = null;
|
||||
|
||||
async function membersOptionsHtml(pid) {
|
||||
try {
|
||||
@@ -4922,8 +4968,14 @@
|
||||
'<input type="text" class="pj-subtask-title" />' +
|
||||
'<select class="pj-subtask-assignee"><option value="">(미지정)</option>' + optionsHtml + "</select>" +
|
||||
'<input type="date" class="pj-subtask-due" />' +
|
||||
'<button type="button" class="pj-icon-btn pj-subtask-open" title="하위 업무 열기">' +
|
||||
'<span class="material-symbols-outlined">chevron_right</span></button>' +
|
||||
'<button type="button" class="pj-icon-btn pj-subtask-del" title="삭제" hidden>×</button>';
|
||||
const titleInp = li.querySelector(".pj-subtask-title");
|
||||
// 열기 — 이 하위 업무를 업무처럼 팝업 전체로(설명·댓글·첨부·하위 업무까지).
|
||||
li.querySelector(".pj-subtask-open").addEventListener("click", function () {
|
||||
if (onOpen) onOpen(sub);
|
||||
});
|
||||
const doneChk = li.querySelector(".pj-subtask-done");
|
||||
const assigneeSel = li.querySelector(".pj-subtask-assignee");
|
||||
const dueInp = li.querySelector(".pj-subtask-due");
|
||||
@@ -5002,6 +5054,7 @@
|
||||
taskId = opts.taskId; projectId = opts.projectId;
|
||||
canDeleteFn = opts.canDelete || function () { return false; };
|
||||
onChange = opts.onChange || null;
|
||||
onOpen = opts.onOpen || null;
|
||||
if (addAssignee && projectId) {
|
||||
membersOptionsHtml(projectId).then(function (html) {
|
||||
addAssignee.innerHTML = "<option value=''>(미지정)</option>" + html;
|
||||
|
||||
Reference in New Issue
Block a user