diff --git a/app/modules/cupang/templates/cupang/form.html b/app/modules/cupang/templates/cupang/form.html index 0353798..320145d 100644 --- a/app/modules/cupang/templates/cupang/form.html +++ b/app/modules/cupang/templates/cupang/form.html @@ -76,18 +76,21 @@ -
+
- +
#제품명제품코드수량입수량박스 계산라인메모입수량박스 계산라인메모
- +
+ + +
diff --git a/app/static/cupang.css b/app/static/cupang.css index 1d654bf..686ea14 100644 --- a/app/static/cupang.css +++ b/app/static/cupang.css @@ -75,17 +75,28 @@ .cpg-form-2col { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; } -.cpg-form-head { flex: 1 1 380px; min-width: 0; margin-bottom: 0; } -.cpg-form-lines { flex: 1 1 520px; min-width: 0; margin-bottom: 0; } -@media (max-width: 900px) { - .cpg-form-head, .cpg-form-lines { flex-basis: 100%; } +/* 공통 헤더: 너비 450 고정 */ +.cpg-form-head { flex: 0 0 450px; width: 450px; min-width: 0; margin-bottom: 0; } +/* 품목 라인: 900x900 고정, 내부 스크롤 */ +.cpg-form-lines { + flex: 0 0 900px; width: 900px; height: 900px; min-width: 0; margin-bottom: 0; + display: flex; flex-direction: column; overflow: hidden; } -/* 저장/취소 — 공통 헤더 카드 하단에 위치(우측 라인 수와 무관) */ -.cpg-form-actions { - margin-top: 16px; +@media (max-width: 1400px) { + .cpg-form-lines { flex-basis: auto; width: 100%; } +} +@media (max-width: 940px) { + .cpg-form-head { flex-basis: 100%; width: 100%; } +} +/* 라인 테이블 영역만 스크롤 (footer 는 하단 고정) */ +.cpg-lines-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; } +.cpg-lines-foot { + display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; - border-top: 1px solid var(--color-subtle-ash); } + +/* 저장/취소 — 공통 헤더 카드 하단에 위치(우측 라인 수와 무관) */ +.cpg-form-actions { margin-top: 16px; } .cpg-card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; } .cpg-card-head h2 { font-size: 16px; font-weight: 600; margin: 0; } diff --git a/app/static/cupang.js b/app/static/cupang.js index 4655df1..f313f5e 100644 --- a/app/static/cupang.js +++ b/app/static/cupang.js @@ -75,8 +75,7 @@ '' + '' + '' + - '' + - ''; + ''; var code = data.product_code || ""; var nameSel = buildNameSelect(code); @@ -104,7 +103,6 @@ } }); - tr.querySelector(".cpg-line-del").addEventListener("click", function () { tr.remove(); renumber(); }); tr.querySelector(".cpg-qty").addEventListener("input", function () { recalc(tr); }); tr.querySelector(".cpg-upb").addEventListener("input", function () { recalc(tr); }); @@ -123,6 +121,16 @@ // 초기 라인 if (initLines.length) { initLines.forEach(makeRow); } else { makeRow(); } document.getElementById("cpg-add-line").addEventListener("click", function () { makeRow(); }); + // 마지막 라인 삭제 (최소 1줄 유지) + var delBtn = document.getElementById("cpg-del-line"); + if (delBtn) { + delBtn.addEventListener("click", function () { + var rows = body.querySelectorAll("tr"); + if (rows.length <= 1) { alert("최소 1개 라인은 필요합니다."); return; } + rows[rows.length - 1].remove(); + renumber(); + }); + } // 제출: 라인 직렬화 form.addEventListener("submit", function (e) {