feat(performance): 날짜 칸 메모·광고비 표 열 너비 자동/날짜 열 고정·기타광고비 열
- 매출 실적·광고비 금액 입력 칸 우클릭 → 메모 삽입·수정·삭제(창), 메모 있는 칸 빨간 삼각형·마우스 올리면 메모 상자
(마이그레이션 010 perf_cell_memos, PUT /api/cell-memos/{kind}/{code}/{date})
- 광고비 표도 열 너비 = 내용 길이, 날짜 열 가로 스크롤 고정(perf-autofit)
- 기타광고비 열(etc, 애터미아자몰 오른쪽) — ROAS 없음
- 테스트: test_cell_memos.py, perf_memo_ads.browser.test.js, 기존 채널 목록 기대값
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -441,3 +441,19 @@ body.perf-dragging, body.perf-dragging * { cursor: grabbing !important; user-sel
|
||||
.perf-main .is-gshut { padding-left: 0 !important; padding-right: 0 !important; }
|
||||
.perf-main .is-gshut .perf-gc { opacity: 0; }
|
||||
@media (prefers-reduced-motion: reduce) { .perf-gtoggle .g-v { transition: none; } }
|
||||
|
||||
/* ── 날짜 칸 메모(2026-10-22, 010) — 메모 있는 칸 = 오른쪽 위 빨간 삼각형(엑셀 메모처럼), 마우스 올리면 노란 메모 상자, 우클릭 메뉴 ── */
|
||||
.perf-main td.has-memo { position: relative; }
|
||||
.perf-main td.has-memo::after { content: ""; position: absolute; top: 0; right: 0; width: 0; height: 0;
|
||||
border-left: 8px solid transparent; border-top: 8px solid #e03131; pointer-events: none; }
|
||||
.perf-memo-tip { position: absolute; z-index: 2200; max-width: 280px; padding: 8px 10px; background: #fff9db; color: #3d3418;
|
||||
border: 1px solid #f2d36b; border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .14); font-size: 12.5px; line-height: 1.5;
|
||||
white-space: pre-wrap; word-break: break-word; pointer-events: none; }
|
||||
.perf-ctx { position: absolute; z-index: 2300; min-width: 130px; padding: 4px; background: #fff; border: 1px solid #e2e5e9; border-radius: 10px;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, .16); display: flex; flex-direction: column; }
|
||||
.perf-ctx button { all: unset; box-sizing: border-box; padding: 7px 12px; border-radius: 7px; font-size: 13px; cursor: pointer; color: #1e1f21; }
|
||||
.perf-ctx button:hover, .perf-ctx button:focus-visible { background: #f2f4f6; }
|
||||
.perf-ctx button.is-danger { color: #c22b10; }
|
||||
.perf-memo-input { width: 100%; box-sizing: border-box; min-height: 110px; padding: 10px; border: 1px solid #d8dce2; border-radius: 8px;
|
||||
font: inherit; font-size: 13.5px; line-height: 1.5; resize: vertical; }
|
||||
.perf-memo-input:focus { outline: none; border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26, 86, 219, .12); }
|
||||
|
||||
@@ -774,6 +774,93 @@
|
||||
const td = e.target.closest && e.target.closest("td.is-manual-cell");
|
||||
if (td && e.target === td && (e.key === "Enter" || e.key === "F2")) { e.preventDefault(); editManual(td); }
|
||||
});
|
||||
|
||||
// ── 날짜 칸 메모(2026-10-22, 마이그레이션 010) — 금액 입력 칸 우클릭 → 메모 삽입 / 메모 수정·메모 삭제(창에서 입력).
|
||||
// 메모 있는 칸 = 오른쪽 위 빨간 삼각형(has-memo), 마우스를 올리면 칸 옆에 노란 메모 상자. 금액과 따로 저장(PUT /api/cell-memos/{kind}/{코드}/{날짜}).
|
||||
const MEMO_KIND = data.memo_kind || "";
|
||||
let memoMenu = null, memoTip = null;
|
||||
function closeMemoMenu() { if (memoMenu) { memoMenu.remove(); memoMenu = null; } }
|
||||
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, ".");
|
||||
}
|
||||
function setCellMemo(td, memo) {
|
||||
if (memo) td.dataset.memo = memo; else delete td.dataset.memo;
|
||||
td.classList.toggle("has-memo", !!memo);
|
||||
}
|
||||
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 });
|
||||
setCellMemo(td, res.memo || "");
|
||||
}
|
||||
function editMemo(td) {
|
||||
const had = !!td.dataset.memo;
|
||||
const m = openModal((had ? "메모 수정" : "메모 삽입") + " · " + memoCellLabel(td), { narrow: true });
|
||||
const ta = el("textarea", { class: "perf-memo-input", rows: "5", maxlength: "1000", placeholder: "메모를 입력하세요 (Ctrl+Enter 저장)",
|
||||
"aria-label": memoCellLabel(td) + " 메모" });
|
||||
ta.value = td.dataset.memo || "";
|
||||
m.body.appendChild(ta);
|
||||
const cancel = el("button", { type: "button", class: "erp-btn erp-btn-outline" }, "취소");
|
||||
const save = el("button", { type: "button", class: "erp-btn erp-btn-primary" }, "저장");
|
||||
m.foot.appendChild(cancel);
|
||||
m.foot.appendChild(save);
|
||||
cancel.addEventListener("click", m.close);
|
||||
save.addEventListener("click", async function () {
|
||||
save.disabled = true;
|
||||
try { await saveMemo(td, ta.value.trim()); m.close(); }
|
||||
catch (err) { save.disabled = false; alertMsg("메모 저장 실패: " + err.message); }
|
||||
});
|
||||
ta.addEventListener("keydown", function (e) {
|
||||
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) { e.preventDefault(); save.click(); }
|
||||
});
|
||||
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");
|
||||
if (!td || td.querySelector(".perf-manual-input")) return; // 입력 중인 칸은 브라우저 기본 메뉴(붙여넣기 등)
|
||||
e.preventDefault();
|
||||
closeMemoMenu();
|
||||
hideMemoTip();
|
||||
const items = td.dataset.memo
|
||||
? [["메모 수정", function () { editMemo(td); }],
|
||||
["메모 삭제", async function () {
|
||||
if (!(await confirmMsg(memoCellLabel(td) + " 칸의 메모를 지울까요?"))) return;
|
||||
try { await saveMemo(td, ""); } catch (err) { alertMsg("메모 삭제 실패: " + err.message); }
|
||||
}]]
|
||||
: [["메모 삽입", function () { editMemo(td); }]];
|
||||
memoMenu = el("div", { class: "perf-ctx", role: "menu" });
|
||||
items.forEach(function (it) {
|
||||
const b = el("button", { type: "button", role: "menuitem", class: it[0] === "메모 삭제" ? "is-danger" : "" }, esc(it[0]));
|
||||
b.addEventListener("click", function () { closeMemoMenu(); it[1](); });
|
||||
memoMenu.appendChild(b);
|
||||
});
|
||||
document.body.appendChild(memoMenu);
|
||||
const w = memoMenu.offsetWidth, h = memoMenu.offsetHeight;
|
||||
memoMenu.style.left = Math.min(e.clientX, window.innerWidth - w - 6) + window.scrollX + "px";
|
||||
memoMenu.style.top = Math.min(e.clientY, window.innerHeight - h - 6) + window.scrollY + "px";
|
||||
memoMenu.querySelector("button").focus();
|
||||
});
|
||||
document.addEventListener("mousedown", function (e) { if (memoMenu && !memoMenu.contains(e.target)) closeMemoMenu(); });
|
||||
document.addEventListener("keydown", function (e) { if (e.key === "Escape") closeMemoMenu(); });
|
||||
window.addEventListener("scroll", function () { closeMemoMenu(); hideMemoTip(); }, true);
|
||||
root.addEventListener("mouseover", function (e) {
|
||||
const td = e.target.closest && e.target.closest("td.has-memo");
|
||||
if (!td || (memoTip && memoTip._td === td) || td.querySelector(".perf-manual-input")) return;
|
||||
hideMemoTip();
|
||||
memoTip = el("div", { class: "perf-memo-tip", role: "tooltip", text: td.dataset.memo || "" });
|
||||
memoTip._td = td;
|
||||
document.body.appendChild(memoTip);
|
||||
const r = td.getBoundingClientRect(), w = memoTip.offsetWidth;
|
||||
const left = r.right + 6 + w > window.innerWidth ? r.left - w - 6 : r.right + 6;
|
||||
memoTip.style.left = Math.max(6, left) + window.scrollX + "px";
|
||||
memoTip.style.top = r.top + window.scrollY + "px";
|
||||
});
|
||||
root.addEventListener("mouseout", function (e) {
|
||||
const td = e.target.closest && e.target.closest("td.has-memo");
|
||||
if (td && !(e.relatedTarget && td.contains(e.relatedTarget))) hideMemoTip();
|
||||
});
|
||||
root.addEventListener("click", hideMemoTip, true);
|
||||
async function openEvents(code, from, to) {
|
||||
const name = (data.names || {})[code] || code;
|
||||
const title = name + " · " + (from === to ? from : from + " ~ " + to) + " 주문 내역";
|
||||
|
||||
Reference in New Issue
Block a user