@@ -76,7 +76,7 @@
-
+
@@ -84,7 +84,8 @@
- | # | 제품명 | 제품코드 | 수량 |
+ |
+ 제품명 | 제품코드 | 수량 |
입수량 | 박스 계산 | 라인메모 |
@@ -118,4 +119,4 @@
{% endblock %}
-{% block scripts %}{% endblock %}
+{% block scripts %}{% endblock %}
diff --git a/app/modules/cupang/templates/cupang/index.html b/app/modules/cupang/templates/cupang/index.html
index def967f..768c532 100644
--- a/app/modules/cupang/templates/cupang/index.html
+++ b/app/modules/cupang/templates/cupang/index.html
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
-{% block head_extra %}{% endblock %}
+{% block head_extra %}{% endblock %}
{% block content %}
diff --git a/app/modules/cupang/templates/cupang/products.html b/app/modules/cupang/templates/cupang/products.html
index fe71f1f..a51da1c 100644
--- a/app/modules/cupang/templates/cupang/products.html
+++ b/app/modules/cupang/templates/cupang/products.html
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
-{% block head_extra %}{% endblock %}
+{% block head_extra %}{% endblock %}
{% block content %}
diff --git a/app/static/cupang.css b/app/static/cupang.css
index c83d52b..236b757 100644
--- a/app/static/cupang.css
+++ b/app/static/cupang.css
@@ -174,6 +174,8 @@
/* ── 라인 테이블 ── */
.cpg-lines td { vertical-align: middle; }
+.cpg-check-col { width: 36px; text-align: center; }
+.cpg-check-col input { cursor: pointer; }
.cpg-lines .cpg-name-sel { width: 100%; min-width: 160px; }
/* 폭 고정: 제품코드 140px, 수량·입수량 60px */
.cpg-lines .cpg-code { width: 140px; min-width: 140px; box-sizing: border-box; }
diff --git a/app/static/cupang.js b/app/static/cupang.js
index f313f5e..5a03e5f 100644
--- a/app/static/cupang.js
+++ b/app/static/cupang.js
@@ -67,9 +67,9 @@
function makeRow(data) {
data = data || {};
var tr = document.createElement("tr");
- // 컬럼: # / 제품명(select) / 제품코드 / 수량 / 입수량 / 박스계산 / 라인메모 / 삭제
+ // 컬럼: 체크 / 제품명(select) / 제품코드 / 수량 / 입수량 / 박스계산 / 라인메모
tr.innerHTML =
- ' | ' +
+ ' | ' +
' | ' +
' | ' +
' | ' +
@@ -108,27 +108,49 @@
body.appendChild(tr);
recalc(tr);
- renumber();
+ syncCheckAll();
return tr;
}
- function renumber() {
- Array.prototype.forEach.call(body.querySelectorAll("tr"), function (tr, i) {
- tr.querySelector(".cpg-line-no").textContent = i + 1;
+ // 전체 선택 체크박스 상태 동기화
+ var checkAll = document.getElementById("cpg-check-all");
+ function syncCheckAll() {
+ if (!checkAll) return;
+ var checks = body.querySelectorAll(".cpg-row-check");
+ var total = checks.length;
+ var on = 0;
+ Array.prototype.forEach.call(checks, function (c) { if (c.checked) on++; });
+ checkAll.checked = total > 0 && on === total;
+ checkAll.indeterminate = on > 0 && on < total;
+ }
+ if (checkAll) {
+ checkAll.addEventListener("change", function () {
+ Array.prototype.forEach.call(body.querySelectorAll(".cpg-row-check"), function (c) {
+ c.checked = checkAll.checked;
+ });
});
}
+ body.addEventListener("change", function (e) {
+ if (e.target && e.target.classList.contains("cpg-row-check")) syncCheckAll();
+ });
// 초기 라인
if (initLines.length) { initLines.forEach(makeRow); } else { makeRow(); }
document.getElementById("cpg-add-line").addEventListener("click", function () { makeRow(); });
- // 마지막 라인 삭제 (최소 1줄 유지)
+
+ // 선택 라인 삭제 (체크된 행 삭제, 최소 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();
+ var checked = body.querySelectorAll(".cpg-row-check:checked");
+ if (!checked.length) { alert("삭제할 라인을 선택하세요."); return; }
+ Array.prototype.forEach.call(checked, function (c) {
+ var tr = c.closest("tr");
+ if (tr) tr.remove();
+ });
+ if (!body.querySelectorAll("tr").length) makeRow(); // 최소 1줄
+ if (checkAll) { checkAll.checked = false; checkAll.indeterminate = false; }
+ syncCheckAll();
});
}
diff --git a/app/templates/erp_base.html b/app/templates/erp_base.html
index 4532087..915b2fd 100644
--- a/app/templates/erp_base.html
+++ b/app/templates/erp_base.html
@@ -4,8 +4,8 @@
{{ page_title or "ERP" }} — DBX Corporation
-
-
+
+
{% block head_extra %}{% endblock %}