' + esc(m.box_name) + " 혼합 #" + (i + 1) +
+ '
' + esc(mixTypeOf(key)) + " 혼합 #" + (i + 1) +
(remain ? "" : stampHtml(key)) + "
" +
+ '
' + mixTypeSelect(key) + "
" +
'
" +
'
' +
'
' + b.fill_percent + "% 채움 · " + units[key] + "개
" +
@@ -1001,6 +1028,7 @@
sumBody.addEventListener("mousedown", function (e) {
if (e.button !== 0) return;
+ if (e.target.closest(".cpg-box-type")) return; // 상자 종류 고르는 중
var card = e.target.closest("[data-key]");
if (!card || card.classList.contains("is-done")) return;
drag = { key: card.getAttribute("data-key"), card: card, startX: e.clientX, startY: e.clientY, moved: false, ghost: null };
@@ -1032,12 +1060,29 @@
// 드래그하지 않고 클릭한 경우 — 첫 센터를 기본값으로 대화상자를 연다.
// (드래그를 끝낸 카드에서 브라우저가 한 번 더 쏘는 click 은 1회만 무시)
sumBody.addEventListener("click", function (e) {
+ if (e.target.closest(".cpg-box-type")) return; // 상자 종류 고르는 중
var card = e.target.closest("[data-key]");
if (!card) return;
if (card === suppressClickOn) { suppressClickOn = null; return; }
openDialog(card.getAttribute("data-key"), openCenters[0]);
});
+ // 상자 종류 변경 — 라벨(②③)만 바뀌고 배분 수량은 그대로 유지된다.
+ sumBody.addEventListener("change", function (e) {
+ var sel = e.target.closest(".cpg-box-type");
+ if (!sel) return;
+ var key = sel.getAttribute("data-type-for");
+ mixType[key] = sel.value;
+ calc.mixes.forEach(function (m) {
+ m.boxes.forEach(function (b, i) {
+ var k = mixKey(m.box_name, i);
+ if (k === key) labels[k] = mixLabel(k, i);
+ });
+ });
+ render();
+ msg.textContent = "상자 종류를 " + sel.value + " 로 바꿨습니다.";
+ });
+
if (distList) {
distList.addEventListener("input", function (e) {
if (!e.target.classList.contains("cpg-dist-qty")) return;
@@ -1367,7 +1412,8 @@
alloc: alloc,
methods: methods,
stamped: stamped,
- allStamped: allStamped
+ allStamped: allStamped,
+ mixType: mixType
};
}
@@ -1391,6 +1437,17 @@
methods = snap.methods && typeof snap.methods === "object" ? snap.methods : {};
stamped = snap.stamped && typeof snap.stamped === "object" ? snap.stamped : {};
allStamped = !!snap.allStamped;
+ if (snap.mixType && typeof snap.mixType === "object") {
+ Object.keys(snap.mixType).forEach(function (k) {
+ if (k in units) mixType[k] = snap.mixType[k];
+ });
+ calc.mixes.forEach(function (m) {
+ m.boxes.forEach(function (b, i) {
+ var k = mixKey(m.box_name, i);
+ labels[k] = mixLabel(k, i);
+ });
+ });
+ }
return skipped;
}
diff --git a/app/modules/cupang/templates/cupang/box_rules.html b/app/modules/cupang/templates/cupang/box_rules.html
index 7703d05..43ce413 100644
--- a/app/modules/cupang/templates/cupang/box_rules.html
+++ b/app/modules/cupang/templates/cupang/box_rules.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/centers.html b/app/modules/cupang/templates/cupang/centers.html
index aaf034b..8bdd4dc 100644
--- a/app/modules/cupang/templates/cupang/centers.html
+++ b/app/modules/cupang/templates/cupang/centers.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/detail.html b/app/modules/cupang/templates/cupang/detail.html
index 7be3f8d..37b0d56 100644
--- a/app/modules/cupang/templates/cupang/detail.html
+++ b/app/modules/cupang/templates/cupang/detail.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/form.html b/app/modules/cupang/templates/cupang/form.html
index 675582d..227dc06 100644
--- a/app/modules/cupang/templates/cupang/form.html
+++ b/app/modules/cupang/templates/cupang/form.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/index.html b/app/modules/cupang/templates/cupang/index.html
index cdf93f4..31c5c39 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 9a917f2..8607ded 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 c155254..5b42ca0 100644
--- a/app/static/cupang.css
+++ b/app/static/cupang.css
@@ -1335,3 +1335,11 @@ body.cpg-dragging { cursor: grabbing; user-select: none; }
}
.cpg-po-dates > li > b { font-family: var(--font-geist-mono); }
.cpg-po-dates > li > span { color: var(--color-midtone-gray); }
+
+/* 자투리 혼합 박스 — 상자 종류 선택 */
+.cpg-box-typerow { margin: 2px 0 6px; }
+.cpg-box-type {
+ width: auto; min-width: 108px;
+ padding: 2px 8px; font-size: 12px; line-height: 1.6;
+ cursor: pointer;
+}