diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index 6c47529..c061f88 100644 --- a/app/modules/project/templates/project/goal_meeting.html +++ b/app/modules/project/templates/project/goal_meeting.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -246,5 +246,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/goals.html b/app/modules/project/templates/project/goals.html index 99ef1f1..be348a9 100644 --- a/app/modules/project/templates/project/goals.html +++ b/app/modules/project/templates/project/goals.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -136,40 +136,19 @@ {# ── 업무 영역 — 영역마다 tbody 하나, 배경은 영역 색. 이름은 눌러서 그 자리에서 수정(관리자) ── #} {% for area in board.areas %} - + {% for row in area.rows %} {% if loop.first %} - {{ area.name }} - {% if is_admin %} - - - - - - - - {% endif %} + {# 구역 메뉴(색·위로·아래로·줄 추가·영역 삭제)는 우클릭 — project.js areaMenuItems #} + {{ area.name }} {% endif %} {# 항목 칸(2열) — 같은 항목 칸으로 묶인 줄(016 label_cont)은 묶음 첫 줄이 rowspan 으로 덮는다 #} {% if not row.label_cont %} 1 %} rowspan="{{ row.label_span }}"{% endif %} data-label-span="{{ row.label_span or 1 }}"> - {{ row.label }} - {# 줄 도구 — + = 이 줄 아래에 줄 추가, × = 줄 삭제(영역의 마지막 한 줄은 못 지움). 우클릭 메뉴로 위/아래 추가·삭제도 #} - {% if is_admin %} - - {% if area.rows | length > 1 and (row.label_span or 1) == 1 %} - - - {% endif %} - - {% if area.rows | length > 1 %} - - {% endif %} - - {% endif %} + {{ row.label }} {% endif %} {# 칸 배치는 router._goal_area_layout — 엑셀식 사각형 병합(colspan·rowspan), 가려진 칸은 없다 #} @@ -195,7 +174,7 @@ {% if is_admin %}
- 칸을 고치면 바로 저장됩니다. 숫자 칸을 비우면 지워집니다. 항목 칸을 우클릭하면 줄을 추가·삭제합니다. + 칸을 고치면 바로 저장됩니다. 숫자 칸을 비우면 지워집니다. 구역·항목 칸을 우클릭하면 색·순서·줄 추가·삭제 메뉴가 나옵니다. {%- if board.halves %} 칸을 마우스로 끌어 여러 칸을 고른 뒤 우클릭 → 셀 병합, 병합된 칸은 우클릭 → 병합 해제(글은 왼쪽 위 칸에 남음).{% endif %} 월 이름을 누르면 그 달 주간 회의록이 열립니다.
@@ -210,5 +189,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/help.html b/app/modules/project/templates/project/help.html index c1fa210..b0804dd 100644 --- a/app/modules/project/templates/project/help.html +++ b/app/modules/project/templates/project/help.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html index 310328f..65c9bf1 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 %} @@ -104,5 +104,5 @@ {% include "project/_side_modals.html" %} {% 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 90bcc1e..22468e5 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 %} @@ -100,5 +100,5 @@ "today": {{ today | tojson }} } - + {% endblock %} diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html index 6ee3132..7416d7b 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 %} - + @@ -496,5 +496,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/trash.html b/app/modules/project/templates/project/trash.html index ddc4782..3ee6018 100644 --- a/app/modules/project/templates/project/trash.html +++ b/app/modules/project/templates/project/trash.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -70,5 +70,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/static/project.css b/app/static/project.css index 6ceb76c..9e3a2c1 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -2082,24 +2082,7 @@ input.pj-goal-num:focus { outline: 2px solid var(--pj-accent); outline-offset: - .pj-goal-area > tr:first-child > * { border-top: 1px solid rgba(0, 0, 0, .12); } .pj-goal-area-name { font-size: 13px; font-weight: 800 !important; } .pj-goal-area-text, .pj-goal-row-text { display: block; word-break: keep-all; overflow-wrap: anywhere; } -/* 관리자 도구(✎ 색 ↑ ↓ + ×) — 이름 칸 아래에 떠 있는 작은 막대. 자리를 차지하지 않아야 - 이름이 세로 가운데에 온다. 칸 안에 붙어 있어 마우스를 막대로 옮겨도 사라지지 않는다. */ -.pj-goal-area-name:hover, .pj-goal-row-label:hover, .pj-goal-area-name:focus-within, .pj-goal-row-label:focus-within { z-index: 6; } -.pj-goal-tools { - position: absolute; top: calc(100% - 6px); left: 50%; transform: translateX(-50%); z-index: 7; - display: flex; flex-wrap: nowrap; gap: 1px; padding: 3px; background: #ffe3c7; border: 1px solid #f6c69a; - border-radius: 10px; box-shadow: 0 4px 12px rgba(16, 24, 40, .14); /* 파스텔 주황 */ - opacity: 0; pointer-events: none; transition: opacity .12s; -} -/* 커서 오른쪽에(initGoals placeTools 가 left/top 을 넣는다) — 가운데 맞춤 해제, 칸 밖으로 나가도 보이게 */ -.pj-goal-tools.is-at-cursor { transform: none; white-space: nowrap; } -/* 커서 → 막대(오른쪽 위) 사이 보이지 않는 작은 다리 — 막대 왼쪽 아래 모서리만(옆 칸으로 가는 가로 길은 막지 않게 좁게) */ -.pj-goal-tools.is-at-cursor::before { content: ""; position: absolute; left: -10px; top: 100%; width: 22px; height: 8px; } -.pj-goal-area-name:hover .pj-goal-tools, .pj-goal-row-label:hover .pj-goal-tools, -.pj-goal-tools:focus-within { opacity: 1; pointer-events: auto; } -.pj-goal-tools .pj-icon-btn { width: 30px; height: 30px; font-size: 20px; color: #8a4b14; border-radius: 7px; } -.pj-goal-tools .pj-icon-btn .material-symbols-outlined { font-size: 22px; } -.pj-goal-tools .pj-icon-btn:hover { background: #ffc98f; color: #5c2e06; } +/* 구역·항목 칸 메뉴(색·순서·줄 추가·삭제)는 우클릭(project.js areaMenuItems·rowMenuItems) — 마우스 오버 도구 막대는 2026-10-01 요청으로 뺐다 */ textarea.pj-goal-text { display: block; width: 100%; box-sizing: border-box; min-height: 46px; padding: 6px; border: none; background: transparent; font: inherit; line-height: 1.5; color: inherit; resize: none; overflow: hidden; diff --git a/app/static/project.js b/app/static/project.js index 3cff973..7974cf4 100644 --- a/app/static/project.js +++ b/app/static/project.js @@ -8326,7 +8326,7 @@ document.removeEventListener("mousedown", onColorDocDown, true); } function onColorDocDown(e) { if (colorPop && !colorPop.contains(e.target)) closeColorPop(); } - function openColorPop(anchor, areaId, current, tbody) { + function openColorPop(pt, areaId, current, tbody) { closeColorPop(); colorPop = document.createElement("div"); colorPop.className = "pj-goal-colorpop"; @@ -8338,10 +8338,9 @@ '" data-c="' + c + '" style="background:' + c + '">'; }).join(""); document.body.appendChild(colorPop); - const r = anchor.getBoundingClientRect(); - const w = colorPop.offsetWidth; - colorPop.style.left = Math.max(8, Math.min(r.left, document.documentElement.clientWidth - w - 8)) + "px"; - colorPop.style.top = (r.bottom + 6) + "px"; + const w = colorPop.offsetWidth, h = colorPop.offsetHeight; + colorPop.style.left = Math.max(8, Math.min(pt.x, document.documentElement.clientWidth - w - 8)) + "px"; + colorPop.style.top = Math.max(8, Math.min(pt.y + 6, document.documentElement.clientHeight - h - 8)) + "px"; colorPop.addEventListener("click", async function (e) { const sw = e.target.closest(".pj-goal-swatch, .pj-goal-swatch-none"); if (!sw) return; @@ -8350,13 +8349,13 @@ try { await api("PUT", "/project/api/goals/areas/" + areaId, { color: c || "none" }); tbody.style.setProperty("--goal-bg", c || "#fff"); - anchor.dataset.color = c; + tbody.dataset.color = c; } catch (err) { showToast("색 변경 실패: " + err.message, "error"); } }); setTimeout(function () { document.addEventListener("mousedown", onColorDocDown, true); }, 0); } - // ── 영역·줄 도구(색 ↑ ↓ + ×) — 이벤트 위임. 이름 바꾸기는 이름을 눌러 그 자리에서(아래 startNameEdit) ── + // ── 구역(1열) 작업 — 우클릭 메뉴(areaMenuItems)가 부른다. 이름 바꾸기는 이름을 눌러 그 자리에서(아래 startNameEdit) ── function textOf(node, sel) { const t = node && node.querySelector(sel); return t ? t.textContent.trim() : ""; @@ -8424,17 +8423,11 @@ } } } - table.addEventListener("click", async function (e) { - const b = e.target.closest("[data-goal-act]"); - if (!b) return; - const act = b.dataset.goalAct; - const tbody = b.closest(".pj-goal-area"); - const tr = b.closest("tr"); - const areaId = tbody && tbody.dataset.areaId; - const rowId = tr && tr.dataset.rowId; + async function goalAct(act, tbody, pt) { + const areaId = tbody.dataset.areaId; try { if (act === "area-color") { - openColorPop(b, areaId, b.dataset.color, tbody); + openColorPop(pt, areaId, tbody.dataset.color || "", tbody); return; } else if (act === "area-up" || act === "area-down") { await api("POST", "/project/api/goals/areas/" + areaId + "/move", { direction: act === "area-up" ? -1 : 1 }); @@ -8450,20 +8443,31 @@ const v = await prompt("새 줄 이름 (예: 쿠팡 — 비워 둬도 됩니다)", ""); if (v == null) return; await api("POST", "/project/api/goals/areas/" + areaId + "/rows", { label: String(v).trim() }); - } else if (act === "row-insert") { - if (!(await insertRow(labelGroupBottom(tr), "below"))) return; // 항목 칸 묶음 아래(묶음 밖) - } else if (act === "row-up" || act === "row-down") { - await api("POST", "/project/api/goals/rows/" + rowId + "/move", { direction: act === "row-up" ? -1 : 1 }); - } else if (act === "row-del") { - if (!(await deleteRow(tr))) return; - await refreshTable({ removed: [tr] }); - return; } else return; await refreshTable(); } catch (err) { showToast("처리 실패: " + err.message, "error"); } + } + // 1열(구역 칸) 우클릭 메뉴 — 예전 마우스 오버 도구 막대(색·↑·↓·+·×)를 옮겼다 + function areaMenuItems(tbody, pt) { + const areas = Array.from(table.querySelectorAll("tbody.pj-goal-area")); + const i = areas.indexOf(tbody); + const go = function (act) { return function () { goalAct(act, tbody, pt); }; }; + const items = [{ label: "색 바꾸기", icon: menuIcon("palette"), onClick: go("area-color") }]; + if (i > 0) items.push({ label: "위로", icon: menuIcon("arrow_upward"), onClick: go("area-up") }); + if (i < areas.length - 1) items.push({ label: "아래로", icon: menuIcon("arrow_downward"), onClick: go("area-down") }); + items.push({ label: "줄 추가(구역 맨 아래)", icon: menuIcon("add_row_below"), onClick: go("row-add") }); + items.push(null, { label: "영역 삭제", danger: true, icon: menuIcon("delete"), onClick: go("area-del") }); + return items; + } + table.addEventListener("contextmenu", function (e) { + const th = e.target.closest("th.pj-goal-area-name"); + if (!th || !table.contains(th) || e.target.closest(".is-editing")) return; + e.preventDefault(); + const pt = { x: e.clientX, y: e.clientY }; + showContextMenu(e.clientX, e.clientY, areaMenuItems(th.closest("tbody"), pt)); }); - // ── 줄(항목 칸) 추가·삭제 — 도구 막대의 +·× 와 항목 칸 우클릭 메뉴가 같이 쓴다. 한 일이 있으면 true. + // ── 줄(항목 칸) 추가·삭제 — 항목 칸·연간 칸 우클릭 메뉴가 쓴다. 한 일이 있으면 true. // sameLabel = 3열에서 추가 — 새 줄을 기준 줄과 같은 항목 칸(2열) 안에(이름을 묻지 않음, 016) async function insertRow(tr, place, sameLabel) { let label = ""; @@ -8507,6 +8511,17 @@ { label: "위에 줄 추가", icon: menuIcon("add_row_above"), onClick: run(function () { return insertRow(top, "above", opts.sameLabel); }) }, { label: "아래에 줄 추가", icon: menuIcon("add_row_below"), onClick: run(function () { return insertRow(bottom, "below", opts.sameLabel); }) }, ]; + if (opts.move) { // 2열 — 줄 순서(묶인 줄은 서버가 막으므로 묶음이 아닐 때만) + const rows = Array.from(opts.move.closest("tbody").rows), k = rows.indexOf(opts.move); + const mv = function (dir) { + return run(async function () { + await api("POST", "/project/api/goals/rows/" + opts.move.dataset.rowId + "/move", { direction: dir }); + return true; + }); + }; + if (k > 0) items.push({ label: "위로", icon: menuIcon("arrow_upward"), onClick: mv(-1) }); + if (k < rows.length - 1) items.push({ label: "아래로", icon: menuIcon("arrow_downward"), onClick: mv(1) }); + } if (opts.splitRow) { // 항목 칸 묶음 나누기 — 이어 붙은 줄들이 각자 항목 칸으로 items.push({ label: "항목 칸 나누기", icon: menuIcon("horizontal_split"), onClick: run(async function () { await api("POST", "/project/api/goals/rows/" + opts.splitRow.dataset.rowId + "/split-label"); @@ -8527,8 +8542,9 @@ e.preventDefault(); const tr = th.closest("tr"); // 2열 = 항목 칸 밖에 따로 추가(묶음의 맨 위·맨 아래 기준), 묶인 칸이면 "항목 칸 나누기"도 + const grouped = (th.rowSpan || 1) > 1; showContextMenu(e.clientX, e.clientY, rowMenuItems(tr, labelGroupBottom(tr), true, - { splitRow: (th.rowSpan || 1) > 1 ? tr : null })); + { splitRow: grouped ? tr : null, move: grouped ? null : tr })); }); // 3열(연간 칸) 우클릭에도 줄 추가·삭제 — 추가한 줄은 같은 항목 칸(2열) 안에 들어간다(sameLabel, 016). // 병합 메뉴가 있으면(014) 그 메뉴에 붙이고, 없으면 여기서 @@ -8547,38 +8563,6 @@ }); } - // ── 영역·줄 도구 막대(색 ↑ ↓ + ×) — 마우스 커서 **오른쪽 위**에. - // 커서 바로 오른쪽(같은 높이)에 두면 옆 칸으로 가로질러 갈 때 막대에 걸려 옆 칸 막대가 안 뜨고 막대가 "고정"돼 버린다 - // (2026-10-01 버그). 오른쪽 위에 두면 가로로는 막대 밑으로 지나가 옆 칸으로 넘어가고, 막대를 누를 땐 오른쪽 위로 간다. - // 막대는 커서가 막대에서 멀어질 때(왼쪽·아래)만 따라오고, 막대 쪽(오른쪽·위)으로 갈 땐 그 자리에 있어 도망가지 않는다. - // 커서가 막대보다 훨씬 위로 가면 다시 커서 높이로. 막대 시작점은 이름 칸 안(오른쪽 끝 − 10px 까지). - // 막대는 이름 칸 안 요소라 막대 위에서도 칸 호버가 이어진다. 화면 배율(uiZoom) 안이라 거리는 배율로 나눈다. - const TOOL_HOSTS = "th.pj-goal-area-name, th.pj-goal-row-label"; - let toolAnchor = null; // {th, x, y} — 막대 기준점(커서 자리, 뷰포트 좌표) - function placeTools(th, e) { - const tools = th.querySelector(".pj-goal-tools"); - if (!tools || (e.target && e.target.closest && e.target.closest(".pj-goal-tools"))) return; - const r = th.getBoundingClientRect(), z = uiZoom(), h = tools.offsetHeight * z; - if (!toolAnchor || toolAnchor.th !== th) toolAnchor = { th: th, x: e.clientX, y: e.clientY }; - else { - toolAnchor.x = Math.min(toolAnchor.x, e.clientX); // 왼쪽으로는 따라감 - if (e.clientY > toolAnchor.y || e.clientY < toolAnchor.y - h - 16) toolAnchor.y = e.clientY; // 아래로·훨씬 위로는 따라감 - } - tools.classList.add("is-at-cursor"); - tools.style.left = Math.round(Math.min((toolAnchor.x - r.left) / z + 8, r.width / z - 10)) + "px"; - tools.style.top = Math.round((toolAnchor.y - r.top) / z - tools.offsetHeight - 4) + "px"; - } - table.addEventListener("mouseover", function (e) { - const th = e.target.closest(TOOL_HOSTS); - if (!th || (e.relatedTarget && th.contains(e.relatedTarget))) return; // 칸에 막 들어왔을 때 — 기준점 새로 - toolAnchor = null; - placeTools(th, e); - }); - table.addEventListener("mousemove", function (e) { - const th = e.target.closest(TOOL_HOSTS); - if (th) placeTools(th, e); - }); - // ── 영역·줄 이름 — 눌러서 그 자리에서 수정(Enter·칸 떠남 = 저장, Esc = 취소). 서식 없이 글자만. ── function startNameEdit(span) { if (span.isContentEditable) return; diff --git a/docs/PROJECT_MODULE.md b/docs/PROJECT_MODULE.md index 40c910e..da93cf3 100644 --- a/docs/PROJECT_MODULE.md +++ b/docs/PROJECT_MODULE.md @@ -535,12 +535,11 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중 `offsetParent` 없으면 건너뜀) 펼친 뒤 다시 잰다. `prefers-reduced-motion` 이면 애니메이션 없이. - **영역·줄 이름 바로 수정**(관리자) — 이름(`[data-goal-edit="area|row"]`)을 누르면 contenteditable(`startNameEdit`) — Enter·칸 떠남 = 저장, Esc = 취소, 붙여넣기는 글자만. 영역 이름 빈 값은 되돌림(서버도 400), 줄 이름은 빈 값 허용(빈 줄 이름은 - 마우스를 올리면 "줄 이름" 자리 표시). 예전 ✎(prompt) 버튼은 없앴고 도구 막대는 색·↑·↓·+·× 만. -- **도구 막대 위치**(2026-10-01) — 영역·줄 이름 칸에 마우스를 올리면 막대가 **커서 오른쪽 위**에 나타난다(`placeTools`, - `.is-at-cursor`). 커서와 같은 높이 오른쪽에 두면 옆 칸으로 가로질러 갈 때 막대에 걸려 옆 칸 막대가 안 뜨고 막대가 "고정"되는 - 버그가 있어 위로 올렸다 — 가로로는 막대 밑으로 지나가고, 막대는 오른쪽 위로 가서 누른다. 막대는 커서가 막대에서 멀어질 때(왼쪽· - 아래)만 따라오고 막대 쪽으로 갈 땐 그대로(도망가지 않음), 시작점은 이름 칸 안(오른쪽 끝 − 10px 까지), 막대 왼쪽 아래에 작은 - 보이지 않는 다리(::before)로 커서 → 막대 사이 호버가 이어진다. + 마우스를 올리면 "줄 이름" 자리 표시). 예전 ✎(prompt) 버튼은 없앴다. 색·순서·줄 추가·삭제는 우클릭 메뉴(아래). +- **구역·항목 칸 메뉴 = 우클릭**(2026-10-01) — 마우스 오버 도구 막대(색·↑·↓·+·×)는 뺐다(옆 칸으로 갈 때 걸리거나 고정되는 문제). + 1열(구역 칸) 우클릭(`areaMenuItems` → `goalAct`): 색 바꾸기(색 창은 우클릭한 자리, 현재 색은 `tbody[data-color]`) · 위로 · 아래로 + (맨 위·맨 아래면 없음) · 줄 추가(구역 맨 아래) · 영역 삭제. 2열(항목 칸) 우클릭(`rowMenuItems`): 위/아래에 줄 추가 · **위로 · 아래로** + (묶이지 않은 칸만) · 항목 칸 나누기(묶인 칸) · 줄 삭제. 이름은 눌러서 바로 수정(그대로). - **줄 추가·삭제(항목 칸)**(관리자) — 줄 이름 칸 도구 막대: ↑·↓(줄 2개 이상)·**+ = 이 줄 아래에 줄 추가**·×(줄 2개 이상). 항목 칸 **우클릭 메뉴**: 위에 줄 추가 / 아래에 줄 추가 / 줄 삭제(영역의 마지막 한 줄이면 없음). 추가는 이름을 묻고(비워도 됨) `db.add_goal_row(ref_row_id, place)` 가 영역 줄 순서를 다시 매긴다(영역 FOR UPDATE). 영역 이름 칸의 + 는 예전처럼 맨 끝에 추가. - **칸 병합 — 엑셀식**(관리자, 014 + 015, 2026-10-01에 예전 Shift+클릭·떠 있는 병합 버튼·오른쪽/왼쪽 칸과 병합 메뉴를 대체) — `goal_cell_merges(row_id, start_month, span, row_span)`. 시작 칸 = **왼쪽 위**(row_id = 맨 위 줄, start_month = 왼쪽 칸 번호).