style(malaysia): 입수량·박스 한 줄 + 칸 합계 제거
- 입수량/박스 입력을 한 줄로(.rk-line) - 칸 ∑ 합계 제거 — 서로 다른 상품을 합산해 의미 없음(입력·랙보기 양쪽) - 상품별 행 소계(합계)는 유지(개별 SKU 기준 유효) - malaysia_rack.js: 칸 합계 로직 삭제, 행 소계만 갱신 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
font-size:11px; font-weight:600; color:#475569; margin-bottom:4px;
|
||||
border-bottom:1px solid #e2e8f0; padding-bottom:3px;
|
||||
}
|
||||
.rv-cell-head .rv-total { color:#0f172a; white-space:nowrap; }
|
||||
.rv-items { display:flex; flex-direction:column; gap:3px; }
|
||||
.rv-item { font-size:11px; line-height:1.25; }
|
||||
.rv-item .rv-name { font-weight:600; color:#0f172a; }
|
||||
@@ -56,12 +55,9 @@
|
||||
{% for col in row.cols %}
|
||||
{% for cell in col %}
|
||||
{% set entries = rack_by_cell.get(cell, []) %}
|
||||
{% set ns = namespace(total=0) %}
|
||||
{% for e in entries %}{% set ns.total = ns.total + e.total %}{% endfor %}
|
||||
<div class="rv-cell {% if not entries %}is-empty{% endif %}">
|
||||
<div class="rv-cell-head">
|
||||
<span>{{ cell }}</span>
|
||||
<span class="rv-total">∑ {{ "{:,}".format(ns.total) }}</span>
|
||||
</div>
|
||||
<div class="rv-items">
|
||||
{% for e in entries %}
|
||||
|
||||
@@ -9,12 +9,14 @@
|
||||
<option value="{{ it.item_code }}" {% if entry and entry.sku_code == it.item_code %}selected{% endif %}>{{ it.item_name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="rk-line">
|
||||
<label class="rk-f"><span>입수량</span>
|
||||
<input class="erp-input rk-upb" type="number" min="1" name="rk_upb"
|
||||
value="{{ entry.units_per_box if entry else '' }}" {% if disabled %}disabled{% endif %} /></label>
|
||||
<label class="rk-f"><span>박스</span>
|
||||
<input class="erp-input rk-box" type="number" min="1" name="rk_box"
|
||||
value="{{ entry.box_count if entry else '' }}" {% if disabled %}disabled{% endif %} /></label>
|
||||
</div>
|
||||
<div class="rk-foot">
|
||||
<span><span class="i18n">합계</span> <b class="rk-sub">{{ "{:,}".format(entry.units_per_box * entry.box_count) if entry else 0 }}</b></span>
|
||||
{% if not disabled %}<button type="button" class="rk-del" title="행 삭제">× <span class="i18n">삭제</span></button>{% endif %}
|
||||
@@ -52,7 +54,6 @@
|
||||
display:flex; align-items:center; gap:4px; justify-content:space-between;
|
||||
font-size:11px; font-weight:600; color:#475569; margin-bottom:4px;
|
||||
}
|
||||
.rack-cell-head .rk-cell-total { color:#0f172a; white-space:nowrap; }
|
||||
.rack-cell-head .rk-add {
|
||||
border:1px solid #94a3b8; background:#fff; border-radius:4px;
|
||||
width:20px; height:20px; line-height:1; padding:0; cursor:pointer; font-weight:700; flex:0 0 auto;
|
||||
@@ -64,8 +65,9 @@
|
||||
border:1px solid #e2e8f0; border-radius:5px; background:#fff; padding:4px;
|
||||
}
|
||||
.rk-row .rk-sku { font-size:12px; padding:2px 4px; width:100%; min-width:0; }
|
||||
.rk-row .rk-f { display:flex; align-items:center; gap:4px; font-size:11px; margin:0; }
|
||||
.rk-row .rk-f > span { flex:0 0 38px; color:#64748b; }
|
||||
.rk-row .rk-line { display:flex; gap:6px; }
|
||||
.rk-row .rk-f { display:flex; align-items:center; gap:3px; font-size:11px; margin:0; flex:1 1 0; min-width:0; }
|
||||
.rk-row .rk-f > span { flex:0 0 auto; color:#64748b; }
|
||||
.rk-row .rk-upb, .rk-row .rk-box {
|
||||
flex:1 1 auto; min-width:0; font-size:12px; padding:2px 4px; text-align:right;
|
||||
}
|
||||
@@ -119,7 +121,6 @@
|
||||
<div class="rack-cell" data-cell="{{ cell }}">
|
||||
<div class="rack-cell-head">
|
||||
<span>{{ cell }}</span>
|
||||
<span class="rk-cell-total">∑ <b class="rk-cell-total-v">0</b></span>
|
||||
{% if is_draft %}<button type="button" class="rk-add" title="아이템 추가">+</button>{% endif %}
|
||||
</div>
|
||||
<div class="rk-rows">
|
||||
@@ -193,5 +194,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script src="/static/malaysia_rack.js?v=20260614b"></script>
|
||||
<script src="/static/malaysia_rack.js?v=20260614c"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* - 칸(.rack-cell) 헤더의 + 버튼: 빈 입력행을 칸에 추가(템플릿 #rk-row-tpl 클론).
|
||||
* 클론 시 숨김필드 rk_cell 에 해당 칸 코드를 채워 서버 병렬배열과 정렬.
|
||||
* - 행의 × 버튼: 그 행 제거(칸에 행이 0개여도 무방 — 서버가 빈 칸 스킵).
|
||||
* - 입수량/박스수 입력 시 행 소계(rk-sub)와 칸 합계(rk-cell-total-v) 실시간 갱신.
|
||||
* - 입수량/박스수 입력 시 행 소계(rk-sub)만 실시간 갱신.
|
||||
* (칸 합계는 서로 다른 상품을 더하게 되어 의미 없으므로 표시하지 않음.)
|
||||
* 저장은 폼 제출(서버에서 SKU별 집계 → 재고조사 라인 재생성).
|
||||
*/
|
||||
(function () {
|
||||
@@ -25,29 +26,16 @@
|
||||
if (sub) sub.textContent = comma(upb * box);
|
||||
}
|
||||
|
||||
function recalcCell(cell) {
|
||||
var total = 0;
|
||||
cell.querySelectorAll(".rk-row").forEach(function (row) {
|
||||
total += num(row.querySelector(".rk-upb")) * num(row.querySelector(".rk-box"));
|
||||
});
|
||||
var out = cell.querySelector(".rk-cell-total-v");
|
||||
if (out) out.textContent = comma(total);
|
||||
}
|
||||
|
||||
function wireRow(row) {
|
||||
row.querySelectorAll(".rk-upb, .rk-box").forEach(function (inp) {
|
||||
inp.addEventListener("input", function () {
|
||||
recalcRow(row);
|
||||
var cell = row.closest(".rack-cell");
|
||||
if (cell) recalcCell(cell);
|
||||
});
|
||||
});
|
||||
var del = row.querySelector(".rk-del");
|
||||
if (del) {
|
||||
del.addEventListener("click", function () {
|
||||
var cell = row.closest(".rack-cell");
|
||||
row.remove();
|
||||
if (cell) recalcCell(cell);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -71,7 +59,6 @@
|
||||
wireRow(row);
|
||||
recalcRow(row);
|
||||
});
|
||||
document.querySelectorAll(".rack-cell").forEach(recalcCell);
|
||||
document.querySelectorAll(".rack-cell .rk-add").forEach(function (btn) {
|
||||
btn.addEventListener("click", function () {
|
||||
var cell = btn.closest(".rack-cell");
|
||||
|
||||
Reference in New Issue
Block a user