diff --git a/app/modules/project/db.py b/app/modules/project/db.py index 2c3d0b0..f63a090 100644 --- a/app/modules/project/db.py +++ b/app/modules/project/db.py @@ -2553,7 +2553,7 @@ class ProjectStore: params.append(v) if "attendees" in fields: sets.append("attendees = %s") - params.append(store.validate_meeting_text(fields["attendees"], limit=500, what="참석자")) + params.append(store.validate_meeting_text(fields["attendees"], limit=3000, what="참석자")) if "notes" in fields: sets.append("notes = %s") params.append(store.validate_meeting_text(fields["notes"], what="메모")) diff --git a/app/modules/project/router.py b/app/modules/project/router.py index 0eab22c..83b2dcf 100644 --- a/app/modules/project/router.py +++ b/app/modules/project/router.py @@ -2945,6 +2945,35 @@ def _meeting_view(request: Request, st: Any, *, year: int, month: int, week: dat return {"meeting": meeting, "head": head, "markets": [{"code": m["code"], "name": m["name"]} for m in markets]} +def _meet_members() -> list[dict[str, str]]: + """회의 참석자 후보 = 전체 멤버(project 모듈 권한 보유 등록 사용자) — 이름·이메일·사진.""" + try: + from app.main import user_store # noqa: WPS433 + from app.store import has_module # noqa: WPS433 + + out = [{"email": u["email"], "name": u.get("name") or u["email"].split("@")[0], "avatar": u.get("picture") or ""} + for u in user_store.list_all() if has_module(u, "project")] + except Exception: # noqa: BLE001 — 사용자 목록이 없어도 회의록은 열린다 + logger.warning("meeting members unavailable", exc_info=True) + return [] + return sorted(out, key=lambda m: m["name"]) + + +def _parse_attendees(text: str, members: list[dict[str, str]]) -> list[dict[str, str]]: + """참석자 칸(쉼표로 이은 이메일 — 예전엔 자유 입력 글자) → 칩 목록. 멤버 이메일이면 이름·사진, 아니면 글자 그대로.""" + by_email = {m["email"].lower(): m for m in members} + out, seen = [], set() + for tok in str(text or "").replace("\n", ",").split(","): + t = tok.strip() + if not t or t.lower() in seen: + continue + seen.add(t.lower()) + m = by_email.get(t.lower()) + out.append({"key": m["email"] if m else t, "email": m["email"] if m else "", "name": m["name"] if m else t, + "avatar": m["avatar"] if m else ""}) + return out + + @router.get("/goals/{year}/meetings/{month}", response_class=HTMLResponse) def goal_meeting_page(request: Request, year: int, month: int, week: str | None = None) -> HTMLResponse: """주간 회의록 — 그 달과 겹치는 주(월~일) 탭, 주마다 회의록 하나. 입력은 관리자만(목표 표와 같음).""" @@ -2975,6 +3004,7 @@ def goal_meeting_page(request: Request, year: int, month: int, week: str | None cal = store.calendar_weeks(year, month) existing = set(st.meeting_weeks(start=cal[0][0], end=cal[-1][0])) if enabled else set() view = _meeting_view(request, st, year=year, month=month, week=sel) if enabled else {} + members = _meet_members() admin = is_admin(user) return render_template( request, @@ -3025,6 +3055,8 @@ def goal_meeting_page(request: Request, year: int, month: int, week: str | None "sync_from": (sel - timedelta(days=7)).isoformat() if sel - timedelta(days=7) <= today else "", "sync_to": min(sel + timedelta(days=6), today).isoformat(), "meeting_status": store.MEETING_STATUS, + "meet_members": members, + "attendee_list": _parse_attendees((view.get("meeting") or {}).get("attendees", ""), members), **view, }, ) diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index b54782d..0c90fe8 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 %} @@ -143,10 +143,17 @@ {% if not h.perf %}

실적 모듈이 연결되지 않아 실적·누적·쇼핑몰 자동 결과는 비어 있습니다(결과는 직접 입력).

{% endif %} - + {# 참석자 — 전체 멤버에서 고른다(칩, [참석자] = 고르기 창). 저장은 이메일을 쉼표로 이어서, 예전 자유 입력 글자도 칩으로 #} +
+ 참석자 +
+ {% for a in attendee_list %} + {%- if a.avatar %}{% else %}{{ a.name[:1] }}{% endif %}{{ a.name }} + {%- if edit %}{% endif %}{% endfor %} + {% if edit %} + {% elif not attendee_list %}—{% endif %} +
+
{# ── 구역별 줄 — 왼쪽: 이번주 / 오른쪽: 전주 리뷰(지난 회의록 같은 줄) ── #} @@ -245,8 +252,9 @@ {% if markets %}{% endif %} + {% 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 039f464..f12bd3b 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 %} @@ -189,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 71bd2fc..062be4c 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 6179944..cd9bc57 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 e08288f..216b65b 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 793535d..c70d5b4 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 fa86a57..77d4862 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 690ce41..48580e4 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -2272,8 +2272,43 @@ html.pj-goal-selecting, html.pj-goal-selecting * { user-select: none !important; } @media (max-width: 1100px) { .pj-meet-kpis, .pj-meet-kpis.is-week { grid-template-columns: repeat(2, minmax(0, 1fr)); } } -.pj-meet-attend { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12.5px; font-weight: 600; color: var(--pj-ink-soft); } -.pj-meet-attend input { flex: 0 1 420px; height: 30px; padding: 0 8px; border: 1px solid var(--pj-border); border-radius: 7px; font: inherit; color: var(--pj-ink); font-weight: 500; } +/* 참석자 — 멤버 칩 + [참석자] 고르기 창(body 에 붙음) */ +.pj-meet-attend { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 10px; font-size: 12.5px; } +.pj-meet-attend-label { font-weight: 600; color: var(--pj-ink-soft); line-height: 30px; flex: none; } +.pj-meet-attend-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 30px; padding: 2px; border-radius: 8px; } +.pj-meet-chip { + display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 4px 0 3px; border: 1px solid var(--pj-border); + border-radius: 999px; background: #fff; color: var(--pj-ink); font-weight: 600; +} +.pj-meet-chip .pj-avatar { width: 22px; height: 22px; } +.pj-meet-chip-ini { + display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; + background: var(--pj-accent-tint); color: var(--pj-accent-dark); font-size: 11px; font-weight: 800; flex: none; +} +.pj-meet-chip-x { width: 20px; height: 20px; border: none; border-radius: 50%; background: transparent; color: var(--pj-ink-soft); cursor: pointer; line-height: 1; } +.pj-meet-chip-x:hover { background: #fde8e8; color: #c22b10; } +.pj-meet-attend-add { + display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px 0 8px; border: 1px dashed #c2c6cc; + border-radius: 999px; background: transparent; color: var(--pj-ink-soft); font-size: 12.5px; font-weight: 600; cursor: pointer; +} +.pj-meet-attend-add .material-symbols-outlined { font-size: 17px; } +.pj-meet-attend-add:hover { border-color: var(--pj-accent); color: var(--pj-accent-dark); background: var(--pj-accent-tint); } +.pj-meet-attend-chips.is-saved { animation: pj-goal-saved 1s ease-out; } +.pj-meet-pick { + position: fixed; z-index: 1000; width: 280px; max-height: 360px; display: flex; flex-direction: column; gap: 6px; padding: 10px; + background: #fff; border: 1px solid var(--pj-border); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .18); +} +.pj-meet-pick-q { height: 32px; padding: 0 10px; border: 1px solid var(--pj-border); border-radius: 8px; font: inherit; font-size: 13px; } +.pj-meet-pick-acts { display: flex; gap: 6px; } +.pj-meet-pick-acts button { flex: 1; height: 26px; border: 1px solid var(--pj-border); border-radius: 7px; background: #fafafb; font-size: 12px; cursor: pointer; } +.pj-meet-pick-acts button:hover { background: var(--pj-accent-tint); border-color: #cfc6fb; } +.pj-meet-pick-list { overflow: auto; min-height: 0; } +.pj-meet-pick-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 8px; cursor: pointer; font-size: 13px; } +.pj-meet-pick-row:hover { background: #f4f5f7; } +.pj-meet-pick-row .pj-avatar { width: 24px; height: 24px; } +.pj-meet-pick-name { font-weight: 600; } +.pj-meet-pick-id { margin-left: auto; color: var(--pj-ink-soft); font-size: 11.5px; } +.pj-meet-pick-empty { margin: 10px 4px; color: var(--pj-ink-soft); font-size: 12.5px; } .pj-meet-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12.5px; diff --git a/app/static/project.js b/app/static/project.js index 7974cf4..55183c4 100644 --- a/app/static/project.js +++ b/app/static/project.js @@ -8972,11 +8972,106 @@ } catch (e) { tgt.value = tgt.dataset.saved; showToast("저장 실패: " + e.message, "error"); } }); } - const att = el("pj-meet-attendees"); - if (att) att.addEventListener("change", async function () { - try { await api("PUT", meetingUrl, { attendees: att.value }); flashSaved(att); } - catch (e) { showToast("저장 실패: " + e.message, "error"); } - }); + // ── 참석자 — 전체 멤버에서 고르기(칩 + 고르기 창, 창은 body 에). 바뀔 때마다 이메일(예전 글자는 그대로)을 쉼표로 이어 저장 ── + const attBox = el("pj-meet-attend"); + if (attBox && attBox.dataset.edit) { + const members = window.PJ_MEET_MEMBERS || []; + let picked = Array.from(attBox.querySelectorAll(".pj-meet-chip")).map(function (c) { + return { key: c.dataset.key, name: c.dataset.name, avatar: c.dataset.avatar || "" }; + }); + const addBtn = el("pj-meet-attend-add"); + const chipHtml = function (a) { + return '' + + (a.avatar ? '' + : '' + escapeHtml((a.name || "?").slice(0, 1)) + "") + + "" + escapeHtml(a.name) + ''; + }; + const paint = function () { + attBox.querySelectorAll(".pj-meet-chip").forEach(function (c) { c.remove(); }); + addBtn.insertAdjacentHTML("beforebegin", picked.map(chipHtml).join("")); + }; + const saveAtt = async function () { + try { + await api("PUT", meetingUrl, { attendees: picked.map(function (a) { return a.key; }).join(", ") }); + flashSaved(attBox); + } catch (e) { showToast("참석자 저장 실패: " + e.message, "error"); } + }; + const has = function (email) { return picked.some(function (a) { return a.key.toLowerCase() === email.toLowerCase(); }); }; + const toggle = function (m, on) { + if (on && !has(m.email)) picked.push({ key: m.email, name: m.name, avatar: m.avatar }); + if (!on) picked = picked.filter(function (a) { return a.key.toLowerCase() !== m.email.toLowerCase(); }); + }; + attBox.addEventListener("click", function (e) { + const x = e.target.closest(".pj-meet-chip-x"); + if (!x) return; + const key = x.closest(".pj-meet-chip").dataset.key; + picked = picked.filter(function (a) { return a.key !== key; }); + paint(); + saveAtt(); + }); + let pop = null; + const closePop = function () { + if (!pop) return; + pop.remove(); + pop = null; + document.removeEventListener("mousedown", onDoc, true); + document.removeEventListener("keydown", onKey, true); + }; + const onDoc = function (e) { if (pop && !pop.contains(e.target) && e.target !== addBtn && !addBtn.contains(e.target)) closePop(); }; + const onKey = function (e) { if (e.key === "Escape") closePop(); }; + const drawList = function (q) { + const ul = pop.querySelector(".pj-meet-pick-list"); + const qq = (q || "").trim().toLowerCase(); + const rows = members.filter(function (m) { + return !qq || m.name.toLowerCase().includes(qq) || m.email.toLowerCase().includes(qq); + }); + ul.innerHTML = rows.length ? rows.map(function (m) { + return '"; + }).join("") : '

' + (members.length ? "찾는 멤버가 없습니다" : "멤버 목록이 없습니다") + "

"; + }; + addBtn.addEventListener("click", function () { + if (pop) { closePop(); return; } + pop = document.createElement("div"); + pop.className = "pj-meet-pick"; + pop.innerHTML = '' + + '
' + + '
'; + document.body.appendChild(pop); + const r = addBtn.getBoundingClientRect(); + pop.style.left = Math.max(8, Math.min(r.left, document.documentElement.clientWidth - pop.offsetWidth - 8)) + "px"; + pop.style.top = Math.min(r.bottom + 6, document.documentElement.clientHeight - pop.offsetHeight - 8) + "px"; + const q = pop.querySelector(".pj-meet-pick-q"); + drawList(""); + q.focus(); + q.addEventListener("input", function () { drawList(q.value); }); + pop.addEventListener("change", function (e) { + const cb = e.target.closest("input[type=checkbox]"); + if (!cb) return; + const m = members.find(function (x) { return x.email === cb.dataset.email; }); + if (!m) return; + toggle(m, cb.checked); + paint(); + saveAtt(); + }); + pop.addEventListener("click", function (e) { + const b = e.target.closest("[data-all]"); + if (!b) return; + members.forEach(function (m) { toggle(m, b.dataset.all === "1"); }); + drawList(q.value); + paint(); + saveAtt(); + }); + setTimeout(function () { + document.addEventListener("mousedown", onDoc, true); + document.addEventListener("keydown", onKey, true); + }, 0); + }); + } // ── 글 칸(이번주 할 일·메모) — 멈추면 저장 ── const pending = new Map(); // textarea → {timer, save} diff --git a/docs/PROJECT_MODULE.md b/docs/PROJECT_MODULE.md index 73b93b3..9498c76 100644 --- a/docs/PROJECT_MODULE.md +++ b/docs/PROJECT_MODULE.md @@ -625,7 +625,10 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중 "실적 미사용" 표시 + 직접 입력. 자동 결과 말풍선 = 쇼핑몰·기간, 0 이면 "그 기간 실적 없음 — [매출 업데이트]" 안내. 쇼핑몰 연결 줄은 목표 금액 아래에 **이번주 실적**(이 주 월요일~오늘, 목표 대비 %)도 보인다. - **매출 자료 갱신**(`initMeetingSync`, **화면 표시 없음** — 2026-10-01 상태 줄·[매출 갱신] 버튼은 요청으로 뺐고 `#pj-meet-sync` 는 기간만 가진 숨은 요소): 주차를 열면 실적 모듈 `POST /performance/api/sync {from: 지난주 월요일, to: 이번 주 일요일·오늘 중 이른 날, background: true}` 로 쇼핑몰에서 매출을 한 번 더 받고(진행 n/m 쇼핑몰·받은 자료), 끝나면 이 화면을 서버에서 다시 받아 **숫자 칸만** 바꿔 끼운다(머리 카드·자동 결과·달성률·이번주 실적 — 입력 중인 칸·직접 입력 결과 칸·저장 안 된 글은 그대로). 같은 주는 브라우저별 10분에 한 번만 자동(sessionStorage `pj_meet_sync:{월요일}` — 줄 추가 등으로 새로고침해도 다시 부르지 않음), [매출 갱신] 버튼은 언제나. 이미 다른 매출 업데이트가 돌면 그 작업이 끝나길 기다린다. 실적 권한이 없으면 저장된 실적으로 보여 준다는 안내, 실패한 쇼핑몰은 이름·상태. 지난주가 아직 오지 않은 주(미래)는 갱신 줄이 없다. - - 참석자 · **결정 사항·메모**. 인쇄 버튼(인쇄용 CSS — 사이드바·탭·도구 숨김). + - **참석자 = 전체 멤버에서 고르기**(2026-10-01): 칩(사진·이름, × = 빼기) + [참석자] 고르기 창(찾기·전원 선택·모두 해제·체크) — + 후보는 `project` 모듈 권한 보유 등록 사용자(`router._meet_members`, 좌측 전체 멤버와 같음). 저장은 이메일을 쉼표로 이어 그대로 + `goal_meetings.attendees`(최대 3000자), 예전 자유 입력 글자는 칩으로 남는다(`_parse_attendees`). 바뀔 때마다 바로 저장. + - **결정 사항·메모**. 인쇄 버튼(인쇄용 CSS — 사이드바·탭·도구 숨김). - 데이터: `goal_meetings(week_start 월요일 PK, week_target 원, attendees, notes)` · `goal_meeting_items(week_start FK CASCADE, section, section_color, label, content, target_amount, result_amount, status '', done, partial, miss, marketplace_code, carry_from FK SET NULL, sort_order)`. 금액은 **원 정수** — 입력은 `1,200,000`·`120만`·`1.5억`·`3천만`·`1억2천만` 다 된다(`store.validate_meeting_amount`).