feat(cupang): 출고리스트 작성 팝업 — 입고센터별 카드 배경색
센터를 고르면 카드 배경·왼쪽 띠·제목 색이 센터마다 달라진다(팝업에 나온 순서대로 8색, 같은 센터는 같은 색, 미선택은 회색). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,7 @@
|
||||
(`PJLib.enhanceDateInput`, project.js 를 `PJ_LIB_ONLY` 로 로드).
|
||||
- **입고센터 카드**(`#cpg-ol-center-tpl`, [+ 입고센터 추가]·[센터 삭제], 최대 20곳): 센터마다 입고센터(시트 F열 + 등록 센터, 직접 입력 가능),
|
||||
출고방식(**기본 택배**/파렛트), 제품(코드표 `GET /cupang/api/products/all` 검색 → 코드·이름 자동, 수량 수기), 출고(수기).
|
||||
카드 배경색은 센터마다 다르다(JS `recolor` → `data-tone` 0~7, 팝업에 나온 순서대로 배정·같은 센터는 같은 색·미선택은 회색, 색은 cupang.css).
|
||||
- `POST /cupang/api/outbound-sheet` 본문 `{document_date, ship_date, center_arrival_date, worker, centers: [{center, ship_method, outbound, lines}]}`
|
||||
(`centers` 없으면 본문 자체가 센터 1곳 — `_clean_outbound_entries`). 센터 순서대로 시트 `YYYYMMDD(요일)`(출고일) 맨 아래에
|
||||
`export.build_block` 으로 덧붙임(순번 B열 이어짐, 파렛트 센터만 배경색). 시트가 없거나 5행 머리글이 없으면 첫 센터는 양식째 새로 쓴다(`write_table`).
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{# 출고리스트 작성 팝업의 날짜 칸은 프로젝트 화면의 날짜 팝업을 그대로 쓴다 — project.js 는 PJ_LIB_ONLY 로 부품만 #}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261022a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<link rel="stylesheet" href="/static/cupang.css?v=20261023c" />
|
||||
<link rel="stylesheet" href="/static/cupang.css?v=20261023d" />
|
||||
<script>window.PJ_LIB_ONLY = true; window.PJ_HOLIDAYS = {{ (pj_kr_holidays or {}) | tojson }};</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
|
||||
{% block scripts %}
|
||||
<script src="/static/project.js?v=20261022c" defer></script>
|
||||
<script src="/static/cupang-outbound.js?v=20261023c" defer></script>
|
||||
<script src="/static/cupang-outbound.js?v=20261023d" defer></script>
|
||||
<script>
|
||||
(function () {
|
||||
var dlg = document.getElementById("cpg-del-dlg");
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
- 날짜 칸: 프로젝트 화면의 날짜 팝업(window.PJLib.enhanceDateInput)을 그대로 쓴다.
|
||||
- 입고센터 카드: 하루에 센터가 여럿일 수 있어 센터마다 출고방식(기본 택배)·제품·출고를 따로 입력한다
|
||||
(#cpg-ol-center-tpl 템플릿, [+ 입고센터 추가]). 작성일·출고일·센터입고일·작업자는 공통.
|
||||
카드 배경색은 센터마다 다르다(recolor — 같은 센터는 같은 색, 미선택은 회색).
|
||||
- 입고센터 후보: 출고리스트 엑셀(구글 드라이브 .xlsx)에 적힌 센터 + 설정에 등록된 센터(GET /cupang/api/outbound-sheet/centers).
|
||||
- 제품: 코드표(itemcode_db) 전체 목록(GET /cupang/api/products/all)에서 코드·이름으로 찾아 추가.
|
||||
- [완료] → POST /cupang/api/outbound-sheet?stream=1 → 서버가 단계별 진행률을 한 줄씩(NDJSON) 보내면 막대·%로 표시,
|
||||
@@ -108,6 +109,23 @@
|
||||
c.no.textContent = "입고센터 " + (i + 1);
|
||||
c.del.hidden = cardList.length < 2;
|
||||
});
|
||||
recolor();
|
||||
}
|
||||
|
||||
// 센터마다 카드 배경색(data-tone 0~7, cupang.css) — 팝업에 나온 순서대로 배정해 다른 센터끼리 겹치지 않게,
|
||||
// 같은 센터를 두 카드에서 고르면 같은 색, 아직 안 고른 카드는 회색(data-tone 없음).
|
||||
var TONES = 8;
|
||||
function centerOf(c) {
|
||||
return c.centerSel.value === NEW_CENTER ? c.centerNew.value.trim() : c.centerSel.value;
|
||||
}
|
||||
function recolor() {
|
||||
var order = [];
|
||||
cardList.forEach(function (c) {
|
||||
var name = centerOf(c);
|
||||
if (!name) { delete c.el.dataset.tone; return; }
|
||||
if (order.indexOf(name) < 0) order.push(name);
|
||||
c.el.dataset.tone = String(order.indexOf(name) % TONES);
|
||||
});
|
||||
}
|
||||
|
||||
function createCard() {
|
||||
@@ -145,11 +163,14 @@
|
||||
add(NEW_CENTER, "+ 직접 입력");
|
||||
if (keep && (keep === NEW_CENTER || centerNames.indexOf(keep) >= 0)) sel.value = keep;
|
||||
card.centerCustom.hidden = sel.value !== NEW_CENTER;
|
||||
recolor();
|
||||
};
|
||||
card.centerSel.addEventListener("change", function () {
|
||||
card.centerCustom.hidden = card.centerSel.value !== NEW_CENTER;
|
||||
if (!card.centerCustom.hidden) card.centerNew.focus();
|
||||
recolor();
|
||||
});
|
||||
card.centerNew.addEventListener("input", recolor);
|
||||
|
||||
// 제품 검색(코드표)
|
||||
var hits = [], activeHit = -1;
|
||||
@@ -261,7 +282,7 @@
|
||||
|
||||
card.collect = function (no) {
|
||||
var label = cardList.length > 1 ? "입고센터 " + no + ": " : "";
|
||||
var center = card.centerSel.value === NEW_CENTER ? card.centerNew.value.trim() : card.centerSel.value;
|
||||
var center = centerOf(card);
|
||||
var lines = Array.prototype.map.call(card.linesBody.children, function (tr) {
|
||||
return { code: tr.dataset.code, name: tr.dataset.name, quantity: tr.querySelector(".cpg-ol-qty").value };
|
||||
});
|
||||
|
||||
+13
-2
@@ -1651,11 +1651,22 @@ a.cpg-boxno-dl:hover { background: #1a5c38; border-color: #1a5c38; font-weight:
|
||||
/* 입고센터 카드 — 센터마다 출고방식·제품·출고 */
|
||||
.cpg-ol-centers { display: flex; flex-direction: column; gap: 10px; }
|
||||
.cpg-ol-center {
|
||||
--ol-bg: #f6f7f8; --ol-line: var(--color-subtle-ash); --ol-ink: var(--color-midtone-gray);
|
||||
display: flex; flex-direction: column; gap: 10px; padding: 12px;
|
||||
border: 1px solid var(--color-subtle-ash); border-radius: 10px; background: #f7faf8;
|
||||
border: 1px solid var(--ol-line); border-left: 4px solid var(--ol-line); border-radius: 10px; background: var(--ol-bg);
|
||||
transition: background-color .15s, border-color .15s;
|
||||
}
|
||||
/* 입고센터마다 다른 색(cupang-outbound.js 가 팝업에 나온 순서대로 data-tone 0~7, 같은 센터는 같은 색, 미선택은 회색) */
|
||||
.cpg-ol-center[data-tone="0"] { --ol-bg: #eef7f1; --ol-line: #9fd0b1; --ol-ink: #217346; }
|
||||
.cpg-ol-center[data-tone="1"] { --ol-bg: #eef4fc; --ol-line: #a8c4ec; --ol-ink: #1f5fae; }
|
||||
.cpg-ol-center[data-tone="2"] { --ol-bg: #fdf3e8; --ol-line: #efc595; --ol-ink: #a8590f; }
|
||||
.cpg-ol-center[data-tone="3"] { --ol-bg: #f4effb; --ol-line: #cbb6ec; --ol-ink: #6b3fb0; }
|
||||
.cpg-ol-center[data-tone="4"] { --ol-bg: #eaf7f7; --ol-line: #99d3d3; --ol-ink: #137a7a; }
|
||||
.cpg-ol-center[data-tone="5"] { --ol-bg: #fceef3; --ol-line: #ecb2c8; --ol-ink: #b0306a; }
|
||||
.cpg-ol-center[data-tone="6"] { --ol-bg: #fbf7e3; --ol-line: #e0cf7c; --ol-ink: #806a00; }
|
||||
.cpg-ol-center[data-tone="7"] { --ol-bg: #eff1f4; --ol-line: #b9c1cc; --ol-ink: #3f4a5a; }
|
||||
.cpg-ol-center-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
||||
.cpg-ol-center-no { font-size: 14px; color: #217346; }
|
||||
.cpg-ol-center-no { font-size: 14px; color: var(--ol-ink); }
|
||||
.cpg-ol-center-del[hidden] { display: none; }
|
||||
.cpg-ol-add-center { align-self: flex-start; }
|
||||
/* 완료 진행 막대 */
|
||||
|
||||
@@ -91,6 +91,10 @@ async function pickDate(page, inputId, typed) {
|
||||
await pop.waitFor({ state: "detached" });
|
||||
}
|
||||
|
||||
const tone = card => card.evaluate(el => el.dataset.tone || null);
|
||||
// 배경색은 .15s 전환이 끝난 뒤에 읽는다
|
||||
const bg = card => card.page().waitForTimeout(250).then(() => card.evaluate(el => getComputedStyle(el).backgroundColor));
|
||||
|
||||
async function addProduct(card, text, qty) {
|
||||
await card.locator(".cpg-ol-search-input").fill(text);
|
||||
await card.locator(".cpg-ol-search-input").press("Enter");
|
||||
@@ -149,7 +153,11 @@ async function addProduct(card, text, qty) {
|
||||
// 첫 센터: 필수값 확인 → 인천32 파렛트, 제품 2개
|
||||
await page.locator("#cpg-ol-submit").click();
|
||||
assert.equal(await page.locator("#cpg-ol-error").innerText(), "입고센터를 선택해 주세요.");
|
||||
assert.equal(await tone(c1), null, "센터를 고르기 전엔 회색");
|
||||
const grayBg = await bg(c1);
|
||||
await c1.locator(".cpg-ol-center-sel").selectOption("인천32");
|
||||
assert.equal(await tone(c1), "0");
|
||||
assert.notEqual(await bg(c1), grayBg, "센터를 고르면 색이 생김");
|
||||
await page.locator("#cpg-ol-submit").click();
|
||||
assert.equal(await page.locator("#cpg-ol-error").innerText(), "제품을 1개 이상 추가해 주세요.");
|
||||
assert.ok(!(await c1.locator(".cpg-ol-lines").isVisible()), "제품이 없으면 표를 숨김");
|
||||
@@ -176,6 +184,8 @@ async function addProduct(card, text, qty) {
|
||||
assert.equal(await page.locator("#cpg-ol-error").innerText(), "입고센터 2: 입고센터를 선택해 주세요.");
|
||||
await c2.locator(".cpg-ol-center-sel").selectOption("__new__");
|
||||
await c2.locator(".cpg-ol-center-new").fill("이천1");
|
||||
assert.equal(await tone(c2), "1");
|
||||
assert.notEqual(await bg(c2), await bg(c1), "다른 센터는 다른 배경색");
|
||||
await addProduct(c2, "중형", 30);
|
||||
// 3번 카드를 만든 뒤 가운데(이천1) 카드를 지우면 번호가 다시 매겨진다
|
||||
await page.locator("#cpg-ol-add-center").click();
|
||||
@@ -185,7 +195,12 @@ async function addProduct(card, text, qty) {
|
||||
const c2b = cards.nth(1);
|
||||
assert.equal(await c2b.locator(".cpg-ol-center-no").innerText(), "입고센터 2");
|
||||
assert.equal(await c2b.locator(".cpg-ol-lines tbody tr").count(), 0, "지운 카드의 제품은 따라오지 않음");
|
||||
assert.equal(await tone(c2b), null);
|
||||
await c2b.locator(".cpg-ol-center-sel").selectOption("인천32");
|
||||
assert.equal(await bg(c2b), await bg(c1), "같은 센터는 같은 배경색");
|
||||
await c2b.locator(".cpg-ol-center-sel").selectOption("대구3");
|
||||
assert.equal(await tone(c2b), "1");
|
||||
assert.notEqual(await bg(c2b), await bg(c1));
|
||||
await addProduct(c2b, "중형", 30);
|
||||
await page.screenshot({ path: path.join(OUT, "cupang-outbound-dialog.png"), fullPage: true });
|
||||
|
||||
@@ -275,7 +290,7 @@ async function addProduct(card, text, qty) {
|
||||
await page.screenshot({ path: path.join(OUT, "cupang-outbound-mobile.png") });
|
||||
|
||||
assert.deepEqual(errors, [], "브라우저 JS 오류 없음");
|
||||
console.log("ALL PASS — 버튼, 날짜 팝업, 입고센터 카드(추가·삭제·번호·기본 택배), 코드표 검색, 진행 막대·%, 완료·실패, Esc, 모바일");
|
||||
console.log("ALL PASS — 버튼, 날짜 팝업, 입고센터 카드(추가·삭제·번호·기본 택배·센터별 색), 코드표 검색, 진행 막대·%, 완료·실패, Esc, 모바일");
|
||||
} finally {
|
||||
if (browser) await browser.close();
|
||||
await new Promise(resolve => server.close(resolve));
|
||||
|
||||
Reference in New Issue
Block a user