fix(project): 업무 편집 팝업 레이아웃 고정 + 내 업무에 담당 하위 업무 트리 표시
- 업무 편집 팝업: 상단 고정 버튼 바 높이를 40px로 고정해 제목을 가리지 않게 하고, 하위 업무가 늘어나도 메타/첨부/댓글 등 기존 기능이 찌그러져 숨지 않도록 모달 본문 전체를 세로 스크롤하게 변경 - 내 업무: 내가 담당자로 지정된 하위 업무를 목록에 반영해 부모 업무 아래에 폴더 트리 접속선으로 이어서 표시(부모가 내 업무가 아니면 안내 행으로 먼저 표시) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+98
-25
@@ -857,6 +857,7 @@
|
||||
let tasks = data.tasks || [];
|
||||
const priorityLabels = data.priorityLabels || {};
|
||||
const today = data.today || "";
|
||||
const me = (root.dataset.me || "").toLowerCase();
|
||||
|
||||
const table = el("pj-mytasks-table");
|
||||
const emptyEl = el("pj-mytasks-empty");
|
||||
@@ -924,12 +925,17 @@
|
||||
},
|
||||
];
|
||||
|
||||
function passFilter(t) {
|
||||
if (filter === "open") return !t.completed_at;
|
||||
if (filter === "done") return !!t.completed_at;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 최상위 업무만 — 하위 업무(parent_task_id 있음)는 render() 에서 해당
|
||||
// 부모 행 바로 아래에 트리로 붙인다(별도 필터/정렬은 하위 업무 자체의
|
||||
// 완료 상태로 각자 판단).
|
||||
function visible() {
|
||||
return tasks.filter(function (t) {
|
||||
if (filter === "open") return !t.completed_at;
|
||||
if (filter === "done") return !!t.completed_at;
|
||||
return true;
|
||||
});
|
||||
return tasks.filter(function (t) { return !t.parent_task_id && passFilter(t); });
|
||||
}
|
||||
|
||||
function renderHead() {
|
||||
@@ -984,6 +990,59 @@
|
||||
];
|
||||
}
|
||||
|
||||
// 업무 행 하나(최상위든 하위든) 그리기 — 하위 업무면 트리 접속선(├/└)을
|
||||
// 제목 칸 앞에 붙인다(isLast 면 └, 아니면 ├ — 형제 중 마지막인지로 결정).
|
||||
function appendTaskRow(tbody, t, opts) {
|
||||
opts = opts || {};
|
||||
const tr = document.createElement("tr");
|
||||
tr.className = "pj-mtk-row" + (t.completed_at ? " is-done" : "") +
|
||||
(opts.isSub ? " pj-mtk-subrow" : "");
|
||||
tr.dataset.taskId = t.id;
|
||||
const branch = opts.isSub
|
||||
? '<span class="pj-mtk-tree-branch' + (opts.isLast ? " is-last" : "") + '"></span>'
|
||||
: "";
|
||||
tr.innerHTML =
|
||||
'<td class="pj-mtk-check"><input type="checkbox"' + (t.completed_at ? " checked" : "") + " /></td>" +
|
||||
COLS.map(function (c, i) {
|
||||
const cell = c.html(t);
|
||||
return '<td class="' + c.cls + '">' + (i === 0 ? branch + cell : cell) + "</td>";
|
||||
}).join("");
|
||||
const chk = tr.querySelector('input[type="checkbox"]');
|
||||
chk.addEventListener("click", function (e) { e.stopPropagation(); });
|
||||
chk.addEventListener("change", function () { toggleDone(t, chk.checked); });
|
||||
tr.addEventListener("click", function (e) {
|
||||
if (e.target.closest(".pj-cmt-badge")) return; // 말풍선은 댓글 팝업 담당
|
||||
location.href = "/project/p/" + t.project_id + "?task=" + t.id;
|
||||
});
|
||||
tr.addEventListener("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
showContextMenu(e.clientX, e.clientY, rowContextItems(t));
|
||||
});
|
||||
if (cmt) cmt.wireBadge(tr.querySelector(".pj-cmt-badge"));
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
|
||||
// 부모 업무 행이 (다른 사람 담당이라, 또는 현재 탭 필터에 안 맞아) 목록에
|
||||
// 직접 나오지 않는 하위 업무 — 그 부모를 클릭 가능한 안내 행으로 먼저
|
||||
// 보여주고, 그 아래에 내 하위 업무를 트리로 건다.
|
||||
function appendParentGroupRow(tbody, subtask) {
|
||||
const parentIsMine = String(subtask.parent_assignee_email || "").toLowerCase() === me;
|
||||
const tr = document.createElement("tr");
|
||||
tr.className = "pj-mtk-row pj-mtk-parent-group" +
|
||||
(subtask.parent_completed_at ? " is-done" : "");
|
||||
tr.innerHTML =
|
||||
'<td class="pj-mtk-check"></td>' +
|
||||
'<td class="pj-mtk-title" colspan="' + COLS.length + '">' +
|
||||
'<span class="material-symbols-outlined pj-mtk-parent-ic">folder</span> ' +
|
||||
'<span class="pj-mtk-parent-name">' + escapeHtml(subtask.parent_title || "(상위 업무)") + "</span>" +
|
||||
'<span class="pj-mtk-parent-hint">' + (parentIsMine ? "상위 업무" : "다른 담당자의 상위 업무") + "</span>" +
|
||||
"</td>";
|
||||
tr.addEventListener("click", function () {
|
||||
location.href = "/project/p/" + subtask.project_id + "?task=" + subtask.parent_task_id;
|
||||
});
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
|
||||
function render() {
|
||||
renderHead();
|
||||
const rows = visible().slice().sort(function (a, b) {
|
||||
@@ -994,31 +1053,45 @@
|
||||
if (va > vb) return sort.dir;
|
||||
return 0;
|
||||
});
|
||||
const topIds = {};
|
||||
rows.forEach(function (t) { topIds[t.id] = true; });
|
||||
|
||||
// 내가 담당자인 하위 업무 — 필터를 각자 자기 완료 상태로 통과한 것만,
|
||||
// 부모 id 별로 묶는다(부모가 내 목록에 있으면 그 아래에, 없으면 안내
|
||||
// 행 아래에 묶어서 보여준다).
|
||||
const subsByParent = {};
|
||||
tasks.forEach(function (t) {
|
||||
if (!t.parent_task_id || !passFilter(t)) return;
|
||||
(subsByParent[t.parent_task_id] = subsByParent[t.parent_task_id] || []).push(t);
|
||||
});
|
||||
|
||||
const tbody = table.querySelector("tbody");
|
||||
tbody.innerHTML = "";
|
||||
let rowCount = 0;
|
||||
rows.forEach(function (t) {
|
||||
const tr = document.createElement("tr");
|
||||
tr.className = "pj-mtk-row" + (t.completed_at ? " is-done" : "");
|
||||
tr.dataset.taskId = t.id;
|
||||
tr.innerHTML =
|
||||
'<td class="pj-mtk-check"><input type="checkbox"' + (t.completed_at ? " checked" : "") + " /></td>" +
|
||||
COLS.map(function (c) { return '<td class="' + c.cls + '">' + c.html(t) + "</td>"; }).join("");
|
||||
const chk = tr.querySelector('input[type="checkbox"]');
|
||||
chk.addEventListener("click", function (e) { e.stopPropagation(); });
|
||||
chk.addEventListener("change", function () { toggleDone(t, chk.checked); });
|
||||
tr.addEventListener("click", function (e) {
|
||||
if (e.target.closest(".pj-cmt-badge")) return; // 말풍선은 댓글 팝업 담당
|
||||
location.href = "/project/p/" + t.project_id + "?task=" + t.id;
|
||||
appendTaskRow(tbody, t, {});
|
||||
rowCount++;
|
||||
const kids = subsByParent[t.id];
|
||||
if (!kids) return;
|
||||
delete subsByParent[t.id];
|
||||
kids.forEach(function (k, i) {
|
||||
appendTaskRow(tbody, k, { isSub: true, isLast: i === kids.length - 1 });
|
||||
rowCount++;
|
||||
});
|
||||
tr.addEventListener("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
showContextMenu(e.clientX, e.clientY, rowContextItems(t));
|
||||
});
|
||||
if (cmt) cmt.wireBadge(tr.querySelector(".pj-cmt-badge"));
|
||||
tbody.appendChild(tr);
|
||||
});
|
||||
table.hidden = rows.length === 0;
|
||||
if (emptyEl) emptyEl.hidden = rows.length > 0;
|
||||
// 남은 그룹 = 부모가 내 업무 목록에 없는(=다른 사람 담당인) 하위 업무.
|
||||
Object.keys(subsByParent).forEach(function (pid) {
|
||||
const kids = subsByParent[pid];
|
||||
if (!kids.length || topIds[pid]) return;
|
||||
appendParentGroupRow(tbody, kids[0]);
|
||||
rowCount++;
|
||||
kids.forEach(function (k, i) {
|
||||
appendTaskRow(tbody, k, { isSub: true, isLast: i === kids.length - 1 });
|
||||
rowCount++;
|
||||
});
|
||||
});
|
||||
table.hidden = rowCount === 0;
|
||||
if (emptyEl) emptyEl.hidden = rowCount > 0;
|
||||
|
||||
const openN = tasks.filter(function (t) { return !t.completed_at; }).length;
|
||||
const overdueN = tasks.filter(function (t) {
|
||||
|
||||
Reference in New Issue
Block a user