feat(project): month-bounded meeting weeks, weekly sales targets, sticky header

- Weeks stay inside the month: week 1 starts on the 1st (through the next
  Sunday if the 1st is a weekend); a trailing Mon/Tue joins the last week.
  "Last week" is the previous period.
- Prev-week review columns: 전주 업무 | 결과(text, new result_note) |
  전주 목표 | 결과(amount).
- Header now shows month target, cumulative weekly target, month-to-date
  sales and gap (amount + %), with decisions/notes beside it; the area
  stays fixed while scrolling.
- Goals board: the monthly sales target is entered per week; the sum
  becomes the month target.
- Migration 020: result_note, goal_week_targets, drop Monday-only check,
  move absorbed Monday meetings to the new week start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 11:24:41 +09:00
parent 9194487217
commit cd3577b299
21 changed files with 751 additions and 250 deletions
+39 -15
View File
@@ -15,7 +15,7 @@ const ROOT = path.join(__dirname, "..", "..");
const OUT = path.join(__dirname, ".out");
const JS = fs.readFileSync(path.join(ROOT, "app", "static", "project.js"), "utf8");
const PAGE = {};
["goals_admin", "goals_ro", "meeting_admin", "meeting_err", "meeting_ro"].forEach(function (n) {
["goals_admin", "goals_ro", "goals_weekly_admin", "meeting_admin", "meeting_err", "meeting_ro"].forEach(function (n) {
PAGE[n] = fs.readFileSync(path.join(OUT, n + ".html"), "utf8");
});
const GOALS_URL = "http://localhost/project/goals/2026";
@@ -403,20 +403,45 @@ function meetServer(env, st) {
check("[2c] 최종 서버 정량 목표 300 · 지난주 결과(7일 전 주 줄 902) 75", st.items[1].target_amount === 300 && st.items[902].result_amount === 75, st.items);
check("[2c] 달성률·평가 열 없음(2026-10-06)", !env.d.querySelector("[data-rate], select.pj-meet-eval"));
});
await section(async function () { // 금주 목표 저장 — 새로고침하지 않고 숫자 칸만 다시(다른 칸의 미저장 글 보존)
await section(async function () { // 지난주 결과 글(020) — 지난 주차 줄(data-prev)에 저장, 새로고침 없음
const env = makeEnv(PAGE.meeting_admin, MEET_URL);
const st = meetServer(env, { itemHook: function (id, body) { if ("content" in body) return { status: 503, body: { detail: "x" } }; } });
const st = meetServer(env);
await boot(env);
const gets0 = st.gets || 0;
const ta = env.d.querySelector('tr[data-item="1"] .pj-meet-text');
ta.focus(); type(env, ta, "unsaved note");
const tgt = env.d.getElementById("pj-meet-target");
tgt.focus(); tgt.value = "2,000"; tgt.blur();
const note = env.d.querySelector('tr[data-item="2"] .pj-meet-rnote');
check("[2d] 결과 글 칸 = 지난 주차 값", !!note && note.value === "샘플 결과", note && note.value);
note.focus(); type(env, note, "결과 메모"); note.blur();
await settle(); await wait(10); await settle();
check("[2d] 금주 목표 저장 = 서버 확정값", st.head.week_target === 2000 && tgt.value === "2,000", st.head);
check("[2d] 결과 글 → 지난 주차 줄(902)에 저장", st.items[902] && st.items[902].result_note === "결과 메모", st.items);
check("[2d] 페이지 새로고침 없음", env.navigations === 0);
check("[2d] 숫자 칸만 다시 받음(GET 1회 더)", (st.gets || 0) === gets0 + 1, st.gets);
check("[2d] 다른 칸 미저장 글 유지", ta.value === "unsaved note");
check("[2d] 금주 목표 입력칸 없음(위쪽 숫자 4칸)", !env.d.getElementById("pj-meet-target") && env.d.querySelectorAll(".pj-meet-top .pj-meet-kpi").length === 4);
});
// ════════════════════ [2e] 주차별 매출 목표(020) — 매출 목표 칸 → 주차 입력 창(body), 저장하면 합계가 월 목표 ════════════════════
await section(async function () {
const env = makeEnv(PAGE.goals_weekly_admin, GOALS_URL);
const st = goalsServer(env);
let sent = null;
env.route("PUT", /\/project\/api\/goals\/2026\/week-targets\/1$/, function (u, body) {
sent = body;
const weeks = {};
Object.keys(body.weeks).forEach(function (k) { weeks[k] = body.weeks[k]; });
return { body: { ok: true, value: 600, label: "600", weeks: weeks } };
});
await boot(env);
const inp = env.d.querySelector('input.pj-goal-num[data-metric="sales"][data-kind="target"][data-month="1"]');
check("[2e] 매출 목표 칸은 직접 입력 아님(readonly)", inp.readOnly && inp.dataset.weekly === "1");
inp.click();
const pop = env.d.body.querySelector(".pj-goal-wkpop");
const ins = pop ? Array.from(pop.querySelectorAll("input")) : [];
check("[2e] 창은 body 에, 1월 주차 수만큼 입력칸", !!pop && pop.parentElement === env.d.body && ins.length === 5, ins.length);
check("[2e] 저장된 주차 값·합계", ins[0].value === "100" && ins[1].value === "200" && pop.querySelector(".pj-goal-wkpop-sum b").textContent === "300");
type(env, ins[2], "300");
check("[2e] 입력하면 합계 다시 계산", pop.querySelector(".pj-goal-wkpop-sum b").textContent === "600");
pop.querySelector('[data-act="save"]').click();
await settle(); await wait(10); await settle();
check("[2e] 주차별 값 전송(주차 시작일 키)", sent && sent.weeks["2026-01-12"] === "300" && Object.keys(sent.weeks).length === 5, sent);
check("[2e] 월 목표 칸 = 합계, 창 닫힘", inp.value === "600" && !env.d.body.querySelector(".pj-goal-wkpop"));
check("[2e] 월 목표 직접 저장 요청 없음", !st.metric);
});
// ════════════════════ [3] 목표 표 — 글 저장 실패면 구조 변경·표 교체 중단 ════════════════════
@@ -504,12 +529,11 @@ function meetServer(env, st) {
const kpi = Array.from(env.d.querySelectorAll(".pj-meet-kpi")).map(function (k) { return k.textContent.replace(/\s+/g, " ").trim(); });
const mtd = kpi.find(function (t) { return /월 누적 실적/.test(t); });
check("[6] 월 누적 = 미확인(0원 아님)", /미확인/.test(mtd) && !/0원|0 원/.test(mtd), mtd);
check("[6] 주당 필요 = 미확인(목표로 계산하지 않음)", /미확인/.test(kpi.find(function (t) { return /주당 필요/.test(t); })));
check("[6] 전주 결과·금주 실적 = 미확인", /미확인/.test(kpi.find(function (t) { return /전주 결과/.test(t); })) && /미확인/.test(kpi.find(function (t) { return /금주 현재 실적/.test(t); })));
check("[6] 누적 목표 대비 달성 = 미확인(차액·% 계산하지 않음)", /미확인/.test(kpi.find(function (t) { return /누적 목표 대비/.test(t); })));
const row = env.d.querySelector('tr[data-item="1"]');
check("[6] 쇼핑몰 줄도 결과 = 직접 입력 칸(자동 결과 폐지)", !!row.querySelector(".pj-meet-c-result input") && !/미확인/.test(row.querySelector(".pj-meet-c-result").textContent));
check("[6] 줄별 이번주 실적 표시 없음 · 달성률 열 없음", !row.querySelector(".pj-meet-week-slot") && !row.querySelector("[data-rate]"));
check("[6] 회의록 입력은 그대로 가능", !!row.querySelector(".pj-meet-text") && !!env.d.getElementById("pj-meet-target"));
check("[6] 회의록 입력은 그대로 가능", !!row.querySelector(".pj-meet-text") && !!env.d.getElementById("pj-meet-notes"));
check("[6] 조회 실패 안내 문구", /미확인/.test(env.d.querySelector(".pj-meet-perf-warn").textContent));
});
await section(async function () { // 지난주 리뷰 머리 = 지난주(9/21~) — 지난주 회의록에 없는 줄 안내
@@ -802,7 +826,7 @@ function meetServer(env, st) {
await wait(20); await settle();
check("[9] 실적 권한 없음 → sync API 호출 0", !st.syncCalls && !env.calls.some(function (c) { return /performance/.test(c.url); }));
check("[9] 권한 없음 설명(저장된 실적·마지막 갱신 시각)", /권한이 없어/.test(env.d.getElementById("pj-meet-sync").textContent) && /10\/01 14:20/.test(env.d.getElementById("pj-meet-sync").textContent));
check("[9] 보기 전용: 입력칸 없음", !env.d.querySelector(".pj-meet-text") && !env.d.getElementById("pj-meet-target"));
check("[9] 보기 전용: 입력칸 없음", !env.d.querySelector(".pj-meet-text, .pj-meet-rnote, #pj-meet-notes"));
});
await section(async function () { // 10분 제한 — 최근 기록이 있으면 다시 부르지 않고 그 상태만(일부 실패면 안내 유지)
const env = makeEnv(PAGE.meeting_admin, MEET_URL, { session: { "pj_meet_sync:2026-09-28": JSON.stringify({ at: Date.now(), state: "partial", bad: ["네이버"] }) } });