금주 현재 실적
@@ -180,12 +189,12 @@
{% if edit %}
{% else %}{{ won(it.target_amount) }}{% endif %}
- {% if it.week_auto is not none %}이번주 실적 {{ won(it.week_auto) }}{% if it.target_amount %} · {{ "%.0f" | format(it.week_auto / it.target_amount * 100) }}%{% endif %}{% endif %}
+ {% if it.week_auto is not none %}이번주 실적 {{ won(it.week_auto) }}{% if it.target_amount %} · {{ "%.0f" | format(it.week_auto / it.target_amount * 100) }}%{% endif %}{% endif %}
|
{% if p %}
{{ p.content }} |
{{ won(p.target_amount) }} |
-
+ |
{% if p.not_started %}
진행 전
{% elif p.auto_result is not none %}
@@ -232,5 +241,5 @@
{% 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 d65417e..c471bac 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 %}
@@ -207,5 +207,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 b699708..69b62ca 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 43367a4..8fa48a7 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 dd9d862..5e2b17d 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 bc39d97..d4f4951 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 1c921eb..39ee233 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 b3d0fa4..0cd9fb7 100644
--- a/app/static/project.css
+++ b/app/static/project.css
@@ -2185,6 +2185,19 @@ html.pj-goal-selecting, html.pj-goal-selecting * { user-select: none !important;
.pj-meet-week.is-on { border-color: var(--pj-accent); box-shadow: inset 0 0 0 1px var(--pj-accent); background: var(--pj-accent-tint); }
.pj-meet-dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: #34a853; }
+/* 매출 자료 갱신 상태 줄 */
+.pj-meet-sync {
+ display: flex; align-items: center; gap: 8px; margin: -4px 0 10px; padding: 6px 10px; border-radius: 8px;
+ background: #f6f7f9; color: var(--pj-ink-soft); font-size: 12.5px;
+}
+.pj-meet-sync .material-symbols-outlined { font-size: 17px; }
+.pj-meet-sync .pj-btn { margin-left: auto; }
+.pj-meet-sync.is-running { background: #eef4ff; color: #1d4ed8; }
+.pj-meet-sync.is-running .material-symbols-outlined { animation: pj-meet-spin 1s linear infinite; }
+.pj-meet-sync.is-done { background: #eefaf2; color: #1f7a44; }
+.pj-meet-sync.is-warn { background: #fff4ec; color: #b45309; }
+@keyframes pj-meet-spin { to { transform: rotate(360deg); } }
+@media print { .pj-meet-sync { display: none !important; } }
.pj-meet-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.pj-meet-kpis.is-week { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 12px; }
.pj-meet-kpi {
diff --git a/app/static/project.js b/app/static/project.js
index 5d9e455..dfe90b3 100644
--- a/app/static/project.js
+++ b/app/static/project.js
@@ -8635,6 +8635,94 @@
}
}
+ // ── 회의록 매출 자료 갱신 — 주차를 열면 실적 모듈 [매출 업데이트](지난주 월요일 ~ 이번 주 오늘, 백그라운드)를 한 번 더
+ // 돌리고, 끝나면 이 화면을 서버에서 다시 그려 숫자 칸만 바꿔 끼운다(입력 중인 칸·저장 안 된 글은 건드리지 않는다).
+ // 같은 주는 10분에 한 번만 자동(새로고침마다 쇼핑몰 API 를 부르지 않게), [매출 갱신] 버튼은 언제나.
+ // 실적 권한이 없거나 이미 다른 업데이트가 돌면 그 상태를 보여 준다(다른 사람 업데이트면 그게 끝나길 기다려 다시 그림).
+ function initMeetingSync(pane) {
+ const box = el("pj-meet-sync");
+ if (!box) return;
+ const text = box.querySelector(".pj-meet-sync-text");
+ const btn = el("pj-meet-sync-btn");
+ const KEY = "pj_meet_sync:" + pane.dataset.week;
+ const THROTTLE_MS = 10 * 60 * 1000;
+ let running = false;
+ function say(msg, cls) {
+ text.textContent = msg;
+ box.classList.remove("is-running", "is-done", "is-warn");
+ if (cls) box.classList.add(cls);
+ }
+ function hhmm(d) { return String(d.getHours()).padStart(2, "0") + ":" + String(d.getMinutes()).padStart(2, "0"); }
+ // 서버가 새로 그린 화면에서 숫자 칸만 옮겨 온다(입력칸이 있는 카드·칸은 안내 문구만)
+ async function repaint() {
+ const res = await fetch(location.href, { credentials: "same-origin" });
+ if (!res.ok) throw new Error("화면을 다시 읽지 못했습니다(" + res.status + ")");
+ const doc = new DOMParser().parseFromString(await res.text(), "text/html");
+ const swap = function (sel) {
+ const now = document.querySelectorAll(sel), fresh = doc.querySelectorAll(sel);
+ if (now.length !== fresh.length) return false;
+ now.forEach(function (n, i) {
+ if (n.querySelector("input, textarea, select")) {
+ const a = n.querySelector(".pj-meet-sub-slot"), b = fresh[i].querySelector(".pj-meet-sub-slot");
+ if (a && b) a.innerHTML = b.innerHTML;
+ return;
+ }
+ n.innerHTML = fresh[i].innerHTML;
+ });
+ return true;
+ };
+ swap(".pj-meet-kpi");
+ document.querySelectorAll("#pj-meet-table tr[data-item]").forEach(function (tr) {
+ const ftr = doc.querySelector('#pj-meet-table tr[data-item="' + tr.dataset.item + '"]');
+ if (!ftr) return;
+ [".pj-meet-c-result", "[data-rate]", ".pj-meet-week-slot"].forEach(function (sel) {
+ const a = tr.querySelector(sel), b = ftr.querySelector(sel);
+ if (!a || !b) return;
+ if (a.querySelector("input:focus")) return; // 결과를 입력하는 중
+ if (a.querySelector("input") && b.querySelector("input")) return; // 직접 입력 칸은 그대로
+ a.innerHTML = b.innerHTML;
+ });
+ });
+ }
+ async function run(force) {
+ if (running) return;
+ if (!force) {
+ try {
+ const last = Number(sessionStorage.getItem(KEY) || 0);
+ if (Date.now() - last < THROTTLE_MS) { say("매출 자료 갱신됨 " + hhmm(new Date(last)) + " (10분 안에는 다시 받지 않음)", "is-done"); return; }
+ } catch (_) {}
+ }
+ running = true;
+ btn.disabled = true;
+ say("쇼핑몰에서 매출 자료를 다시 받는 중…", "is-running");
+ try {
+ let r = await api("POST", "/performance/api/sync", { from: box.dataset.from, to: box.dataset.to, background: true });
+ const joined = r.joined;
+ let job = r.job;
+ while (!job.finished) {
+ const o = job.overall || {};
+ say((joined ? "다른 매출 업데이트 진행 중 — " : "매출 자료 다시 받는 중 — ") + (o.finished || 0) + "/" + (o.shops || 0) +
+ " 쇼핑몰" + (o.items ? " · 받은 자료 " + Number(o.items).toLocaleString("ko-KR") + "건" : ""), "is-running");
+ await new Promise(function (ok) { setTimeout(ok, 1000); });
+ job = (await api("GET", "/performance/api/sync/jobs/" + encodeURIComponent(job.id))).job;
+ }
+ await repaint();
+ try { sessionStorage.setItem(KEY, String(Date.now())); } catch (_) {}
+ const bad = (job.shops || []).filter(function (s) { return s.state === "error"; })
+ .map(function (s) { return s.name + (s.label ? "(" + s.label + ")" : ""); });
+ say("매출 자료 갱신 " + hhmm(new Date()) + " · " + Number((job.overall || {}).upserted || 0).toLocaleString("ko-KR") + "건 반영" +
+ (bad.length ? " · 실패: " + bad.join(", ") : ""), bad.length ? "is-warn" : "is-done");
+ } catch (e) {
+ say(e.status === 403 ? "실적 권한이 없어 저장된 실적으로 보여 줍니다" : "매출 갱신 실패: " + e.message, "is-warn");
+ } finally {
+ running = false;
+ btn.disabled = false;
+ }
+ }
+ btn.addEventListener("click", function () { run(true); });
+ run(false);
+ }
+
// ── 주간 회의록(/project/goals/{연도}/meetings/{월}?week=) — 관리자만 입력, 칸마다 바로 저장.
// · 글(이번주 할 일·메모): 0.8초 멈춤·칸 떠남·페이지 떠남에 저장. 금액·참석자: 칸 떠남·Enter 에 저장.
// · 지난주 결과·평가는 지난 회의록의 같은 줄(tr data-prev)에 저장하고 달성률을 바로 다시 그린다.
@@ -8665,6 +8753,7 @@
location.reload();
} catch (e) { create.disabled = false; showToast("만들기 실패: " + e.message, "error"); }
});
+ initMeetingSync(pane); // 보기만 하는 사람도(실적 권한이 있으면) 매출 자료 갱신
if (!isAdmin) return;
const table = el("pj-meet-table");
diff --git a/docs/PROJECT_MODULE.md b/docs/PROJECT_MODULE.md
index b9edfa2..dfee43b 100644
--- a/docs/PROJECT_MODULE.md
+++ b/docs/PROJECT_MODULE.md
@@ -581,6 +581,7 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중
지난 회의록 주가 아직 시작 전이면 "진행 전"(0 으로 보이지 않게), 연결한 쇼핑몰이 실적 모듈에서 사용 중이 아니면(사용 OFF·없는 코드)
"실적 미사용" 표시 + 직접 입력. 자동 결과 말풍선 = 쇼핑몰·기간, 0 이면 "그 기간 실적 없음 — [매출 업데이트]" 안내.
쇼핑몰 연결 줄은 목표 금액 아래에 **이번주 실적**(이 주 월요일~오늘, 목표 대비 %)도 보인다.
+ - **매출 자료 갱신**(`initMeetingSync`, 주차 탭 아래 상태 줄): 주차를 열면 실적 모듈 `POST /performance/api/sync {from: 지난주 월요일, to: 이번 주 일요일·오늘 중 이른 날, background: true}` 로 쇼핑몰에서 매출을 한 번 더 받고(진행 n/m 쇼핑몰·받은 자료), 끝나면 이 화면을 서버에서 다시 받아 **숫자 칸만** 바꿔 끼운다(머리 카드·자동 결과·달성률·이번주 실적 — 입력 중인 칸·직접 입력 결과 칸·저장 안 된 글은 그대로). 같은 주는 브라우저별 10분에 한 번만 자동(sessionStorage `pj_meet_sync:{월요일}` — 줄 추가 등으로 새로고침해도 다시 부르지 않음), [매출 갱신] 버튼은 언제나. 이미 다른 매출 업데이트가 돌면 그 작업이 끝나길 기다린다. 실적 권한이 없으면 저장된 실적으로 보여 준다는 안내, 실패한 쇼핑몰은 이름·상태. 지난주가 아직 오지 않은 주(미래)는 갱신 줄이 없다.
- 참석자 · **결정 사항·메모**. 인쇄 버튼(인쇄용 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,
|