feat(project): 아사나식 세션 머리(+ / … 메뉴) + 카드 하위 업무 펼치기
- 세션 머리: 이름 바로 오른쪽에 업무 수(숫자만), 오른쪽 끝 +(업무 추가)·… 메뉴(업무 추가/이름 변경/세션 편집/세션 업무 모두 완료/완료 세션 지정·해제/ 삭제). 기존 ✎·☐·× 버튼 제거, 헤더 우클릭도 같은 메뉴. - 카드: 하위 업무가 있으면 'N ⤷ ▾' 토글. 누르면 카드 아래로 하위 업무 목록 (완료 체크·제목·마감·담당자) 펼침. 체크로 바로 완료 토글. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260923l" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260924a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -98,5 +98,5 @@
|
||||
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20260923l" defer></script>
|
||||
<script src="/static/project.js?v=20260924a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260923l" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260924a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -119,5 +119,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20260923l" defer></script>
|
||||
<script src="/static/project.js?v=20260924a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260923l" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260924a" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -505,5 +505,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20260923l" defer></script>
|
||||
<script src="/static/project.js?v=20260924a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
+42
-11
@@ -270,14 +270,17 @@
|
||||
border-radius: 13px 13px 0 0;
|
||||
}
|
||||
.pj-col-head.pj-col-head-colored .pj-col-name { color: #fff; }
|
||||
.pj-col-head.pj-col-head-colored .pj-col-count { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.4); color: #fff; }
|
||||
.pj-col-head.pj-col-head-colored .pj-col-ctrls .pj-icon-btn { color: #fff; }
|
||||
.pj-col-head.pj-col-head-colored .pj-col-count { color: rgba(255,255,255,.85); }
|
||||
.pj-col-head.pj-col-head-colored .pj-col-actions .pj-icon-btn { color: #fff; }
|
||||
.pj-col-head.pj-col-head-colored .pj-col-actions .pj-icon-btn:hover { background: rgba(255,255,255,.22); }
|
||||
.pj-col-head.pj-col-head-colored .pj-chip { background: rgba(255,255,255,.28); color: #fff; }
|
||||
.pj-col-count {
|
||||
margin-left: auto; color: var(--pj-ink-soft); font-weight: 700; font-size: 11px;
|
||||
background: #fff; border: 1px solid #e2e4ea; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px;
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
}
|
||||
/* 업무 수 — 아사나처럼 이름 바로 오른쪽에 숫자만(배지 없음) */
|
||||
.pj-col-count { color: var(--pj-ink-soft); font-weight: 500; font-size: 14px; margin-left: 2px; }
|
||||
/* 오른쪽 끝 + (업무 추가) / … (세션 메뉴) */
|
||||
.pj-col-actions { margin-left: auto; display: inline-flex; gap: 2px; flex: 0 0 auto; }
|
||||
.pj-col-actions .pj-icon-btn { width: 28px; height: 28px; color: var(--pj-ink-soft); }
|
||||
.pj-col-actions .pj-icon-btn .material-symbols-outlined { font-size: 20px; }
|
||||
.pj-col-actions .pj-icon-btn:hover { color: var(--pj-ink); background: rgba(0,0,0,.06); }
|
||||
/* 컬럼 안의 카드가 많아지면 보드 전체가 아니라 이 컬럼만 세로로 스크롤한다
|
||||
— 그래야 가로로 늘어난 다른 세션들이 화면 밖으로 밀려나지 않는다. */
|
||||
.pj-col-body {
|
||||
@@ -766,9 +769,6 @@
|
||||
/* ── 보드 단계 컨트롤 ── */
|
||||
.pj-col-head { position: relative; }
|
||||
.pj-col-name { font-weight: 700; }
|
||||
.pj-col-ctrls { display: none; gap: 3px; margin-left: 6px; }
|
||||
.pj-col:hover .pj-col-ctrls { display: inline-flex; }
|
||||
.pj-col-ctrls .pj-icon-btn { width: 28px; height: 28px; font-size: 17px; }
|
||||
.pj-icon-btn[disabled] { opacity: .3; cursor: default; }
|
||||
.pj-add-stage { width: 100%; padding: 10px; border: 1px dashed #c9cdd3; border-radius: 12px; background: #fff; color: #6b7280; font-size: 13px; font-weight: 600; cursor: pointer; }
|
||||
.pj-add-stage:hover { border-color: #1e1f21; color: #1e1f21; }
|
||||
@@ -788,7 +788,38 @@
|
||||
.pj-col.pj-col-drop-target { outline: 2px dashed #aebfe6; outline-offset: -2px; border-radius: 12px; }
|
||||
|
||||
/* 업무 카드 — 하위 업무 진행 배지("2/5") */
|
||||
.pj-card-subtasks { font-size: 11px; color: #6b7280; background: #eef0f2; border-radius: 999px; padding: 1px 7px; font-weight: 600; }
|
||||
/* ── 카드 하위 업무(아사나처럼) — "N ⤷ ▾" 토글 + 카드 아래로 펼치는 목록 ── */
|
||||
.pj-card-subtoggle {
|
||||
display: inline-flex; align-items: center; gap: 1px; flex: 0 0 auto; margin-left: auto;
|
||||
height: 22px; padding: 0 2px 0 6px; border: 1px solid transparent; border-radius: 6px;
|
||||
background: transparent; color: var(--pj-ink-soft); font: inherit; font-size: 12px; font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pj-card-subtoggle:hover { background: #f1f2f4; color: var(--pj-ink); }
|
||||
.pj-card-subtoggle.is-open { border-color: #4573d2; color: var(--pj-ink); background: #fff; }
|
||||
.pj-card-subtoggle-ic { font-size: 15px; transform: scaleX(-1) rotate(90deg); }
|
||||
.pj-card-subtoggle-caret { font-size: 18px; margin-left: -2px; transition: transform .12s; }
|
||||
.pj-card-subtoggle.is-open .pj-card-subtoggle-caret { transform: rotate(180deg); }
|
||||
.pj-card-subs { margin: 10px -4px 0; border-top: 1px solid #eef0f2; }
|
||||
.pj-card-sub {
|
||||
display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 2px 4px;
|
||||
border-bottom: 1px solid #eef0f2; font-size: 13px; color: var(--pj-ink);
|
||||
}
|
||||
.pj-card-sub:hover { background: #f7f8fa; }
|
||||
.pj-card-sub-check {
|
||||
flex: 0 0 auto; display: inline-flex; padding: 0; border: 0; background: none; cursor: pointer;
|
||||
color: #8b929b; border-radius: 50%;
|
||||
}
|
||||
.pj-card-sub-check .material-symbols-outlined { font-size: 19px; }
|
||||
.pj-card-sub-check:hover { color: #58a182; }
|
||||
.pj-card-sub.is-done .pj-card-sub-check { color: #58a182; }
|
||||
.pj-card-sub.is-done .pj-card-sub-check .material-symbols-outlined { font-variation-settings: "FILL" 1; }
|
||||
.pj-card-sub-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.pj-card-sub.is-done .pj-card-sub-title { color: #9aa1a9; }
|
||||
.pj-card-sub-due { flex: 0 0 auto; font-size: 12px; color: var(--pj-ink-soft); }
|
||||
.pj-card-sub-due.is-overdue { color: #c22b10; }
|
||||
.pj-card-sub-av { flex: 0 0 auto; display: inline-flex; }
|
||||
.pj-card-sub-empty { padding: 8px 4px; font-size: 12px; color: #9aa1a9; }
|
||||
|
||||
/* 프로젝트 스코프 토글(이 프로젝트 / 전체 프로젝트) — 뷰 탭과 같은 모양 재사용 */
|
||||
#pj-scope-toggle { margin-left: auto; }
|
||||
|
||||
+191
-70
@@ -2224,20 +2224,21 @@
|
||||
'<div class="pj-col-head' + (s.color ? " pj-col-head-colored" : "") + '"' +
|
||||
(canManage ? ' draggable="true"' : "") +
|
||||
(s.color ? ' style="background:' + hexToRgba(s.color, 0.6) + '"' : "") + '>' +
|
||||
// 아사나처럼: 이름 바로 오른쪽에 업무 수(숫자만), 맨 오른쪽에 + / … 버튼.
|
||||
'<span class="pj-col-name">' + escapeHtml(s.name) + "</span>" +
|
||||
// 세션 기본 담당자 — 이름 옆 작은 아이콘(마우스를 올리면 누구인지).
|
||||
'<span class="pj-col-count"></span>' +
|
||||
// 세션 기본 담당자 — 작은 아이콘(마우스를 올리면 누구인지).
|
||||
(s.default_assignee_email
|
||||
? '<span class="pj-col-assignee" title="기본 담당자: ' + escapeHtml(idOf(s.default_assignee_email)) + '">' +
|
||||
avatarHtml(s.default_assignee_email, "pj-gicon-sm") + "</span>"
|
||||
: "") +
|
||||
(s.is_done_stage ? '<span class="pj-chip pj-chip-sm">완료</span>' : "") +
|
||||
'<span class="pj-col-count"></span>' +
|
||||
(canManage
|
||||
? '<span class="pj-col-ctrls">' +
|
||||
'<button type="button" class="pj-icon-btn pj-col-rename" title="세션 편집">✎</button>' +
|
||||
'<button type="button" class="pj-icon-btn pj-col-toggledone" title="완료 세션 지정/해제">' +
|
||||
(s.is_done_stage ? "☑" : "☐") + "</button>" +
|
||||
'<button type="button" class="pj-icon-btn pj-col-del" title="세션 삭제">×</button>' +
|
||||
? '<span class="pj-col-actions">' +
|
||||
'<button type="button" class="pj-icon-btn pj-col-add" title="업무 추가">' +
|
||||
'<span class="material-symbols-outlined">add</span></button>' +
|
||||
'<button type="button" class="pj-icon-btn pj-col-more" title="세션 메뉴">' +
|
||||
'<span class="material-symbols-outlined">more_horiz</span></button>' +
|
||||
"</span>"
|
||||
: "") +
|
||||
"</div><div class=\"pj-col-body\"></div>" +
|
||||
@@ -2308,71 +2309,103 @@
|
||||
renderBoard();
|
||||
} catch (err) { showToast("삭제 실패: " + err.message, "error"); }
|
||||
}
|
||||
// 세션 이름 클릭 → 그 자리에서 이름 변경(Enter/포커스 이탈=저장, Esc=취소).
|
||||
// 헤더가 드래그(세션 재정렬) 대상이라 편집 중엔 draggable 을 꺼 둔다 —
|
||||
// 안 끄면 입력칸 안에서 글자 선택하려고 끌면 컬럼이 끌려간다.
|
||||
const nameEl = col.querySelector(".pj-col-name");
|
||||
if (nameEl) {
|
||||
nameEl.classList.add("pj-col-name-editable");
|
||||
nameEl.title = "클릭해서 이름 변경";
|
||||
nameEl.addEventListener("click", function (e) {
|
||||
e.stopPropagation();
|
||||
const head = col.querySelector(".pj-col-head");
|
||||
const wasDraggable = head.getAttribute("draggable");
|
||||
head.setAttribute("draggable", "false");
|
||||
const input = document.createElement("input");
|
||||
input.type = "text";
|
||||
input.className = "pj-col-name-input";
|
||||
input.value = s.name;
|
||||
input.maxLength = 100;
|
||||
nameEl.replaceWith(input);
|
||||
input.focus();
|
||||
input.select();
|
||||
let done = false;
|
||||
async function finish(save) {
|
||||
if (done) return;
|
||||
done = true;
|
||||
const name = input.value.trim();
|
||||
if (!save || !name || name === s.name) {
|
||||
input.replaceWith(nameEl);
|
||||
if (wasDraggable) head.setAttribute("draggable", wasDraggable);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await api("PUT", "/project/api/projects/" + projectId + "/stages/" + s.id, { name: name });
|
||||
await reloadStagesForCurrentProject();
|
||||
renderBoard();
|
||||
} catch (err) {
|
||||
showToast("이름 변경 실패: " + err.message, "error");
|
||||
input.replaceWith(nameEl);
|
||||
if (wasDraggable) head.setAttribute("draggable", wasDraggable);
|
||||
}
|
||||
}
|
||||
input.addEventListener("keydown", function (ev) {
|
||||
if (ev.isComposing) return; // 한글 조합 중 Enter 는 무시
|
||||
if (ev.key === "Enter") { ev.preventDefault(); finish(true); }
|
||||
else if (ev.key === "Escape") { ev.preventDefault(); finish(false); }
|
||||
});
|
||||
input.addEventListener("blur", function () { finish(true); });
|
||||
input.addEventListener("click", function (ev) { ev.stopPropagation(); });
|
||||
// 세션의 미완료 업무를 한 번에 완료 처리("세션 업무 모두 완료").
|
||||
async function completeAllInStage() {
|
||||
const open = tasks.filter(function (t) {
|
||||
return t.stage_id === s.id && !t.parent_task_id && !t.completed_at;
|
||||
});
|
||||
if (!open.length) { showToast("완료할 업무가 없습니다."); return; }
|
||||
const ok = await window.erpConfirm(
|
||||
"'" + s.name + "' 세션의 미완료 업무 " + open.length + "개를 모두 완료로 표시할까요?",
|
||||
{ okText: "모두 완료", cancelText: "취소" }
|
||||
);
|
||||
if (!ok) return;
|
||||
let fail = 0;
|
||||
for (const t of open) {
|
||||
try {
|
||||
const res = await api("PUT", "/project/api/tasks/" + t.id, { completed: true });
|
||||
if (res && res.task) mergeTask(res.task);
|
||||
} catch (_) { fail++; }
|
||||
}
|
||||
renderBoard();
|
||||
if (fail) showToast(fail + "개 완료 처리 실패", "error");
|
||||
}
|
||||
const renameBtn = col.querySelector(".pj-col-rename");
|
||||
if (renameBtn) renameBtn.addEventListener("click", function (e) { e.stopPropagation(); editStage(); });
|
||||
const doneBtn = col.querySelector(".pj-col-toggledone");
|
||||
if (doneBtn) doneBtn.addEventListener("click", function (e) { e.stopPropagation(); toggleDoneStage(); });
|
||||
const delBtn = col.querySelector(".pj-col-del");
|
||||
if (delBtn) delBtn.addEventListener("click", function (e) { e.stopPropagation(); deleteStage(); });
|
||||
const head = col.querySelector(".pj-col-head");
|
||||
if (head) head.addEventListener("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
showContextMenu(e.clientX, e.clientY, [
|
||||
// 세션 … 메뉴(버튼 클릭)와 머리 우클릭이 같은 항목을 쓴다.
|
||||
function stageMenuItems() {
|
||||
return [
|
||||
{ label: "업무 추가", onClick: function () { openTaskModal(null, s.id); } },
|
||||
{ label: "세션 편집", onClick: editStage },
|
||||
{ label: "이름 변경", onClick: startRename },
|
||||
{ label: "세션 편집 (색상·기본 담당자)", onClick: editStage },
|
||||
null,
|
||||
{ label: "세션 업무 모두 완료", onClick: completeAllInStage },
|
||||
{ label: s.is_done_stage ? "완료 세션 해제" : "완료 세션으로 지정", onClick: toggleDoneStage },
|
||||
null,
|
||||
{ label: "삭제", danger: true, onClick: deleteStage },
|
||||
]);
|
||||
];
|
||||
}
|
||||
// 세션 이름 클릭(또는 메뉴 "이름 변경") → 그 자리에서 이름 변경
|
||||
// (Enter/포커스 이탈=저장, Esc=취소). 헤더가 드래그(세션 재정렬) 대상이라
|
||||
// 편집 중엔 draggable 을 꺼 둔다 — 안 끄면 입력칸 안에서 글자 선택하려고
|
||||
// 끌면 컬럼이 끌려간다.
|
||||
const nameEl = col.querySelector(".pj-col-name");
|
||||
function startRename() {
|
||||
if (!nameEl || !nameEl.isConnected) return;
|
||||
const head = col.querySelector(".pj-col-head");
|
||||
const wasDraggable = head.getAttribute("draggable");
|
||||
head.setAttribute("draggable", "false");
|
||||
const input = document.createElement("input");
|
||||
input.type = "text";
|
||||
input.className = "pj-col-name-input";
|
||||
input.value = s.name;
|
||||
input.maxLength = 100;
|
||||
nameEl.replaceWith(input);
|
||||
input.focus();
|
||||
input.select();
|
||||
let done = false;
|
||||
async function finish(save) {
|
||||
if (done) return;
|
||||
done = true;
|
||||
const name = input.value.trim();
|
||||
if (!save || !name || name === s.name) {
|
||||
input.replaceWith(nameEl);
|
||||
if (wasDraggable) head.setAttribute("draggable", wasDraggable);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await api("PUT", "/project/api/projects/" + projectId + "/stages/" + s.id, { name: name });
|
||||
await reloadStagesForCurrentProject();
|
||||
renderBoard();
|
||||
} catch (err) {
|
||||
showToast("이름 변경 실패: " + err.message, "error");
|
||||
input.replaceWith(nameEl);
|
||||
if (wasDraggable) head.setAttribute("draggable", wasDraggable);
|
||||
}
|
||||
}
|
||||
input.addEventListener("keydown", function (ev) {
|
||||
if (ev.isComposing) return; // 한글 조합 중 Enter 는 무시
|
||||
if (ev.key === "Enter") { ev.preventDefault(); finish(true); }
|
||||
else if (ev.key === "Escape") { ev.preventDefault(); finish(false); }
|
||||
});
|
||||
input.addEventListener("blur", function () { finish(true); });
|
||||
input.addEventListener("click", function (ev) { ev.stopPropagation(); });
|
||||
}
|
||||
if (nameEl) {
|
||||
nameEl.classList.add("pj-col-name-editable");
|
||||
nameEl.title = "클릭해서 이름 변경";
|
||||
nameEl.addEventListener("click", function (e) { e.stopPropagation(); startRename(); });
|
||||
}
|
||||
const addBtn = col.querySelector(".pj-col-add");
|
||||
if (addBtn) addBtn.addEventListener("click", function (e) { e.stopPropagation(); openTaskModal(null, s.id); });
|
||||
const moreBtn = col.querySelector(".pj-col-more");
|
||||
if (moreBtn) moreBtn.addEventListener("click", function (e) {
|
||||
e.stopPropagation();
|
||||
const r = moreBtn.getBoundingClientRect();
|
||||
showContextMenu(r.left, r.bottom + 4, stageMenuItems());
|
||||
});
|
||||
const head = col.querySelector(".pj-col-head");
|
||||
if (head) head.addEventListener("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
showContextMenu(e.clientX, e.clientY, stageMenuItems());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2575,6 +2608,67 @@
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ── 카드 하위 업무 펼치기(아사나처럼) — 카드의 "N ⤷ ▾" 버튼을 누르면 카드
|
||||
// 아래로 하위 업무 목록이 늘어난다. 펼친 상태는 보드를 다시 그려도 유지
|
||||
// (페이지에 머무는 동안). 목록은 처음 펼칠 때 받아 캐시하고, 업무 팝업이
|
||||
// 닫히면(거기서 하위 업무를 고쳤을 수 있으니) 캐시를 비운다(아래 observer).
|
||||
const expandedSubs = new Set();
|
||||
const subsCache = {};
|
||||
function cardSubRowHtml(sub) {
|
||||
const overdue = sub.due_date && !sub.completed_at && sub.due_date < todayIso;
|
||||
return '<div class="pj-card-sub' + (sub.completed_at ? " is-done" : "") + '" data-sub-id="' + sub.id + '">' +
|
||||
'<button type="button" class="pj-card-sub-check" title="' + (sub.completed_at ? "완료 취소" : "완료로 표시") + '">' +
|
||||
'<span class="material-symbols-outlined">check_circle</span></button>' +
|
||||
'<span class="pj-card-sub-title">' + escapeHtml(sub.title || "") + "</span>" +
|
||||
(sub.due_date
|
||||
? '<span class="pj-card-sub-due' + (overdue ? " is-overdue" : "") + '">' + escapeHtml(fmtDateKr(sub.due_date)) + "</span>"
|
||||
: "") +
|
||||
(sub.assignee_email
|
||||
? '<span class="pj-card-sub-av" title="' + escapeHtml(idOf(sub.assignee_email)) + '">' + avatarHtml(sub.assignee_email, "pj-gicon-sm") + "</span>"
|
||||
: "") +
|
||||
"</div>";
|
||||
}
|
||||
function fillCardSubs(box, t) {
|
||||
const subs = subsCache[t.id];
|
||||
if (!subs) {
|
||||
box.innerHTML = '<div class="pj-card-sub-empty">불러오는 중…</div>';
|
||||
api("GET", "/project/api/tasks/" + t.id).then(function (res) {
|
||||
const subs = (res && res.subtasks) || [];
|
||||
subsCache[t.id] = subs;
|
||||
// 카드 숫자가 옛 값이면(팝업에서 하위 업무를 추가·삭제) 맞춰서 다시 그린다.
|
||||
const doneN = subs.filter(function (x) { return x.completed_at; }).length;
|
||||
if (subs.length !== (t.subtask_total || 0) || doneN !== (t.subtask_done || 0)) {
|
||||
t.subtask_total = subs.length;
|
||||
t.subtask_done = doneN;
|
||||
if (!subs.length) expandedSubs.delete(t.id);
|
||||
renderBoard();
|
||||
} else if (box.isConnected) fillCardSubs(box, t);
|
||||
}).catch(function (e) {
|
||||
box.innerHTML = '<div class="pj-card-sub-empty">불러오기 실패: ' + escapeHtml(e.message) + "</div>";
|
||||
});
|
||||
return;
|
||||
}
|
||||
box.innerHTML = subs.length
|
||||
? subs.map(cardSubRowHtml).join("")
|
||||
: '<div class="pj-card-sub-empty">하위 업무 없음</div>';
|
||||
box.querySelectorAll(".pj-card-sub").forEach(function (row) {
|
||||
const sub = subs.find(function (x) { return String(x.id) === row.dataset.subId; });
|
||||
if (!sub) return;
|
||||
const check = row.querySelector(".pj-card-sub-check");
|
||||
check.addEventListener("click", async function (e) {
|
||||
e.stopPropagation();
|
||||
if (!canManage) return;
|
||||
const done = !sub.completed_at;
|
||||
try {
|
||||
const res = await api("PUT", "/project/api/tasks/" + sub.id, { completed: done });
|
||||
sub.completed_at = (res && res.task && res.task.completed_at) || (done ? todayIso : null);
|
||||
t.subtask_done = Math.max(0, (t.subtask_done || 0) + (done ? 1 : -1));
|
||||
renderBoard();
|
||||
} catch (err) { showToast("변경 실패: " + err.message, "error"); }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function taskCard(t) {
|
||||
const card = document.createElement("div");
|
||||
card.className = "pj-card" + (t.completed_at ? " is-done" : "");
|
||||
@@ -2600,17 +2694,35 @@
|
||||
(t.assignee_email ? '' : ' is-empty') + '" title="담당자 변경">' +
|
||||
avatarHtml(t.assignee_email, "pj-gicon-sm") +
|
||||
escapeHtml(t.assignee_email ? idOf(t.assignee_email) : "담당자") + "</span>" +
|
||||
(t.subtask_total
|
||||
? '<span class="pj-card-subtasks" title="하위 업무">' + (t.subtask_done || 0) + "/" + t.subtask_total + "</span>"
|
||||
: "") +
|
||||
'<span class="pj-card-due pj-card-edit-hit' + (t.due_date ? '' : ' is-empty') +
|
||||
'" title="마감일 변경">' + (t.due_date ? escapeHtml(t.due_date) : "마감일") + "</span>" +
|
||||
// 하위 업무 — 아사나처럼 "개수 + 하위 업무 아이콘 + ▾", 누르면 카드 아래로 펼침.
|
||||
(t.subtask_total
|
||||
? '<button type="button" class="pj-card-subtoggle' + (expandedSubs.has(t.id) ? " is-open" : "") +
|
||||
'" title="하위 업무 ' + t.subtask_total + "개 (완료 " + (t.subtask_done || 0) + ')">' +
|
||||
'<span class="pj-card-subtoggle-n">' + t.subtask_total + "</span>" +
|
||||
'<span class="material-symbols-outlined pj-card-subtoggle-ic">account_tree</span>' +
|
||||
'<span class="material-symbols-outlined pj-card-subtoggle-caret">arrow_drop_down</span>' +
|
||||
"</button>"
|
||||
: "") +
|
||||
(t.comment_count
|
||||
? '<span class="pj-card-cmt pj-cmt-badge" data-task-id="' + t.id + '" data-count="' + t.comment_count +
|
||||
'" title="댓글 ' + t.comment_count + '개">' + cmtBadge(t) + "</span>"
|
||||
: "") +
|
||||
"</div>";
|
||||
"</div>" +
|
||||
(t.subtask_total && expandedSubs.has(t.id) ? '<div class="pj-card-subs"></div>' : "");
|
||||
const subsBox = card.querySelector(".pj-card-subs");
|
||||
if (subsBox) fillCardSubs(subsBox, t);
|
||||
card.addEventListener("click", function (e) {
|
||||
// 하위 업무 펼치기/접기 — 보기 권한만 있어도 된다.
|
||||
if (e.target.closest(".pj-card-subtoggle")) {
|
||||
e.stopPropagation();
|
||||
if (expandedSubs.has(t.id)) expandedSubs.delete(t.id);
|
||||
else { expandedSubs.add(t.id); delete subsCache[t.id]; } // 펼칠 때마다 최신으로
|
||||
renderBoard();
|
||||
return;
|
||||
}
|
||||
if (e.target.closest(".pj-card-sub-check")) return;
|
||||
if (!canManage) return;
|
||||
// 담당자/마감일 칩을 누른 경우엔 업무 팝업 대신 그 자리 편집기를 연다.
|
||||
const hitAssignee = e.target.closest(".pj-card-assignee");
|
||||
@@ -3822,6 +3934,15 @@
|
||||
// 멤버 업무 팝업 — 공용 구현(initMemberTasks, 위쪽 정의). 이 화면에선
|
||||
// 더블클릭하면 그 자리에서 업무 편집 팝업을 열고, 닫히면 멤버 팝업을 다시 연다.
|
||||
const openMemberTasksModal = initMemberTasks({ openTask: openTaskModal, taskModal: taskModal });
|
||||
// 업무 팝업이 닫히면 카드에 펼쳐 둔 하위 업무 캐시를 비운다(팝업에서 하위
|
||||
// 업무를 추가·수정했을 수 있다). 다음에 보드를 그릴 때 다시 받는다.
|
||||
if (taskModal) {
|
||||
new MutationObserver(function () {
|
||||
if (!taskModal.hidden) return;
|
||||
Object.keys(subsCache).forEach(function (k) { delete subsCache[k]; });
|
||||
if (expandedSubs.size && currentView === "board") renderBoard();
|
||||
}).observe(taskModal, { attributes: true, attributeFilter: ["hidden"] });
|
||||
}
|
||||
|
||||
const addMemberBtn = el("pj-add-member");
|
||||
if (addMemberBtn) addMemberBtn.addEventListener("click", async function () {
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
- **하위 업무(subtask)** — 새 테이블이 아니라 `tasks.parent_task_id` 재사용
|
||||
(부모 삭제 시 CASCADE). 업무 편집 팝업 안에 인라인으로 표시되며(체크박스+
|
||||
제목+담당자+마감일, 한 줄에서 바로 저장), 보드/캘린더/리스트에는 최상위
|
||||
업무만 카드로 뜬다(하위 업무는 부모 카드에 "2/5" 진행 배지로만 나타난다).
|
||||
업무만 카드로 뜬다(하위 업무는 부모 카드의 "N ⤷ ▾" 토글로 — 누르면 아사나처럼 카드 아래로
|
||||
하위 업무 목록(완료 체크·제목·마감·담당자)이 펼쳐진다. 펼친 상태는 페이지에 머무는 동안 유지).
|
||||
세션을 갖지 않는다(칸반에 안 보이므로).
|
||||
- **멀티호밍(다른 프로젝트에 연결)** — `task_project_links` 테이블. 업무 하나가
|
||||
원래 소속(기본 홈, `tasks.project_id`/`stage_id`)과 무관하게 다른 프로젝트의
|
||||
@@ -219,7 +220,9 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중
|
||||
그리드 `1 / -1`). 하위 업무는 제목 왼쪽 체크박스로 완료를 토글하고, 완료된 줄은
|
||||
반투명(50%) + 취소선. 좁은 화면과 "새 업무"(compact)에서는 단일 컬럼으로 흐른다.
|
||||
- **첨부** `task_attachments` — 업무 모달. 파일 업로드(최대 20MB)/다운로드/삭제. 실제 파일은 `DATA_DIR/project/<task_id>/<uuid>.<ext>`, DB엔 메타만. 첨부 디렉토리는 운영 볼륨(DATA_DIR)에 저장돼 재배포에도 보존. 설명란 이미지 삽입도 이 표를 재사용(§1-1).
|
||||
- **세션 편집** — 보드 칸반 헤더에서 이름변경/완료토글/삭제, 트레일링 "+ 세션 추가", **컬럼 드래그로 순서 변경**. `PUT .../stages/order`, `PUT .../stages/{id}`, 삭제는 만든 사람만.
|
||||
- **세션 편집** — 보드 칸반 헤더(아사나식): 이름 바로 오른쪽에 업무 수(숫자만), 오른쪽 끝 **+**(업무 추가)·
|
||||
**…**(메뉴: 업무 추가 / 이름 변경 / 세션 편집(색상·기본 담당자) / 세션 업무 모두 완료 / 완료 세션 지정·해제 / 삭제,
|
||||
헤더 우클릭도 같은 메뉴). 이름 클릭 = 그 자리 이름 변경. 트레일링 "+ 세션 추가", **컬럼 드래그로 순서 변경**. `PUT .../stages/order`, `PUT .../stages/{id}`, 삭제는 만든 사람만.
|
||||
- **알림센터(인앱)** `project_notifications` — 배정/완료/댓글 시 수신자별 알림 생성. 우측 상단 벨(미읽음 배지) → `/project/inbox`. 항목 클릭=읽음, "모두 읽음". 본인 행동은 알림 제외.
|
||||
- 마이그레이션: `scripts/sql/project_db_002_attachments_notifications.sql` (첨부·알림 테이블 + 권한), `scripts/sql/project_db_003_sections_subtasks_links.sql` (세션 생성자·하위업무·멀티호밍).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user