feat(performance): 앞날 입력·계산식 칸·기간 합계 맨 위
- 매출 수동 입력·광고비 날짜 칸과 엑셀·광고 보고서 업로드에서 오늘 이후 날짜 허용 - 이번달 등 일자별 표의 기간 합계 행을 제목 행 바로 아래로 - 날짜 칸에 = 없이 1000+2000 계산식 입력(formula.parse_amount), 식은 마이그레이션 008 formula 열에 저장해 파랑 굵은 숫자·다시 누르면 식 - 광고비 탭 직접 입력값은 굵게 해제(굵게는 계산식만) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -196,6 +196,10 @@ td.is-link:hover { background: #eef2ff; text-decoration: underline; }
|
||||
.perf-main td.is-manual-cell:hover { background: #eef3ff; box-shadow: inset 0 0 0 1px #c7d6fb; }
|
||||
.perf-main td.is-manual-cell:focus { outline: 2px solid #1a56db; outline-offset: -2px; }
|
||||
.perf-main td.is-manual .v-gross { color: #1a56db; font-weight: 600; }
|
||||
/* 광고비 탭 직접 입력값은 파랑 보통 굵기(2026-10-21) — 굵게는 계산식 칸만 */
|
||||
.perf-ads td.is-manual .v-gross { font-weight: 400; }
|
||||
/* 계산식(1000+2000)으로 입력한 칸 — 파랑 굵은 숫자(매출 실적은 보기 기준 금액 모두) */
|
||||
.perf-main td.is-manual.is-formula .v { color: #1a56db; font-weight: 700; }
|
||||
.perf-main td.is-stale .v-commission, .perf-main td.is-stale .v-net { opacity: .4; }
|
||||
/* 입력칸은 칸 위에 겹쳐 띄운다(표 배치에서 빠짐) — 숫자는 자리만 남기고 숨겨 열 너비가 그대로 */
|
||||
.perf .perf-main td.is-editing .v { visibility: hidden; }
|
||||
|
||||
@@ -628,12 +628,15 @@
|
||||
// ── 수동 입력(설정에서 켠 쇼핑몰) — 날짜 칸을 눌러 총매출 입력. Enter 저장 후 아래 칸 · Shift+Enter 위 칸 · Esc 취소.
|
||||
// 비우고 저장하면 그날은 다시 API 값. 저장은 칸마다 차례로, 입력을 마치면(다른 칸으로 안 넘어가면) 새로고침해
|
||||
// 합계·수수료·그래프를 서버 계산으로 다시 그린다.
|
||||
// 엑셀처럼 계산식도 됨(= 없이 1000+2000, + - * / 괄호) — 서버가 계산해 금액과 식을 저장(formula.parse_amount),
|
||||
// 식으로 넣은 칸은 is-formula(파랑 굵게)이고 다시 누르면 식이 보인다.
|
||||
let manualDirty = false;
|
||||
let manualChain = Promise.resolve();
|
||||
function manualCells(code) {
|
||||
return Array.prototype.slice.call(root.querySelectorAll('td.is-manual-cell[data-manual-code="' + code + '"]'));
|
||||
}
|
||||
function digitsOf(td) { return td.dataset.manualValue || ""; }
|
||||
function inputOf(td) { return td.dataset.formula || digitsOf(td); } // 편집 칸에 보일 값(식이 있으면 식)
|
||||
function finishManual() {
|
||||
setTimeout(function () {
|
||||
if (root.querySelector(".perf-manual-input")) return; // 다른 칸으로 넘어감
|
||||
@@ -641,21 +644,25 @@
|
||||
}, 120);
|
||||
}
|
||||
function saveManual(td, text) {
|
||||
const raw = String(text || "").replace(/[,\s원]/g, "");
|
||||
const was = digitsOf(td);
|
||||
if (raw !== "" && !/^-?\d+$/.test(raw)) return Promise.reject(new Error("숫자(원)만 입력하세요."));
|
||||
if (raw === was) return Promise.resolve(false); // 바뀐 것 없음(빈 칸 그대로 포함)
|
||||
const raw = String(text || "").replace(/[,\s원]/g, "").replace(/^=/, "");
|
||||
if (raw !== "" && !/^[-+*/().\d×÷xX]+$/.test(raw)) {
|
||||
return Promise.reject(new Error("숫자 또는 1000+2000 같은 계산식만 입력하세요."));
|
||||
}
|
||||
if (raw === inputOf(td)) return Promise.resolve(false); // 바뀐 것 없음(빈 칸 그대로 포함)
|
||||
const job = manualChain.then(function () {
|
||||
return api("PUT", MANUAL_API + encodeURIComponent(td.dataset.manualCode) + "/" +
|
||||
encodeURIComponent(td.dataset.date), { amount: raw === "" ? null : Number(raw) });
|
||||
encodeURIComponent(td.dataset.date), { amount: raw === "" ? null : raw });
|
||||
}).then(function (res) {
|
||||
const manual = res.manual == null ? "" : String(res.manual);
|
||||
td.dataset.manualValue = manual;
|
||||
if (res.formula) td.dataset.formula = res.formula; else delete td.dataset.formula;
|
||||
td.classList.toggle("is-manual", manual !== "");
|
||||
td.classList.remove("is-upload");
|
||||
td.classList.toggle("is-formula", !!res.formula);
|
||||
td.classList.remove("is-upload", "is-api");
|
||||
const ro = td.querySelector(".perf-roas"); // 광고비가 바뀌면 ROAS 는 새로고침 때 다시 계산
|
||||
if (ro) ro.remove();
|
||||
td.title = manual !== "" ? "직접 입력값 — 눌러 고치기(비우고 저장하면 " + (FIXED_METRIC ? "지움" : "API 값") + ")"
|
||||
td.title = res.formula ? "계산식 " + res.formula + " — 눌러 고치기"
|
||||
: manual !== "" ? "직접 입력값 — 눌러 고치기(비우고 저장하면 " + (FIXED_METRIC ? "지움" : "API 값") + ")"
|
||||
: "눌러 " + MANUAL_WORD + " 직접 입력";
|
||||
const g = td.querySelector(".v-gross");
|
||||
if (g) g.innerHTML = unitWon(res.amount, data.unit);
|
||||
@@ -668,9 +675,9 @@
|
||||
}
|
||||
function editManual(td) {
|
||||
if (td.querySelector(".perf-manual-input")) return;
|
||||
const input = el("input", { type: "text", inputmode: "numeric", class: "perf-manual-input",
|
||||
const input = el("input", { type: "text", class: "perf-manual-input",
|
||||
"aria-label": ((data.names || {})[td.dataset.manualCode] || "") + " " + td.dataset.date + " " + MANUAL_WORD });
|
||||
input.value = digitsOf(td);
|
||||
input.value = inputOf(td);
|
||||
const g = td.querySelector(".v-gross");
|
||||
input.placeholder = digitsOf(td) ? "" : (g ? g.textContent.trim().replace(/[–-]/, "") : "") || MANUAL_WORD;
|
||||
td.classList.add("is-editing");
|
||||
|
||||
Reference in New Issue
Block a user