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:
2026-10-12 13:29:53 +09:00
parent ae6b6ec603
commit ee09e8bfd1
17 changed files with 185 additions and 18 deletions
+23
View File
@@ -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:
+16
View File
@@ -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 %}