Merge branch 'feat/perf-memo-all-shops'

This commit is contained in:
2026-10-22 12:57:49 +09:00
6 changed files with 24 additions and 17 deletions
+2 -1
View File
@@ -68,7 +68,8 @@
## 날짜 칸 메모 (2026-10-22, 마이그레이션 010 `perf_cell_memos`)
- 매출 실적·광고비 일자별 표의 **금액 입력 칸**(`td.is-manual-cell`) 우클릭 → [메모 삽입] / [메모 수정]·[메모 삭제](`.perf-ctx` 메뉴, 창에서 입력, Ctrl+Enter 저장).
- 매출 실적·광고비 일자별 표의 **쇼핑몰(광고 채널) 날짜 칸 전부**(`td[data-memo-code]` — 매출 탭은 수동 입력 칸 + API 쇼핑몰 칸, 같은 날 넓힘; 그룹 열·주간합계·합계 줄은 아님)
우클릭 → [메모 삽입] / [메모 수정]·[메모 삭제](`.perf-ctx` 메뉴, 창에서 입력, Ctrl+Enter 저장). 왼쪽 클릭은 그대로(입력 칸 = 금액 입력, API 칸 = 주문 내역).
`PUT /performance/api/cell-memos/{kind}/{코드}/{날짜}` (kind = `sales` 쇼핑몰 / `ad` 광고 채널, 빈 메모 = 지움, 1,000자), 모듈 권한자 누구나.
- 메모 있는 칸 = 오른쪽 위 빨간 삼각형(`has-memo`, 엑셀 메모처럼), 마우스 올리면 노란 메모 상자(`.perf-memo-tip`). 금액과 따로 저장(금액 지워도 남음).
화면 데이터 `memo_cells`("날짜|코드" → 메모, `db.cell_memos`), 010 미적용이면 표시 없음·저장만 503. 표를 스크롤하면 열린 메뉴는 닫힌다.
@@ -120,7 +120,7 @@
{% set fx = (formula_cells or {}).get(r.date ~ '|' ~ c) if not up and not ap else none %}
{% set memo = (memo_cells or {}).get(r.date ~ '|' ~ c) %}{#- 메모(010) -#}
<td class="perf-num is-manual-cell{% if v and not up and not ap %} is-manual{% endif %}{% if fx %} is-formula{% endif %}{% if up %} is-upload{% endif %}{% if ap %} is-api{% endif %}{% if memo %} has-memo{% endif %}"
data-manual-code="{{ c }}" data-date="{{ r.date }}" data-manual-value="{{ v if v else '' }}"{% if fx %} data-formula="{{ fx }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %} tabindex="0"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
data-manual-code="{{ c }}" data-date="{{ r.date }}" data-memo-code="{{ c }}" data-manual-value="{{ v if v else '' }}"{% if fx %} data-formula="{{ fx }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %} tabindex="0"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
{% else %}
<td class="perf-num"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
{% endif %}
@@ -240,4 +240,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022e" defer></script>{% endblock %}
@@ -168,11 +168,13 @@
{% set is_manual = (r.date ~ '|' ~ c) in manual_cells %}
{% set fx = (formula_cells or {}).get(r.date ~ '|' ~ c) %}
{% set memo = (memo_cells or {}).get(r.date ~ '|' ~ c) %}{#- 메모(010) — 우클릭 메모 삽입·수정·삭제, 있으면 칸 오른쪽 위 빨간 삼각형 -#}
<td class="perf-num is-manual-cell{% if is_manual %} is-manual{% endif %}{% if fx %} is-formula{% endif %}{% if glast %} is-glast{% endif %}{% if memo %} has-memo{% endif %}"{{ gattr }} data-manual-code="{{ c }}" data-date="{{ r.date }}"
<td class="perf-num is-manual-cell{% if is_manual %} is-manual{% endif %}{% if fx %} is-formula{% endif %}{% if glast %} is-glast{% endif %}{% if memo %} has-memo{% endif %}"{{ gattr }} data-manual-code="{{ c }}" data-date="{{ r.date }}" data-memo-code="{{ c }}"
data-manual-value="{{ m.gross if is_manual else '' }}"{% if fx %} data-formula="{{ fx }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %} tabindex="0">{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
{% else %}
<td class="perf-num{% if r['from'] and (m.gross or m.commission) %} is-link{% endif %}{% if glast %} is-glast{% endif %}"{{ gattr }}
{% if r['from'] %}data-code="{{ c }}" data-from="{{ r['from'] }}" data-to="{{ r['to'] }}"{% endif %}>{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
{#- 메모(2026-10-22) — API 쇼핑몰 날짜 칸도 우클릭 메모(data-memo-code). 왼쪽 클릭은 그대로 주문 내역 -#}
{% set memo = (memo_cells or {}).get(r.date ~ '|' ~ c) if r.kind == 'day' else none %}
<td class="perf-num{% if r['from'] and (m.gross or m.commission) %} is-link{% endif %}{% if glast %} is-glast{% endif %}{% if memo %} has-memo{% endif %}"{{ gattr }}
{% if r['from'] %}data-code="{{ c }}" data-from="{{ r['from'] }}" data-to="{{ r['to'] }}"{% endif %}{% if r.kind == 'day' %} data-memo-code="{{ c }}" data-date="{{ r.date }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %}>{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
{% endif %}
{% endfor %}
<td class="perf-num perf-td-total">{{ m3(r.total) }}{% if r.ads_total %}{{ adl_total(r.ads_total) }}{% endif %}</td>
@@ -289,4 +291,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022e" defer></script>{% endblock %}
@@ -259,4 +259,4 @@
</section>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022e" defer></script>{% endblock %}
+5 -4
View File
@@ -773,7 +773,8 @@
if (td && e.target === td && (e.key === "Enter" || e.key === "F2")) { e.preventDefault(); editManual(td); }
});
// ── 날짜 칸 메모(2026-10-22, 마이그레이션 010) — 금액 입력 칸 우클릭 → 메모 삽입 / 메모 수정·메모 삭제(창에서 입력).
// ── 날짜 칸 메모(2026-10-22, 마이그레이션 010) — 쇼핑몰(광고 채널) 날짜 칸(td[data-memo-code]) 우클릭 → 메모 삽입 / 메모 수정·메모 삭제(창에서 입력).
// 매출 탭은 수동 입력 칸뿐 아니라 API 쇼핑몰 칸도(같은 날, 사용자 요청). 그룹 열·주간합계·합계 줄은 아님.
// 메모 있는 칸 = 오른쪽 위 빨간 삼각형(has-memo), 마우스를 올리면 칸 옆에 노란 메모 상자. 금액과 따로 저장(PUT /api/cell-memos/{kind}/{코드}/{날짜}).
const MEMO_KIND = data.memo_kind || "";
let memoMenu = null, memoTip = null;
@@ -781,7 +782,7 @@
function hideMemoTip() { if (memoTip) { memoTip.remove(); memoTip = null; } }
function memoCellLabel(td) {
const d = td.dataset.date || "";
return ((data.names || {})[td.dataset.manualCode] || td.dataset.manualCode) + " · " + d.replace(/-/g, ".");
return ((data.names || {})[td.dataset.memoCode] || td.dataset.memoCode) + " · " + d.replace(/-/g, ".");
}
function setCellMemo(td, memo) {
if (memo) td.dataset.memo = memo; else delete td.dataset.memo;
@@ -789,7 +790,7 @@
}
async function saveMemo(td, memo) {
const res = await api("PUT", "/performance/api/cell-memos/" + encodeURIComponent(MEMO_KIND) + "/" +
encodeURIComponent(td.dataset.manualCode) + "/" + encodeURIComponent(td.dataset.date), { memo: memo });
encodeURIComponent(td.dataset.memoCode) + "/" + encodeURIComponent(td.dataset.date), { memo: memo });
setCellMemo(td, res.memo || "");
}
function editMemo(td) {
@@ -815,7 +816,7 @@
setTimeout(function () { ta.focus(); ta.setSelectionRange(ta.value.length, ta.value.length); }, 0);
}
root.addEventListener("contextmenu", function (e) {
const td = MEMO_KIND && e.target.closest("td.is-manual-cell");
const td = MEMO_KIND && e.target.closest("td[data-memo-code]");
if (!td || td.querySelector(".perf-manual-input")) return; // 입력 중인 칸은 브라우저 기본 메뉴(붙여넣기 등)
e.preventDefault();
closeMemoMenu();
+8 -5
View File
@@ -19,7 +19,7 @@ function page(file) {
.replace(/<script src="\/static\/performance\.js[^"]*" defer><\/script>/, function () { return "<script>" + js + "</script>"; });
}
async function memoFlow(browser, file, kind, code, day, hasMemo, label) {
async function memoFlow(browser, file, kind, code, day, hasMemo, label, manual) {
const ctx = await browser.newContext({ viewport: { width: 1400, height: 900 } });
const p = await ctx.newPage();
const puts = [];
@@ -40,10 +40,10 @@ async function memoFlow(browser, file, kind, code, day, hasMemo, label) {
return Array.from(document.querySelectorAll(".perf-main tbody [title]")).map(function (n) { return n.tagName + ":" + n.getAttribute("title"); });
});
check(label + " 표 칸에 풍선 도움말(title) 없음", tips.length === 0, tips.slice(0, 5));
const td = '[data-manual-code="' + code + '"][data-date="' + day + '"]';
const td = 'td[data-memo-code="' + code + '"][data-date="' + day + '"]';
// 표를 스크롤하면 열린 메뉴는 닫힌다(사람은 스크롤한 뒤 우클릭) — 오른쪽 끝 열(기타광고비)은 먼저 보이게 스크롤해 둔다
const show = async function (sel) { await p.locator(sel).scrollIntoViewIfNeeded(); await p.waitForTimeout(80); };
const memoed = '[data-manual-code="' + hasMemo[0] + '"][data-date="' + hasMemo[1] + '"]';
const memoed = 'td[data-memo-code="' + hasMemo[0] + '"][data-date="' + hasMemo[1] + '"]';
// 기존 메모 = 빨간 삼각형 + 마우스 올리면 메모 상자
const mark = await p.evaluate(function (sel) {
const el = document.querySelector(sel);
@@ -87,9 +87,10 @@ async function memoFlow(browser, file, kind, code, day, hasMemo, label) {
await p.waitForFunction(function (sel) { return !document.querySelector(sel).classList.contains("has-memo"); }, td);
check(label + " 메모 삭제 → 빈 메모로 저장, 표시 사라짐", puts[puts.length - 1].memo === "");
check(label + " 저장한 뒤에도 칸에 풍선 도움말 없음", !(await p.getAttribute(td, "title")));
// 칸 왼쪽 클릭은 예전처럼 금액 입력
// 칸 왼쪽 클릭은 예전처럼 — 입력 칸은 금액 입력, API 쇼핑몰 칸은 입력 칸이 아님(값 있으면 주문 내역)
await p.click(td);
check(label + " 칸 클릭은 그대로 금액 입력", !!(await p.$(td + " .perf-manual-input")));
if (manual !== false) check(label + " 칸 클릭은 그대로 금액 입력", !!(await p.$(td + " .perf-manual-input")));
else check(label + " API 쇼핑몰 칸은 입력 칸이 아님(우클릭 메모만)", !(await p.$(td + " .perf-manual-input")) && !(await p.$(td + ".is-manual-cell")));
await ctx.close();
}
@@ -97,6 +98,8 @@ async function memoFlow(browser, file, kind, code, day, hasMemo, label) {
const browser = await chromium.launch(process.env.PJ_TEST_BROWSER ? { executablePath: process.env.PJ_TEST_BROWSER } : {});
try {
await memoFlow(browser, "perf_dash.html", "sales", "coupang", "2026-10-06", ["coupang", "2026-10-05", "행사 매출 포함\n2차 정산 예정"], "[매출]");
// 2026-10-22 — API 쇼핑몰(카페24, 수동 입력 아님) 칸도 메모
await memoFlow(browser, "perf_dash.html", "sales", "cafe24", "2026-10-06", ["coupang", "2026-10-05", "행사 매출 포함\n2차 정산 예정"], "[매출·API 쇼핑몰]", false);
await memoFlow(browser, "perf_ads.html", "ad", "etc", "2026-10-06", ["coupang_wing", "2026-10-05", "쿠폰 광고"], "[광고비]");
// 광고비 표 — 기타광고비 열, 열 너비 = 내용, 날짜 열 고정