feat(project): move whole meeting sections up/down from the 구분 column
- 구분 cell: right-click or ⋯ menu → 구역 위로 / 구역 아래로 / 구역 끝에 줄 추가
- POST /api/goals/meeting-items/{id}/move-section swaps the contiguous section block
with its neighbour under the meeting lock (row order and merges follow; 409 after completion)
- Next meetings inherit the new order; help + docs; tests (DB-less, real PostgreSQL, jsdom)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3320,6 +3320,29 @@ class ProjectStore:
|
||||
for n, x in enumerate(ids):
|
||||
conn.execute("UPDATE goal_meeting_items SET sort_order = %s WHERE id = %s", (n, x))
|
||||
|
||||
def move_meeting_section(self, *, item_id: int, direction: int) -> None:
|
||||
"""구역(표 첫 열 "구분") 통째로 한 칸 위/아래 — item_id 가 든 구역 묶음(이어진 같은 구역 줄)과 옆 구역 묶음의
|
||||
자리를 바꾼다. 묶음 안 줄 순서·세로 병합(content_row_span)은 그대로 따라간다. 맨 위/맨 아래면 그대로."""
|
||||
with self._pool.connection() as conn:
|
||||
with conn.transaction():
|
||||
self._require_meetings(conn)
|
||||
rows = self._locked_meeting_items(conn, item_id)
|
||||
ids = [int(r["id"]) for r in rows]
|
||||
blocks: list[list[int]] = [] # 이어진 같은 구역 줄 묶음(화면의 tbody 하나)
|
||||
for i, r in enumerate(rows):
|
||||
if i and r["section"] == rows[i - 1]["section"]:
|
||||
blocks[-1].append(ids[i])
|
||||
else:
|
||||
blocks.append([ids[i]])
|
||||
b = next(n for n, blk in enumerate(blocks) if item_id in blk)
|
||||
j = b + (1 if direction > 0 else -1)
|
||||
if not 0 <= j < len(blocks):
|
||||
return
|
||||
blocks[b], blocks[j] = blocks[j], blocks[b]
|
||||
order = [x for blk in blocks for x in blk]
|
||||
for n, x in enumerate(order):
|
||||
conn.execute("UPDATE goal_meeting_items SET sort_order = %s WHERE id = %s", (n, x))
|
||||
|
||||
def goal_month_targets(self, *, year: int, month: int) -> dict[str, Any]:
|
||||
"""회의록 머리 — 그 달 매출 목표·실적, 로아스 목표(목표 표 숫자), 매출 단위. 목표 표가 없으면 빈 값."""
|
||||
with self._pool.connection() as conn:
|
||||
|
||||
@@ -3737,3 +3737,19 @@ def api_move_meeting_item(request: Request, item_id: int, payload: dict[str, Any
|
||||
st = _db_or_503(request)
|
||||
_goal_call(st.move_meeting_item, item_id=item_id, direction=int(payload.get("direction") or 0))
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
|
||||
@router.post("/api/goals/meeting-items/{item_id}/move-section")
|
||||
def api_move_meeting_section(request: Request, item_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""구역(첫 열 "구분") 통째로 위/아래 {direction: -1|1} — item_id = 그 구역의 아무 줄. 줄 순서와 같은 권한(누구나,
|
||||
회의 완료 전까지). 다음 회의록은 이 순서를 이어받는다."""
|
||||
_require_user(request)
|
||||
st = _db_or_503(request)
|
||||
try:
|
||||
direction = int(payload.get("direction") or 0)
|
||||
except (TypeError, ValueError):
|
||||
raise HTTPException(status_code=400, detail="direction 이 올바르지 않습니다.")
|
||||
if direction not in (-1, 1):
|
||||
raise HTTPException(status_code=400, detail="direction 은 -1(위) 또는 1(아래)입니다.")
|
||||
_goal_call(st.move_meeting_section, item_id=item_id, direction=direction)
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -227,7 +227,8 @@
|
||||
<tr data-item="{{ it.id }}" data-section="{{ sec.name }}" data-market="{{ it.marketplace_code }}" data-target-amount="{{ it.target_amount if it.target_amount is not none else '' }}"{% if p %} data-prev="{{ p.id }}" data-prev-target="{{ p.target_amount if p.target_amount is not none else '' }}"{% endif %}>
|
||||
{% if loop.first %}
|
||||
<th class="pj-meet-c-sec" rowspan="{{ sec.rows | length }}">{{ sec.name }}
|
||||
{% if edit %}<button type="button" class="pj-meet-sec-add" data-meet-act="sec-add" title="{{ sec.name }} 구역 끝에 줄 추가">+</button>{% endif %}
|
||||
{% if edit %}<button type="button" class="pj-icon-btn pj-meet-more pj-meet-sec-more" data-meet-act="sec-menu" title="구역 메뉴(위로·아래로) · 우클릭도 됩니다"><span class="material-symbols-outlined">more_horiz</span></button>
|
||||
<button type="button" class="pj-meet-sec-add" data-meet-act="sec-add" title="{{ sec.name }} 구역 끝에 줄 추가">+</button>{% endif %}
|
||||
</th>
|
||||
{% endif %}
|
||||
<th class="pj-meet-c-label">
|
||||
@@ -291,5 +292,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261007a" defer></script>
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -207,5 +207,5 @@
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20261003a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
@@ -697,6 +697,7 @@
|
||||
<ul>
|
||||
<li>구역 이름 옆 <span class="pjh-ui">+</span>는 그 구역 끝에 줄을 추가합니다. 표 아래 <span class="pjh-ui">+ 구역 추가</span>로 새 구역을 만듭니다.</li>
|
||||
<li>항목 이름을 클릭하면 그 자리에서 고칩니다. 우클릭 또는 ⋯ 메뉴에서 <span class="pjh-ui">위에 줄 추가 · 아래에 줄 추가 · 위로 · 아래로 · 줄 삭제</span>를 사용합니다. 순서 이동은 같은 구역 안에서 합니다.</li>
|
||||
<li><b>구역 순서</b> — 첫 열 <b>구분</b> 칸을 우클릭하거나 마우스를 올려 나오는 <span class="pjh-ui">⋯</span>를 누르면 <span class="pjh-ui">구역 위로 · 구역 아래로 · 구역 끝에 줄 추가</span>가 나옵니다. 구역 안의 줄 순서·병합은 그대로 함께 옮겨지고, 다음에 만드는 회의록도 바뀐 순서를 이어받습니다(회의 완료 전까지, 누구나).</li>
|
||||
<li>줄을 삭제하면 주요 업무·정량 목표도 함께 삭제됩니다. 새 줄은 지난주에 이어진 항목이 없으면 지난주 리뷰가 비어 있습니다.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -101,5 +101,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,5 +108,5 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -488,5 +488,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -2811,6 +2811,8 @@ th.pj-meet-c-label { position: relative; font-weight: 600; color: #3b4048; text-
|
||||
.pj-meet-more { position: absolute; top: 3px; right: 2px; width: 24px; height: 24px; opacity: 0; transition: opacity .12s; }
|
||||
.pj-meet-more .material-symbols-outlined { font-size: 18px; }
|
||||
th.pj-meet-c-label:hover .pj-meet-more, .pj-meet-more:focus { opacity: 1; }
|
||||
/* 구분(구역) 칸 ⋮ — 구역 위로·아래로(줄 메뉴와 같은 모양) */
|
||||
th.pj-meet-c-sec:hover .pj-meet-sec-more { opacity: 1; }
|
||||
textarea.pj-meet-text, textarea.pj-meet-rnote, .pj-meet-notes textarea {
|
||||
display: block; width: 100%; box-sizing: border-box; min-height: 38px; padding: 6px; border: none; background: transparent;
|
||||
font: inherit; line-height: var(--pj-text-leading); color: inherit; resize: none; overflow: hidden;
|
||||
|
||||
+31
-1
@@ -11197,6 +11197,26 @@
|
||||
} },
|
||||
].concat(cellGrid ? [null].concat(cellGrid.widthItems(tr.querySelector("th.pj-meet-c-label"))) : []));
|
||||
}
|
||||
// ── 구역 메뉴(구분 칸 ⋯ · 우클릭) — 구역을 통째로 위/아래(그 안의 줄 순서·병합은 그대로), 구역 끝에 줄 추가 ──
|
||||
function secMenu(x, y, tbody) {
|
||||
const blocks = Array.prototype.slice.call(table.querySelectorAll("tbody.pj-meet-sec"));
|
||||
const i = blocks.indexOf(tbody);
|
||||
const first = tbody.querySelector("tr[data-item]");
|
||||
if (!first) return;
|
||||
const mv = function (dir) {
|
||||
return function () {
|
||||
run(async function () { await api("POST", itemUrl(first.dataset.item) + "/move-section", { direction: dir }); return true; });
|
||||
};
|
||||
};
|
||||
const items = [];
|
||||
if (i > 0) items.push({ label: "구역 위로", icon: menuIcon("arrow_upward"), onClick: mv(-1) });
|
||||
if (i < blocks.length - 1) items.push({ label: "구역 아래로", icon: menuIcon("arrow_downward"), onClick: mv(1) });
|
||||
if (items.length) items.push(null);
|
||||
items.push({ label: "구역 끝에 줄 추가", icon: menuIcon("add_row_below"), onClick: function () {
|
||||
run(function () { return addRow(tbody.dataset.section, null, "below"); });
|
||||
} });
|
||||
showContextMenu(x, y, items);
|
||||
}
|
||||
table.addEventListener("click", function (e) {
|
||||
const b = e.target.closest("[data-meet-act]");
|
||||
if (!b) return;
|
||||
@@ -11204,13 +11224,23 @@
|
||||
if (b.dataset.meetAct === "menu") {
|
||||
const r = b.getBoundingClientRect();
|
||||
rowMenu(r.left, r.bottom + 4, tr);
|
||||
} else if (b.dataset.meetAct === "sec-menu") {
|
||||
const r = b.getBoundingClientRect();
|
||||
secMenu(r.left, r.bottom + 4, b.closest("tbody"));
|
||||
} else if (b.dataset.meetAct === "sec-add") {
|
||||
run(function () { return addRow(b.closest("tbody").dataset.section, null, "below"); });
|
||||
}
|
||||
});
|
||||
table.addEventListener("contextmenu", function (e) {
|
||||
if (e.target.closest(".is-editing")) return;
|
||||
const sec = e.target.closest("tbody.pj-meet-sec th.pj-meet-c-sec");
|
||||
if (sec && canEdit) {
|
||||
e.preventDefault();
|
||||
secMenu(e.clientX, e.clientY, sec.closest("tbody"));
|
||||
return;
|
||||
}
|
||||
const th = e.target.closest("th.pj-meet-c-label");
|
||||
if (!th || e.target.closest(".is-editing")) return;
|
||||
if (!th) return;
|
||||
e.preventDefault();
|
||||
rowMenu(e.clientX, e.clientY, th.closest("tr"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user