Files
dbx-main/tests/js/render_inout.py
T
king 212a3dd6b0 feat(입출고): 날짜 칸을 ERP 공용 달력으로
발주 목록 기간, 발주일, 입고 예정일, 입고일을 erp-datepop 으로 교체.
국경일·대체공휴일을 빨강·이름으로 표시하고 마우스를 올리면 이름을 보여 준다.
필수 칸은 지우기를 빼고, 잠긴 입고일은 버튼도 비활성화.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 14:11:45 +09:00

46 lines
2.5 KiB
Python

"""입출고 날짜 칸 화면을 진짜 ERP 셸(erp_base.html)로 렌더 — 공용 달력 브라우저 테스트용(2026-11-05).
python tests/js/render_inout.py # → tests/js/.out/inout_form.html · inout_list.html · inout_locked.html
DB 없이 날짜 칸에 필요한 값만 넣는다(나머지 값은 비어 있음 — ChainableUndefined). 공휴일 = 실제 표.
"""
from __future__ import annotations
import os
import sys
from datetime import date
import jinja2
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.insert(0, ROOT)
OUT_DIR = os.path.join(ROOT, "tests", "js", ".out")
from app.modules.inout.router import _date_holidays # noqa: E402
def main() -> None:
os.makedirs(OUT_DIR, exist_ok=True)
env = jinja2.Environment(
loader=jinja2.FileSystemLoader([os.path.join(ROOT, "app", "templates"), os.path.join(ROOT, "app", "modules", "inout", "templates")]),
autoescape=True, undefined=jinja2.ChainableUndefined)
base = {"date_holidays": _date_holidays(), "today": date(2026, 10, 5), "user": {"name": "테스트", "email": "t@test.local"}, "nav_items": [], "perms": {"can_order": True, "can_receive": True}}
pages = {
"inout_form.html": ("inout/order_form.html", {"vals": {"order_date": "2026-10-05", "due_date": ""}, "factories": []}),
"inout_list.html": ("inout/index.html", {"filters": {"from": "2026-10-01", "to": "", "status": "open", "q": "", "factory": ""}, "factories": [], "orders": [], "status_filters": {}}),
}
for out, (name, ctx) in pages.items():
with open(os.path.join(OUT_DIR, out), "w", encoding="utf-8") as f:
f.write(env.get_template(name).render(**base, **ctx))
# 입고 칸만 — order_detail.html 은 값이 많아, 전체 입고 완료로 잠긴 입고일 칸(disabled)을 같은 스크립트로 확인
locked = env.from_string('{% extends "erp_base.html" %}{% block head_extra %}<link rel="stylesheet" href="/static/inout.css" />{% endblock %}'
'{% block content %}<section class="io"><input type="date" name="receipt_date" value="2026-10-05" aria-label="입고일" required disabled /></section>{% endblock %}'
'{% block scripts %}{% include "inout/_datepop.html" %}<script src="/static/inout.js" defer></script>{% endblock %}')
with open(os.path.join(OUT_DIR, "inout_locked.html"), "w", encoding="utf-8") as f:
f.write(locked.render(**base))
if __name__ == "__main__":
main()