feat(malaysia): 재고현황 조사수량·차이 표기, 확정 관리자 제한, 슈퍼관리자 조사삭제

- 재고현황 헤더 "전산 재고 현황", Last Stocktake 옆 조사수량+차이(±) 표기
  (차이 = 마지막 재고조사 낱개 total − 전산재고)
- 재고조사 확정(전산 반영)은 관리자(is_admin)만 가능, 비관리자 안내
- 슈퍼관리자만 재고조사 완전 삭제(목록/상세 버튼 + /delete 라우트)
- "◀◀ 조사 목록" 버튼 검정 바탕(primary)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 16:38:38 +09:00
parent 3d85ccf43e
commit c07d3301e4
5 changed files with 102 additions and 16 deletions
@@ -19,13 +19,19 @@
<!-- 좌: 낱개로 분리된 전체 재고 -->
<div class="erp-card">
<div class="cpg-card-head" style="display:flex;justify-content:space-between;align-items:center;">
<h2>재고 현황 — 낱개 기준 ({{ rows|length }})</h2>
<h2>전산 재고 현황 — 낱개 기준 ({{ rows|length }})</h2>
<span class="erp-muted">현재고 = 입고 − 출고 + 조정 + 재고조사반영 (콤보는 낱개로 분해 반영됨)</span>
</div>
<div class="erp-table-wrap">
<table class="erp-table">
<thead>
<tr><th class="ccol">Item Code</th><th>Product Name</th><th style="text-align:right">Current Qty</th><th>Last Stocktake</th></tr>
<tr>
<th class="ccol">Item Code</th><th>Product Name</th>
<th style="text-align:right">전산재고</th>
<th>Last Stocktake</th>
<th style="text-align:right">조사수량</th>
<th style="text-align:right">차이</th>
</tr>
</thead>
<tbody>
{% for r in rows %}
@@ -34,10 +40,14 @@
<td class="nm">{{ r.item_name }}</td>
<td style="text-align:right;font-weight:600;">{{ r.current_qty }}</td>
<td>{{ r.last_stocktake_date or '—' }}</td>
<td style="text-align:right">{{ r.last_qty if r.last_qty is not none else '—' }}</td>
<td style="text-align:right;font-weight:600;{% if r.diff %}color:#b91c1c;{% endif %}">
{% if r.diff is not none %}{{ '%+d'|format(r.diff) }}{% else %}—{% endif %}
</td>
</tr>
{% endfor %}
{% if not rows %}
<tr><td colspan="4" class="erp-muted">표시할 재고가 없습니다.</td></tr>
<tr><td colspan="6" class="erp-muted">표시할 재고가 없습니다.</td></tr>
{% endif %}
</tbody>
</table>
@@ -15,7 +15,7 @@
{% block content %}
<section class="mys mys-compact">
<div class="erp-page-actions">
<a class="erp-btn erp-btn-outline" href="/malaysia/stocktakes?wh={{ stocktake.warehouse_code }}">◀◀ 조사 목록</a>
<a class="erp-btn erp-btn-primary" href="/malaysia/stocktakes?wh={{ stocktake.warehouse_code }}">◀◀ 조사 목록</a>
</div>
<form method="post" action="/malaysia/stocktakes/{{ stocktake.id }}/lines/bulk">
@@ -88,18 +88,28 @@
</div>
</form>
<!-- 확정/취소 -->
{% if is_draft %}
<div class="erp-page-actions" style="margin-top:12px;display:flex;gap:8px;">
<form method="post" action="/malaysia/stocktakes/{{ stocktake.id }}/finalize"
onsubmit="return confirm('확정하면 시스템 재고와의 차이가 STOCKTAKE 이동으로 기록되고, 이후 수정 불가합니다. 계속?');">
<button type="submit" class="erp-btn erp-btn-primary" {% if missing_bom %}disabled title="BOM 누락 콤보 해결 필요"{% endif %}>확정 (재고 반영)</button>
</form>
<form method="post" action="/malaysia/stocktakes/{{ stocktake.id }}/cancel" onsubmit="return confirm('이 조사를 취소합니다. 계속?');">
<button type="submit" class="erp-btn erp-btn-danger">취소</button>
<!-- 확정/취소/삭제 -->
<div class="erp-page-actions" style="margin-top:12px;display:flex;gap:8px;flex-wrap:wrap;">
{% if is_draft %}
{% if is_admin %}
<form method="post" action="/malaysia/stocktakes/{{ stocktake.id }}/finalize"
onsubmit="return confirm('확정하면 전산 재고와의 차이가 STOCKTAKE 이동으로 기록되고, 이후 수정 불가합니다. 계속?');">
<button type="submit" class="erp-btn erp-btn-primary" {% if missing_bom %}disabled title="BOM 누락 콤보 해결 필요"{% endif %}>확정 (전산 반영)</button>
</form>
{% else %}
<span class="erp-muted">전산 재고 반영(확정)은 관리자만 가능합니다.</span>
{% endif %}
<form method="post" action="/malaysia/stocktakes/{{ stocktake.id }}/cancel" onsubmit="return confirm('이 조사를 취소합니다. 계속?');">
<button type="submit" class="erp-btn erp-btn-danger">취소</button>
</form>
{% endif %}
{% if is_super %}
<form method="post" action="/malaysia/stocktakes/{{ stocktake.id }}/delete"
onsubmit="return confirm('이 재고조사를 완전 삭제합니다(되돌릴 수 없음). 계속?');">
<button type="submit" class="erp-btn erp-btn-danger">삭제 (슈퍼관리자)</button>
</form>
{% endif %}
</div>
{% endif %}
<!-- 최종 계산 결과 (낱개 기준) -->
<div class="erp-card" style="margin-top:16px;">
@@ -39,7 +39,14 @@
{% else %}<span class="erp-badge erp-badge-inverse">작성중</span>{% endif %}
</td>
<td>{{ s.created_by or '—' }}</td>
<td><a class="erp-btn erp-btn-outline" href="/malaysia/stocktakes/{{ s.id }}">열기</a></td>
<td style="display:flex;gap:6px;">
<a class="erp-btn erp-btn-outline" href="/malaysia/stocktakes/{{ s.id }}">열기</a>
{% if is_super %}
<form method="post" action="/malaysia/stocktakes/{{ s.id }}/delete" onsubmit="return confirm('재고조사 #{{ s.id }} 완전 삭제. 계속?');">
<button type="submit" class="erp-btn erp-btn-danger">삭제</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
{% if not stocktakes %}