diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html index a8794fc..2c62916 100644 --- a/app/modules/project/templates/project/inbox.html +++ b/app/modules/project/templates/project/inbox.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -98,5 +98,5 @@ {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/mytasks.html b/app/modules/project/templates/project/mytasks.html index 3d29584..00a2f1f 100644 --- a/app/modules/project/templates/project/mytasks.html +++ b/app/modules/project/templates/project/mytasks.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -119,5 +119,5 @@ "today": {{ today | tojson }} } - + {% endblock %} diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html index 4df8edb..dcae9bf 100644 --- a/app/modules/project/templates/project/project.html +++ b/app/modules/project/templates/project/project.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + @@ -505,5 +505,5 @@ - + {% endblock %} diff --git a/app/static/project.css b/app/static/project.css index c234c1d..7cc5697 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -985,6 +985,40 @@ label.pj-desc-fmtbtn { line-height: 26px; } .pj-ctxmenu-item.is-danger { color: #c22b10; } .pj-ctxmenu-item.is-danger:hover { background: #fbecea; } .pj-ctxmenu-sep { height: 1px; background: var(--pj-border); margin: 4px 2px; } +/* 메뉴 항목 아이콘(담당자 아바타 등) + 오른쪽 현재값 ✓ */ +.pj-ctxmenu-ic { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; } +.pj-ctxmenu-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.pj-ctxmenu-check { flex: 0 0 auto; font-size: 18px; color: var(--pj-accent); } +.pj-ctxmenu-item.is-checked { font-weight: 600; } + +/* ── 담당자 아이콘(메뉴·버튼 공용) — 사진 / 기본 사람 / 미지정 점선 원 ── */ +.pj-person-ic { flex: 0 0 auto; } +img.pj-person-ic { width: 22px; height: 22px; } +.pj-gicon.pj-person-ic { font-size: 24px; color: #9aa1a9; } +.pj-person-ic.is-empty { display: inline-flex; color: #6d6e6f; } + +/* 담당자 칸을 "아이콘 + 이름" 버튼으로 바꿔 보여준다. select 는 숨겨 + // 값 저장소로 그대로 둔다 — 기존 코드의 sel.value 읽기/쓰기, change 이벤트, + // selectedOptions 가 그대로 동작. 코드가 sel.value 를 바꾸거나 옵션을 다시 + // 채워도 버튼이 따라 바뀐다(value setter 가로채기 + MutationObserver). + function enhanceAssigneeSelect(sel) { + if (!sel || sel.dataset.pjEnhanced) return; + sel.dataset.pjEnhanced = "1"; + const btn = document.createElement("button"); + btn.type = "button"; + btn.className = "pj-assignee-btn " + (sel.className || ""); + if (sel.id) btn.dataset.for = sel.id; + sel.after(btn); + sel.hidden = true; + sel.style.display = "none"; + function sync() { + const v = sel.value; + const opt = sel.selectedOptions && sel.selectedOptions[0]; + btn.innerHTML = personIconHtml(v) + ''; + btn.querySelector(".pj-assignee-btn-name").textContent = v ? (opt ? opt.textContent : idOf(v)) : "(미지정)"; + btn.classList.toggle("is-empty", !v); + btn.disabled = sel.disabled; + btn.dataset.tip = v ? "담당자 변경" : "이 작업 배정"; + } + const desc = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value"); + Object.defineProperty(sel, "value", { + configurable: true, + get: function () { return desc.get.call(this); }, + set: function (v) { desc.set.call(this, v); sync(); }, + }); + new MutationObserver(sync).observe(sel, { childList: true, subtree: true, attributes: true, attributeFilter: ["disabled"] }); + sel.addEventListener("change", sync); + btn.addEventListener("click", function (e) { + e.stopPropagation(); + const emails = Array.prototype.map.call(sel.options, function (o) { return o.value; }) + .filter(function (v) { return v; }); + const r = btn.getBoundingClientRect(); + showContextMenu(r.left, r.bottom + 4, assigneeMenuItems(emails, sel.value, function (v) { + if (v === sel.value) return; + sel.value = v; + sel.dispatchEvent(new Event("change", { bubbles: true })); + })); + }); + sync(); + } + function chatAvatarHtml(email) { const url = pageAvatarUrl(email); if (url) return ''; @@ -2550,21 +2630,12 @@ let list; try { list = await membersOfProject(t.project_id); } catch (e) { showToast("멤버 조회 실패: " + e.message, "error"); return; } - const cur = (t.assignee_email || "").toLowerCase(); - const items = [{ - label: (cur ? "" : "✓ ") + "(미지정)", - onClick: function () { applyTaskPatch(t, { assignee_email: "", assignee_name: "" }, "담당자 변경 실패"); }, - }]; - list.forEach(function (m) { - const email = m.user_email; - items.push({ - label: (email.toLowerCase() === cur ? "✓ " : "") + idOf(email), - onClick: function () { - applyTaskPatch(t, { assignee_email: email, assignee_name: idOf(email) }, "담당자 변경 실패"); - }, - }); - }); - showContextMenu(x, y, items); + showContextMenu(x, y, assigneeMenuItems( + list.map(function (m) { return m.user_email; }), t.assignee_email, + function (email) { + applyTaskPatch(t, { assignee_email: email, assignee_name: email ? idOf(email) : "" }, "담당자 변경 실패"); + } + )); } // 마감일 — 카드 위에 작은 날짜 입력칸을 띄운다. 값이 바뀌면 바로 저장하고, @@ -2667,7 +2738,6 @@ let list; try { list = await membersOfProject(t.project_id); } catch (e) { showToast("멤버 조회 실패: " + e.message, "error"); return; } - const cur = (sub.assignee_email || "").toLowerCase(); async function pick(email) { try { await api("PUT", "/project/api/tasks/" + sub.id, @@ -2676,15 +2746,9 @@ if (box.isConnected) fillCardSubs(box, t); } catch (e) { showToast("담당자 변경 실패: " + e.message, "error"); } } - const items = [{ label: (cur ? "" : "✓ ") + "(미지정)", onClick: function () { pick(""); } }]; - list.forEach(function (m) { - const email = m.user_email; - items.push({ - label: (email.toLowerCase() === cur ? "✓ " : "") + idOf(email), - onClick: function () { pick(email); }, - }); - }); - showContextMenu(x, y, items); + showContextMenu(x, y, assigneeMenuItems( + list.map(function (m) { return m.user_email; }), sub.assignee_email, pick + )); } // 하위 업무를 받아 캐시. 카드 숫자가 옛 값이면(팝업에서 하위 업무를 // 추가·삭제) 맞춰 두고 true 를 돌려준다 — 그땐 보드를 다시 그려야 한다. @@ -3319,6 +3383,8 @@ // ── 업무 모달 ── const taskModal = el("pj-modal-task"); + // 업무 팝업의 담당자 칸 — "아이콘 + 이름" 버튼/메뉴로(아사나처럼). + enhanceAssigneeSelect(el("pj-t-assignee")); // 패널 너비 드래그 리사이즈 — 왼쪽 모서리를 끌면 오른쪽에 고정된 패널이 // 넓어진다(최소 420px, 최대 화면 절반). 마지막 너비는 기억해둔다. @@ -4438,6 +4504,7 @@ if (!listEl) return null; const input = el("pj-subtask-input"); const addAssignee = el("pj-subtask-add-assignee"); + 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; @@ -4468,6 +4535,7 @@ const delBtn = li.querySelector(".pj-subtask-del"); titleInp.value = sub.title || ""; assigneeSel.value = sub.assignee_email || ""; + enhanceAssigneeSelect(assigneeSel); dueInp.value = sub.due_date || ""; if (canDeleteFn(sub.created_by)) delBtn.hidden = false; diff --git a/docs/PROJECT_MODULE.md b/docs/PROJECT_MODULE.md index b8a83ba..a6b5b66 100644 --- a/docs/PROJECT_MODULE.md +++ b/docs/PROJECT_MODULE.md @@ -91,6 +91,10 @@ > 안쪽으로 밀리고 위가 모자라면 아래로 뒤집힘. 요소에 `data-tip="문구"` 또는 `title="문구"` 만 달면 > 된다(`title` 은 마우스를 올리는 순간 `data-tip` 으로 옮겨져 브라우저 기본 말풍선이 안 뜬다). > 별도 툴팁 구현 금지 — 부득이하면(대시보드 막대처럼 요소에 붙는 것) 같은 색·꼬리 모양으로. +> +> **담당자 고르기 규칙 — 모든 화면·앞으로 추가하는 기능 공통.** 담당자를 고르는 곳은 항상 "아이콘 + 이름". +> 팝업 메뉴는 `assigneeMenuItems(emails, cur, onPick)` + `showContextMenu`(항목 `icon`/`checked` 지원), 폼의 +> `