feat(입출고): 날짜 칸을 ERP 공용 달력으로

발주 목록 기간, 발주일, 입고 예정일, 입고일을 erp-datepop 으로 교체.
국경일·대체공휴일을 빨강·이름으로 표시하고 마우스를 올리면 이름을 보여 준다.
필수 칸은 지우기를 빼고, 잠긴 입고일은 버튼도 비활성화.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 14:11:45 +09:00
parent 01208ea4d4
commit 212a3dd6b0
12 changed files with 168 additions and 16 deletions
+2
View File
@@ -119,3 +119,5 @@
- 시각은 DB 시간대와 무관하게 KST 로 읽음(`db._KstTimestamptzLoader`).
- 날짜 서식은 모두 `yyyy.mm.dd(요일)`(`ymd`·`ymdhm` 매크로, `store.fmt_date`).
- **날짜 칸 = ERP 공용 달력**(2026-11-05, `erp-datepop`, `_datepop.html` + `inout.js` 머리) — 발주 목록 기간·발주일·입고 예정일·입고일. `input[type=date]` 는 숨긴 값 저장소(폼 전송 그대로), 국경일·대체공휴일 빨강·이름 + 마우스를 올리면 이름(`title`, 표 = `project.store.KR_HOLIDAYS`, `router._date_holidays`).
필수 칸은 [지우기] 없음(숨긴 required 칸이 비면 브라우저가 안내 없이 저장을 막는다), 잠긴 입고일은 버튼도 disabled. 테스트 `tests/js/inout_datepop.browser.test.js`(`render_inout.py`).
+11 -1
View File
@@ -106,6 +106,16 @@ def _require(st: Any, user: dict[str, Any], what: str) -> dict[str, bool]:
return p
def _date_holidays() -> dict[str, str]:
"""날짜 칸 달력(erp-datepop)의 국경일·대체공휴일 — 프로젝트 달력과 같은 표."""
try:
from app.modules.project.store import KR_HOLIDAYS # noqa: WPS433
return dict(KR_HOLIDAYS)
except Exception: # noqa: BLE001 — 표를 못 읽어도 날짜 입력은 된다
return {}
def _render(request: Request, name: str, user: dict[str, Any], ctx: dict[str, Any], status_code: int = 200) -> HTMLResponse:
from app.main import build_erp_nav, render_template # noqa: WPS433
@@ -114,7 +124,7 @@ def _render(request: Request, name: str, user: dict[str, Any], ctx: dict[str, An
return render_template(request, name, {
"user": user, "is_admin": perms["admin"], "perms": perms,
"nav_items": build_erp_nav(user, active="inout"),
"msg": request.query_params.get("msg", ""), "today": today_kst(),
"msg": request.query_params.get("msg", ""), "today": today_kst(), "date_holidays": _date_holidays(),
"open_options": request.query_params.get("options") == "1" and perms["admin"], # 톱니 팝업 바로 열기
**ctx,
}, status_code=status_code)
@@ -0,0 +1,5 @@
{# 날짜 칸 = ERP 공용 달력(erp-datepop) — inout.js 가 input[type=date] 를 날짜 버튼으로 바꾼다. inout.js 보다 먼저 include. #}
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<link rel="stylesheet" href="/static/erp-datepop.css?v=20261102a" />
<script type="application/json" id="io-holidays">{{ (date_holidays or {}) | tojson }}</script>
<script src="/static/erp-datepop.js?v=20261102a" defer></script>
+3 -3
View File
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% from "inout/_macros.html" import order_badge, progress, due, n, ymd %}
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261105a" />{% endblock %}
{% block content %}
<div class="io-split">{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #}
@@ -21,7 +21,7 @@
<option value="">전체 공장</option>
{% for f in factories %}<option value="{{ f.id }}" {% if filters.factory == f.id %}selected{% endif %}>{{ f.name }}{% if not f.is_active %} (사용 안 함){% endif %}</option>{% endfor %}
</select>
<label class="io-date">발주일 <input class="erp-input" type="date" name="from" value="{{ filters['from'] }}" /></label>
<label class="io-date">발주일 <input class="erp-input" type="date" name="from" value="{{ filters['from'] }}" aria-label="발주일 시작" /></label>
<span class="erp-muted">~</span>
<input class="erp-input" type="date" name="to" value="{{ filters['to'] }}" aria-label="발주일 끝" />
<input class="erp-input io-search" type="search" name="q" value="{{ filters.q }}" placeholder="발주번호·제품 코드·제품 이름" />
@@ -71,4 +71,4 @@
{% include "inout/_calendar.html" %}
</div>
{% endblock %}
{% block scripts %}<script src="/static/inout.js?v=20261104c" defer></script>{% endblock %}
{% block scripts %}{% include "inout/_datepop.html" %}<script src="/static/inout.js?v=20261105a" defer></script>{% endblock %}
@@ -20,7 +20,7 @@
</footer>
</dialog>
{%- endmacro -%}
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261105a" />{% endblock %}
{% block content %}
{% set active = order.status in ('open', 'partial') %}
@@ -155,7 +155,7 @@
</div>
{% if receiving %}
<div class="io-receipt-bar{% if recv_done %} is-locked{% endif %}"{% if recv_done %} aria-disabled="true" title="전체 입고 완료 — 더 입고할 수 없습니다"{% endif %}>
<label class="erp-field"><span>입고일 *</span><input type="date" name="receipt_date" value="{{ receipt_form.receipt_date }}" required{{ dis }} /></label>
<label class="erp-field"><span>입고일 *</span><input type="date" name="receipt_date" value="{{ receipt_form.receipt_date }}" aria-label="입고일" required{{ dis }} /></label>
<label class="erp-field io-grow"><span>메모</span><input type="text" name="memo" value="{{ receipt_form.memo }}" maxlength="500" placeholder="차량·박스 수·검수 메모 등"{{ dis }} /></label>
<div class="erp-field io-photo-field">
<span>입고증 사진 <small>(최대 {{ max_photos }}장)</small></span>
@@ -262,4 +262,4 @@
{% include "inout/_calendar.html" %}
</div>
{% endblock %}
{% block scripts %}<script src="/static/inout.js?v=20261104c" defer></script>{% endblock %}
{% block scripts %}{% include "inout/_datepop.html" %}<script src="/static/inout.js?v=20261105a" defer></script>{% endblock %}
@@ -1,5 +1,5 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261105a" />{% endblock %}
{% block content %}
<div class="io-split">{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #}
@@ -23,8 +23,8 @@
</select>
{% if not factories %}<span class="io-hint">공장이 없습니다 — 관리자가 옵션에서 먼저 공장을 추가해야 합니다.</span>{% endif %}
</label>
<label class="erp-field"><span>발주일 *</span><input type="date" name="order_date" value="{{ vals.order_date }}" required /></label>
<label class="erp-field"><span>입고 예정일</span><input type="date" name="due_date" value="{{ vals.due_date }}" /></label>
<label class="erp-field"><span>발주일 *</span><input type="date" name="order_date" value="{{ vals.order_date }}" aria-label="발주일" required /></label>
<label class="erp-field"><span>입고 예정일</span><input type="date" name="due_date" value="{{ vals.due_date }}" aria-label="입고 예정일" /></label>
<label class="erp-field"><span>메모</span><input type="text" name="memo" value="{{ vals.memo }}" maxlength="500" placeholder="공장 전달 사항 등" /></label>
</div>
@@ -102,4 +102,4 @@
{% include "inout/_calendar.html" %}
</div>
{% endblock %}
{% block scripts %}<script src="/static/inout.js?v=20261104c" defer></script>{% endblock %}
{% block scripts %}{% include "inout/_datepop.html" %}<script src="/static/inout.js?v=20261105a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% from "inout/_macros.html" import due, n, ymd %}
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261105a" />{% endblock %}
{% block content %}
<div class="io-split">{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #}
@@ -91,4 +91,4 @@
{% include "inout/_calendar.html" %}
</div>
{% endblock %}
{% block scripts %}<script src="/static/inout.js?v=20261104c" defer></script>{% endblock %}
{% block scripts %}<script src="/static/inout.js?v=20261105a" defer></script>{% endblock %}
+2 -1
View File
@@ -16,7 +16,8 @@
.io-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.io-filter .erp-select { width: auto; }
.io-search { width: 260px; }
.io-filter input[type="date"] { width: 150px; }
.io .pj-date-btn { margin-top: 0; height: 34px; box-sizing: border-box; }
.io .pj-date-btn:disabled { opacity: .5; cursor: not-allowed; }
.io-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-midtone-gray); }
.io-seg { display: inline-flex; padding: 2px; border: 1px solid var(--color-subtle-ash); border-radius: 10px; background: #fff; }
.io-seg-btn { padding: 5px 12px; border-radius: 8px; font-size: 12.5px; color: var(--color-rich-black); text-decoration: none; white-space: nowrap; }
+12
View File
@@ -21,6 +21,18 @@
}
function fmt(n) { return n.toLocaleString("ko-KR"); }
// ── 날짜 칸 = ERP 공용 달력(프로젝트와 같은 모양, 국경일·대체공휴일 빨강·이름, 마우스를 올리면 이름) ──
// 필수 칸은 [지우기]를 뺀다 — 숨긴 required 칸이 비면 브라우저가 안내 없이 저장을 막는다.
if (window.ErpDatePop) {
let holidays = {};
try { holidays = JSON.parse((document.getElementById("io-holidays") || {}).textContent || "{}"); } catch (_) { holidays = {}; }
document.querySelectorAll('input[type="date"]').forEach(function (input) {
const pop = window.ErpDatePop.enhance(input, { label: input.getAttribute("aria-label") || "날짜",
format: window.ErpDatePop.fmtFull, clear: !input.required, holidays: holidays });
if (pop) pop.button.disabled = input.disabled;
});
}
// ── 목록 줄 누르기 → 발주서 ──
document.addEventListener("click", function (e) {
const row = e.target.closest(".io-row-link");