Files
dbx-main/tests/js/render_inout.py
king 74782da88c Revert "style(입출고): 달력과 발주 목록 글자를 다시 90%로"
사용자 요청으로 두 번째 축소를 취소한다. 달력 clamp(270px, 20.7vw, 396px),
발주 목록 글자는 원래의 90%로 되돌린다. 머지 e3b7e55 를 되돌림.

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

53 lines
3.0 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 _order(no: int, receipt_dates: list[date]) -> dict:
return {"id": no, "order_no": f"PO-26102{no}-01", "factory_name": "대성화학", "items_label": "미라클 봉투", "line_count": 1,
"order_date": date(2026, 10, 20), "due_date": None, "receipt_dates": receipt_dates, "status": "partial", "status_label": "일부 입고",
"summary": {"ordered": 100, "received": 10, "remaining": 90, "over": 0}}
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": [], "status_filters": {}, "orders": [
_order(1, [date(2026, 10, 21), date(2026, 10, 23)]), _order(2, [date(2026, 10, 22)]), _order(3, [])]}),
}
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()