diff --git a/app/modules/project/router.py b/app/modules/project/router.py index bbdf504..b1ddd41 100644 --- a/app/modules/project/router.py +++ b/app/modules/project/router.py @@ -1174,9 +1174,10 @@ def api_list_members(request: Request, project_id: int) -> JSONResponse: def api_add_member( request: Request, project_id: int, payload: dict[str, Any] = Body(...) ) -> JSONResponse: - """사용자를 프로젝트에 배정 — 관리자 전용.""" - _require_admin(request) + """사용자를 프로젝트에 배정 — 관리자 전용(그 프로젝트를 볼 수 있는 관리자).""" + user = _require_admin(request) st = _db_or_503(request) + _require_manage(request, st, user, project_id) try: member = st.add_member( project_id=project_id, @@ -1193,8 +1194,9 @@ def api_add_member( def api_remove_member( request: Request, project_id: int, user_email: str ) -> JSONResponse: - _require_admin(request) + user = _require_admin(request) st = _db_or_503(request) + _require_manage(request, st, user, project_id) st.remove_member(project_id=project_id, user_email=user_email) return JSONResponse({"ok": True}) @@ -3065,7 +3067,7 @@ def _meeting_view(request: Request, st: Any, *, year: int, month: int, week: dat fresh = perf.freshness() head = { "sales_unit": targets["sales_unit"], "sales_target": targets["sales_target"], - "month_target_won": month_target_won, + "month_target_won": month_target_won, "unit_mult": mult, # 머리 숫자를 목표 표 매출 단위(예: 백만원)로 보여 줄 배수 "week_targets_set": bool(wt), "cum_target": cum_unit, "cum_target_won": cum_target_won, "mtd": mtd, "mtd_end": mtd_end.isoformat() if mtd_end >= first else "", "gap": gap, "rate": rate, "prev_exists": bool(pm and pm["week_start"] == prev_start.isoformat()), diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index 745e8f2..0385cf5 100644 --- a/app/modules/project/templates/project/goal_meeting.html +++ b/app/modules/project/templates/project/goal_meeting.html @@ -1,7 +1,7 @@ {% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -13,6 +13,8 @@ {% block content %} {% set h = head if head is defined and head else {} %} {% set unk = h.unknown or [] %} +{#- 머리 숫자 — 목표 표 매출 단위(예: 백만원)로, 원이거나 모르는 단위면 원. 정확한 원 금액은 말풍선 -#} +{%- macro unitv(v) -%}{% if h.unit_mult and h.unit_mult > 1 %}{{ "{:,.1f}".format(v / h.unit_mult).rstrip('0').rstrip('.') }}{{ h.sales_unit }}{% else %}{{ won(v) }}원{% endif %}{%- endmacro -%} {%- macro unknown_val() -%}미확인{%- endmacro -%} {# 주간 회의록 — 목표 표 월 머리를 누르면 열린다(/project/goals/{연도}/meetings/{월}?week=주차 시작일). 주차(store.month_weeks — 그 달 안, 1주차는 1일부터)마다 회의록 하나: 머리 영역 3칸(월 계획 + 숫자 한 줄 | 결정 사항·메모 | 작업 등록) @@ -68,17 +70,17 @@ 월 목표 {% if h.sales_target is not none %}{{ num(h.sales_target) }}{{ h.sales_unit }}{% else %}—{% endif %} - + 누적 목표 ({{ week_n }}주차) - {% if h.cum_target_won is not none %}{{ won(h.cum_target_won) }}원{% else %}—{% endif %} + {% if h.cum_target_won is not none %}{{ unitv(h.cum_target_won) }}{% else %}—{% endif %} - + 누적 실적 {% if h.mtd_end %}({{ h.mtd_end[5:] | replace('-', '/') }}){% endif %} - {% if h.mtd is not none %}{{ won(h.mtd) }}원{% elif 'mtd' in unk %}{{ unknown_val() }}{% else %}—{% endif %} + {% if h.mtd is not none %}{{ unitv(h.mtd) }}{% elif 'mtd' in unk %}{{ unknown_val() }}{% else %}—{% endif %} - + 목표 대비 - {% if h.gap is not none %}{{ '+' if h.gap > 0 else '' }}{{ won(h.gap) }}원{% if h.rate is not none %} {{ h.rate }}%{% endif %} + {% if h.gap is not none %}{{ '+' if h.gap > 0 else '' }}{{ unitv(h.gap) }}{% if h.rate is not none %} {{ h.rate }}%{% endif %} {% elif 'mtd' in unk and h.cum_target_won is not none %}{{ unknown_val() }} {% else %}—{% endif %} @@ -102,7 +104,7 @@
-

결정 사항 · 메모

+

결정사항 : 진행상황 수시 공유 및 완료 되어야 함

{% if meeting %} {% if is_admin %} {% else %}
{{ meeting.notes or '—' }}
{% endif %} @@ -279,5 +281,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/goals.html b/app/modules/project/templates/project/goals.html index 736aff8..6f65c11 100644 --- a/app/modules/project/templates/project/goals.html +++ b/app/modules/project/templates/project/goals.html @@ -207,5 +207,5 @@ {% 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 d94b9b0..8663e06 100644 --- a/app/modules/project/templates/project/help.html +++ b/app/modules/project/templates/project/help.html @@ -175,7 +175,7 @@

멤버 배정 (관리자)

프로젝트 화면 제목 오른쪽에 멤버 사진이 겹쳐서 보입니다.

    -
  • + — 멤버를 추가합니다(프로젝트 관리 권한이 있는 직원 중에서 고릅니다).
  • +
  • + — 멤버 배정·제외 창이 열립니다. 지금 멤버는 체크된 채로 나오며, 체크하면 배정, 체크를 풀면 제외됩니다(제외는 확인 후). 후보는 프로젝트 관리 권한이 있는 직원이고, 소유자는 뺄 수 없습니다.
  • 사진에 마우스 → 이름이 보입니다. 클릭 → 그 사람이 이 프로젝트에서 맡은 작업 목록이 뜹니다.
  • 사진에서 우클릭 → 제외로 멤버에서 뺍니다.
@@ -598,7 +598,7 @@

제목 아래 해당 월 계획은 연간 목표 표에 적은 월 계획을 업무 영역별로 보여 줍니다. 굵게·기울임·밑줄·글자 색상과 줄바꿈·들여쓰기를 유지하고, 글자 크기는 월 계획의 기본 크기로 표시합니다. 빈 계획은 생략하고, 병합 칸은 해당 월을 포함하는 계획을 한 번 표시합니다. 여기서는 읽기만 하므로 수정하려면 연간 목표 표로 돌아갑니다.

위쪽 3칸 — 월 계획·숫자, 결정 사항, 작업 등록

-

제목 아래 세 칸은 표를 스크롤해도 그대로 보입니다. 왼쪽은 월 계획이고 그 머리 줄 오른쪽에 숫자 4개(월 목표 · 누적 목표 · 누적 실적 · 목표 대비)가 작게 한 줄로 나옵니다(숫자에 마우스를 올리면 자세한 뜻). 가운데는 결정 사항 · 메모, 오른쪽은 작업 등록 표입니다.

+

제목 아래 세 칸은 표를 스크롤해도 그대로 보입니다. 왼쪽은 월 계획이고 그 머리 줄 오른쪽에 숫자 4개(월 목표 · 누적 목표 · 누적 실적 · 목표 대비)가 작게 한 줄로 나옵니다(목표 표 매출 단위, 예: 백만원 — 숫자에 마우스를 올리면 원 단위 금액과 뜻). 가운데는 결정사항(진행상황 수시 공유 및 완료 되어야 할 것), 오른쪽은 작업 등록 표입니다.

  1. 작업 등록 — 제목 칸에 작업 이름을 씁니다. 담당자·프로젝트·섹션 칸을 누르면 고를 수 있는 목록이 나옵니다.
  2. 프로젝트는 내가 멤버인 프로젝트만 나오고, 고르면 첫 섹션이 자동으로 들어갑니다. 담당자는 그 프로젝트의 멤버·소유자 중에서 고릅니다(프로젝트를 먼저 고르면 정확합니다).
  3. @@ -619,7 +619,7 @@
  4. 각 항목의 주요 업무에 실행할 일과 일정을 적습니다.
  5. 참석자를 눌러 프로젝트 관리 권한이 있는 등록 직원 중 선택합니다. 찾기·전원 선택·모두 해제를 사용할 수 있으며, 칩의 ×로 참석자를 뺍니다.
  6. 참석자 오른쪽 회의록 보드를 누르면 그 주차의 Google 슬라이드가 새 창으로 열립니다. 처음 누르면 회의록 보드 공유 드라이브에 빈 슬라이드(제목 틀 없음)를 "10월 2주차 (10/5~10/11)" 같은 이름으로 만들고, 다음부터는 같은 파일을 엽니다. 직원 누구나 열 수 있으며, 슬라이드 편집 권한은 공유 드라이브 권한을 따릅니다. 창이 안 뜨면 브라우저의 팝업 허용을 확인하세요.
  7. -
  8. 위쪽 가운데 결정 사항 · 메모에 회의 결론과 다음주까지 확인할 일을 적습니다.
  9. +
  10. 위쪽 가운데 결정사항에 회의 결론과 진행상황을 수시로 공유하고 완료되어야 할 일을 적습니다.

금액은 1,200,000·120만·1.5억·3천만·1억2천만처럼 입력할 수 있습니다. Enter 또는 칸을 떠날 때 원 단위로 저장되고, 빈칸은 값을 지웁니다. 숫자로 읽히지 않는 값(예: 20개)은 적은 글 그대로 저장됩니다. 글·메모는 입력을 약 0.8초 멈추거나 칸을 떠날 때, 참석자는 바꾸는 즉시 저장됩니다.

diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html index 1e866c5..a93cad7 100644 --- a/app/modules/project/templates/project/inbox.html +++ b/app/modules/project/templates/project/inbox.html @@ -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 f6ead67..7918c7d 100644 --- a/app/modules/project/templates/project/mytasks.html +++ b/app/modules/project/templates/project/mytasks.html @@ -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 cfc848e..ce8662f 100644 --- a/app/modules/project/templates/project/project.html +++ b/app/modules/project/templates/project/project.html @@ -67,7 +67,7 @@ {% endfor %} {% if is_admin %} - + {% endif %}
@@ -428,16 +428,16 @@ @@ -487,5 +487,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/trash.html b/app/modules/project/templates/project/trash.html index 32f1381..9cc54f6 100644 --- a/app/modules/project/templates/project/trash.html +++ b/app/modules/project/templates/project/trash.html @@ -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 8aaf055..8964e8b 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -2512,7 +2512,16 @@ html.pj-goal-selecting, html.pj-goal-selecting * { user-select: none !important; .pj-meet-kpiline .pj-meet-kpi-rate { color: inherit; font-weight: 700; } /* ③ 작업 등록 표 — 빈 칸을 누르면 목록(body 에 붙는 메뉴) */ .pj-meet-quick-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; } -.pj-meet-quick-table th { position: sticky; top: 0; z-index: 1; background: #f7f8f9; padding: 4px 6px; font-size: 11.5px; font-weight: 600; color: var(--pj-ink-soft); text-align: left; border-bottom: 1px solid var(--pj-border); } +.pj-meet-quick-table th { position: sticky; top: 0; z-index: 1; background: #f7f8f9; padding: 4px 6px; font-size: 12px; font-weight: 700; color: var(--pj-ink); text-align: center; border-bottom: 1px solid var(--pj-border); } +.pj-meet-pick-cell.is-person { display: flex; align-items: center; gap: 6px; } +.pj-meet-pick-cell.is-person > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; } +.pj-meet-quick-face { width: 18px; height: 18px; flex: none; border-radius: 50%; object-fit: cover; } +.pj-meet-quick-face.is-ini { + display: inline-flex; align-items: center; justify-content: center; background: var(--pj-accent-tint); color: var(--pj-accent-dark); + font-size: 10.5px; font-weight: 700; +} +.pj-ctxmenu-ic .pj-meet-quick-face { width: 20px; height: 20px; } +.pj-member-pick.is-owner { opacity: .75; } .pj-meet-quick-table th:nth-child(1) { width: 34%; } .pj-meet-quick-table th:nth-child(2) { width: 17%; } .pj-meet-quick-table th:nth-child(3) { width: 20%; } diff --git a/app/static/project.js b/app/static/project.js index 48e79e4..0749898 100644 --- a/app/static/project.js +++ b/app/static/project.js @@ -7178,6 +7178,9 @@ }).observe(taskModal, { attributes: true, attributeFilter: ["hidden"] }); } + // ── 멤버 배정·제외(2026-10-07) — 후보 전원을 보여 주고 지금 멤버는 체크된 채로. 체크 = 배정, 체크 해제 = 제외. + // 소유자는 늘 권한이 있어 뺄 수 없다(체크·잠금). 권한을 잃어 후보에 없는 지금 멤버도 보여서 뺄 수 있게. + const lowerEmail = function (e) { return String(e || "").toLowerCase(); }; const addMemberBtn = el("pj-add-member"); if (addMemberBtn) addMemberBtn.addEventListener("click", async function () { const box = el("pj-m-users"); @@ -7185,11 +7188,26 @@ box.innerHTML = "불러오는 중…"; try { const res = await api("GET", "/project/api/assignable-users"); - const existing = new Set(members.map(function (m) { return m.user_email; })); - const candidates = res.users.filter(function (u) { return !existing.has(u.email); }); - box.innerHTML = candidates.length - ? candidates.map(memberPickHtml).join("") - : "배정 가능한 직원이 없습니다(권한 미부여 또는 전원 배정됨)"; + const owner = lowerEmail(currentProject && currentProject.owner_email); + const current = new Set(members.map(function (m) { return lowerEmail(m.user_email); })); + const seen = new Set(); + const list = (res.users || []).map(function (u) { seen.add(lowerEmail(u.email)); return u; }); + members.forEach(function (m) { // 후보 목록에 없는 지금 멤버(권한을 잃은 사람 등) + const e = lowerEmail(m.user_email); + if (!seen.has(e)) list.push({ email: e, id: idOf(e), name: m.user_name || idOf(e), avatar: "" }); + }); + if (!list.length) { box.innerHTML = "배정 가능한 직원이 없습니다(관리자 페이지에서 프로젝트 관리 권한 부여)"; return; } + box.innerHTML = list.map(memberPickHtml).join(""); + box.querySelectorAll("input[type=checkbox]").forEach(function (cb) { + const e = lowerEmail(cb.value); + cb.checked = current.has(e) || e === owner; + cb.dataset.was = cb.checked ? "1" : ""; + if (e === owner) { + cb.disabled = true; + const lab = cb.closest("label"); + if (lab) { lab.title = "소유자 — 뺄 수 없습니다"; lab.classList.add("is-owner"); } + } + }); } catch (e) { box.innerHTML = "불러오기 실패: " + escapeHtml(e.message) + ""; } @@ -7197,10 +7215,15 @@ const saveMemberBtn = el("pj-save-member"); if (saveMemberBtn) saveMemberBtn.addEventListener("click", async function () { const box = el("pj-m-users"); - const checked = box ? Array.from(box.querySelectorAll("input[type=checkbox]:checked")) : []; - if (!checked.length) { alert("직원을 선택하세요."); return; } + const boxes = box ? Array.from(box.querySelectorAll("input[type=checkbox]:not(:disabled)")) : []; + const toAdd = boxes.filter(function (cb) { return cb.checked && !cb.dataset.was; }); + const toRemove = boxes.filter(function (cb) { return !cb.checked && cb.dataset.was; }); + if (!toAdd.length && !toRemove.length) { closeModal(memberModal); return; } + if (toRemove.length && !(await confirm(toRemove.length + "명을 이 프로젝트에서 제외할까요? 제외되면 이 프로젝트를 볼 수 없습니다.", + { okText: "제외", cancelText: "취소" }))) return; + saveMemberBtn.disabled = true; let failCount = 0; - for (const cb of checked) { + for (const cb of toAdd) { try { const res = await api("POST", "/project/api/projects/" + projectId + "/members", { user_email: cb.value, user_name: cb.dataset.name || "", @@ -7208,9 +7231,17 @@ members.push(res.member); } catch (e) { failCount++; } } + for (const cb of toRemove) { + try { + await api("DELETE", "/project/api/projects/" + projectId + "/members/" + encodeURIComponent(cb.value)); + for (let i = members.length - 1; i >= 0; i--) if (lowerEmail(members[i].user_email) === lowerEmail(cb.value)) members.splice(i, 1); + } catch (e) { failCount++; } + } + saveMemberBtn.disabled = false; renderMemberList(); closeModal(memberModal); - if (failCount) showToast(failCount + "명 배정 실패", "error"); + if (failCount) showToast(failCount + "명 처리 실패", "error"); + else showToast("멤버를 저장했습니다" + (toAdd.length ? " · 배정 " + toAdd.length + "명" : "") + (toRemove.length ? " · 제외 " + toRemove.length + "명" : "")); }); // 최초 렌더 — 아사나처럼 프로젝트에 들어오면 보드(세션)가 기본 화면이다 @@ -10248,9 +10279,18 @@ const tbody = box.querySelector("tbody"); const wrap = document.querySelector(".pj-wrap"); const KEY = "pj_meet_quick:" + ((wrap && wrap.dataset.me) || ""); - const people = {}; - (window.PJ_MEET_MEMBERS || []).forEach(function (m) { people[String(m.email).toLowerCase()] = m.name; }); + const people = {}, faces = {}; + (window.PJ_MEET_MEMBERS || []).forEach(function (m) { + people[String(m.email).toLowerCase()] = m.name; + faces[String(m.email).toLowerCase()] = m.avatar || ""; + }); const nameOf = function (email) { return people[String(email).toLowerCase()] || capName(idOf(email)); }; + // 담당자 = 아이콘(사진, 없으면 첫 글자) + 이름 + const faceHtml = function (email) { + const url = faces[String(email).toLowerCase()]; + return url ? '' + : '' + escapeHtml(nameOf(email).slice(0, 1)) + ""; + }; const blank = function () { return { title: "", assignee: "", projectId: null, projectName: "", stageId: null, stageName: "" }; }; let rows = []; try { rows = (JSON.parse(localStorage.getItem(KEY) || "[]") || []).filter(function (r) { return r && !r.done; }); } catch (_) { rows = []; } @@ -10289,7 +10329,10 @@ tbody.innerHTML = rows.map(function (r, i) { return '" + '' + - "" + cell("assignee", r.assignee ? nameOf(r.assignee) : "", "담당자") + "" + + "" + (r.assignee + ? '" + : cell("assignee", "", "담당자")) + "" + "" + cell("project", r.projectName, "프로젝트") + "" + "" + cell("stage", r.stageName, "섹션") + "" + "" + (r.done @@ -10326,7 +10369,7 @@ : (window.PJ_MEET_MEMBERS || []).map(function (m) { return String(m.email).toLowerCase(); }); menuAt(btn, [{ label: "담당자 없음", icon: menuIcon("person_off"), checked: !r.assignee, onClick: function () { r.assignee = ""; save(); render(); } }, null] .concat(emails.map(function (e) { - return { label: nameOf(e), icon: menuIcon("person"), checked: r.assignee === e, onClick: function () { r.assignee = e; save(); render(); } }; + return { label: nameOf(e), icon: faceHtml(e), checked: r.assignee === e, onClick: function () { r.assignee = e; save(); render(); } }; }))); } async function pickStage(r, btn) { diff --git a/docs/PROJECT_MODULE.md b/docs/PROJECT_MODULE.md index 23960cc..d23cf76 100644 --- a/docs/PROJECT_MODULE.md +++ b/docs/PROJECT_MODULE.md @@ -248,7 +248,9 @@ 좌측 "내 작업"는 접이식 패널이 아니라 `/project/` 로 가는 링크다. **이 프로젝트의 멤버는 화면 위 제목 오른쪽**에 겹친 아바타로 둔다(`.pj-title-members`) — 마우스를 올리면 이름(`data-tip`, `initHoverTips` 가 위임 방식이라 동적 요소에도 붙는다), - 클릭하면 그 사람이 이 프로젝트에서 맡은 작업 팝업, 우클릭(관리자)하면 제외, 옆 `+` 는 멤버 배정. + 클릭하면 그 사람이 이 프로젝트에서 맡은 작업 팝업, 우클릭(관리자)하면 제외, 옆 `+` 는 **멤버 배정·제외 창**(2026-10-07 — + 후보 전원 + 지금 멤버는 체크된 채, 체크 = 배정 `POST …/members`, 해제 = 제외 `DELETE …/members/{email}`(확인 뒤), 소유자는 잠금. + 두 API 모두 관리자 + 그 프로젝트 관리 권한(`_require_manage`)). 좌측 트리의 작업 클릭도 페이지 이동 없이 바로 팝업(이미 로드된 전체 작업 데이터 사용). 좌측 맨 위 **수신함**(미확인 @태그 배지)과 **내 작업**(접이식, 기본 접힘 — 작업을 고르면 팝업이 열리며 다시 접힌다)가 있다. 예전 화면 오른쪽에 항상 떠 있던 "내 작업" 패널은 없앴고 diff --git a/tests/js/project_ui.test.js b/tests/js/project_ui.test.js index 677887e..e3b9eea 100644 --- a/tests/js/project_ui.test.js +++ b/tests/js/project_ui.test.js @@ -15,6 +15,7 @@ const WATCHDOG = setTimeout(function () { console.log("TIMEOUT — 어딘가에 const ROOT = path.join(__dirname, "..", ".."); const html = fs.readFileSync(path.join(__dirname, ".out", "project_render.html"), "utf8"); +const adminHtml = fs.readFileSync(path.join(__dirname, ".out", "project_admin_render.html"), "utf8"); const JS = fs.readFileSync(path.join(ROOT, "app", "static", "project.js"), "utf8"); const fails = []; @@ -29,8 +30,8 @@ function deferred() { return { promise: p, resolve: resolve, reject: reject }; } -function makeEnv() { - const dom = new JSDOM(html, { runScripts: "dangerously", pretendToBeVisual: true, url: "http://localhost/project/p/1" }); +function makeEnv(page) { + const dom = new JSDOM(page || html, { runScripts: "dangerously", pretendToBeVisual: true, url: "http://localhost/project/p/1" }); const w = dom.window, d = w.document; w.__PJ_TEST__ = true; w.HTMLDialogElement.prototype.showModal = function () { this.open = true; }; @@ -726,6 +727,29 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; } check("[대시보드 담당자별] 항목 → 작업 편집 창(하위 작업은 서버에서 받아)", !env.d.getElementById("pj-modal-task").hidden && env.d.getElementById("pj-t-title").value === "하위 2", env.d.getElementById("pj-t-title").value); } + // ── 멤버 배정·제외 — 지금 멤버는 체크된 채로, 체크 = 배정 · 해제 = 제외(확인 뒤) ── + { + const env = makeEnv(adminHtml); baseRoutes(env); + env.route("GET", /\/project\/api\/assignable-users$/, function () { return { body: { users: [ + { email: "me@test.local", id: "me", name: "Me", avatar: "" }, + { email: "bob@test.local", id: "bob", name: "Bob", avatar: "" }, + { email: "carol@test.local", id: "carol", name: "Carol", avatar: "" }] } }; }); + const added = [], removed = []; + env.route("POST", /\/project\/api\/projects\/1\/members$/, function (u, body) { added.push(body.user_email); return { body: { member: { user_email: body.user_email } } }; }); + env.route("DELETE", /\/project\/api\/projects\/1\/members\/.+$/, function (u) { removed.push(decodeURIComponent(u.split("/").pop())); return { body: { ok: true } }; }); + await boot(env); + const d = env.d; + d.getElementById("pj-add-member").click(); await settle(); + const box = function (e) { return d.querySelector('#pj-m-users input[value="' + e + '"]'); }; + check("[멤버 배정·제외] 지금 멤버 체크·나머지 해제", box("bob@test.local").checked && box("me@test.local").checked && !box("carol@test.local").checked); + box("bob@test.local").checked = false; box("carol@test.local").checked = true; + env.setConfirm(true); + d.getElementById("pj-save-member").click(); await settle(); await wait(10); await settle(); + check("[멤버 배정·제외] 체크 = 배정, 해제 = 제외(확인 뒤)", JSON.stringify(added) === '["carol@test.local"]' && + JSON.stringify(removed) === '["bob@test.local"]' && env.confirms === 1, [added, removed, env.confirms]); + const shown = Array.from(d.querySelectorAll(".pj-tmember")).map(function (n) { return n.dataset.email; }); + check("[멤버 배정·제외] 머리 멤버 아이콘 갱신", shown.indexOf("bob@test.local") < 0 && shown.indexOf("carol@test.local") >= 0, shown); + } clearTimeout(WATCHDOG); console.log(fails.length ? "\nFAILED: " + fails.join(", ") : "\nALL PASS"); process.exit(fails.length ? 1 : 0); diff --git a/tests/js/render_project.py b/tests/js/render_project.py index 471c073..647f188 100644 --- a/tests/js/render_project.py +++ b/tests/js/render_project.py @@ -50,8 +50,13 @@ def main() -> None: jinja2.FileSystemLoader(os.path.join(ROOT, "app", "modules", "project", "templates")), ])) env.globals["pj_kr_holidays"] = {} + for name, admin in (("project_render.html", False), ("project_admin_render.html", True)): + render_one(env, name, admin) + + +def render_one(env, name: str, admin: bool) -> None: html = env.get_template("project/project.html").render( - user={"email": ME, "is_super_admin": False}, is_admin=False, can_manage=True, + user={"email": ME, "is_super_admin": False}, is_admin=admin, can_manage=True, project=PROJECTS[0], current_project_id=1, stages=STAGES[1], tasks=TASKS, members=[{"user_email": ME, "role": "member"}, {"user_email": "bob@test.local", "role": "member"}], projects_meta=PROJECTS, nav_projects=PROJECTS, stages_by_project=STAGES, board_stage_names=["할 일", "완료"], @@ -62,7 +67,7 @@ def main() -> None: my_open_total=0, mention_unread=0, ) os.makedirs(OUT_DIR, exist_ok=True) - path = os.path.join(OUT_DIR, "project_render.html") + path = os.path.join(OUT_DIR, name) io.open(path, "w", encoding="utf-8", newline="\n").write(html) print("rendered:", path)