4b2defac3a
- store.leave_grants/leave_period/leave_status: 1년 미만 월 1일 = 입사일부터 1년까지, 근속 n년 연차 = 생긴 날부터 1년까지(근로기준법 제60조) - 승인된 연차·반차를 날짜별(usage_units = compute_days 규칙)로 나눠 그날 쓸 수 있는 연차 중 먼저 소멸하는 것부터 차감, 생기기 전이면 당겨 씀 - 화면: 지금 연차 기간 · 생기는 연차(오늘까지 +앞으로) · 사용 · 오늘 쓸 수 있는 잔여 · 먼저 소멸(날짜·일수), 해 이동 없음, 달력 위 내 연차도 같은 값 - 직접 입력 = 지금 연차 기간이 시작한 해 줄(override_year), 시스템 전 사용 = 2026 줄(도입일에 쓴 것으로) - 테스트: 규칙(10/12 입사 사례·먼저 소멸·당겨 씀·시스템 전·입사일 없음), 실제 PG, 실제 앱, 브라우저 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
3.1 KiB
Python
55 lines
3.1 KiB
Python
"""휴가 신청 화면(form.html)을 진짜 ERP 셸(erp_base.html)로 렌더 — 날짜 팝업 브라우저 테스트용(2026-10-27).
|
|
|
|
python tests/js/render_vacation.py # → tests/js/.out/vac_form.html
|
|
|
|
DB 없이 화면 데이터만 만든다(공휴일 = 휴가 설정 공휴일 모양 {날짜: 이름}).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
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.vacation.store import HALF_LABELS, HALVES, VACATION_TYPES # 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", "vacation", "templates")]), autoescape=True)
|
|
ctx = {"user": {"email": "kim@test.local", "name": "김철수", "picture": ""}, "is_admin": False, "is_approver": False,
|
|
"nav_items": [], "page_title": "휴가 신청", "page_subtitle": "", "mode": "new", "req": None,
|
|
"default_date": "2026-10-27", "vacation_types": list(VACATION_TYPES), "halves": list(HALVES),
|
|
"half_labels": HALF_LABELS, "holidays": {"2026-10-03": "개천절", "2026-10-09": "한글날", "2026-12-25": "성탄절"}}
|
|
html = env.get_template("vacation/form.html").render(**ctx)
|
|
with open(os.path.join(OUT_DIR, "vac_form.html"), "w", encoding="utf-8") as f:
|
|
f.write(html)
|
|
# 옵션 — 잔여 연차 표(2026-10-27 입사일 기준, 오늘 = 2026-10-26 고정) → tests/js/.out/vac_options.html
|
|
row = {"active": True, "picture": "", "service_years": 0, "period_start": "", "period_end": "", "granted": 0.0,
|
|
"granted_so_far": 0.0, "upcoming": 0.0, "grants_tip": "", "total": None, "prior": 0.0, "used": 0.0,
|
|
"available": None, "expiring": None, "memo": "", "hire_date": ""}
|
|
octx = {**ctx, "page_title": "휴가 — 옵션", "is_admin": True, "can_edit": True, "msg": "",
|
|
"options": {"approvers": [], "notifiers": [], "ready": True, "updated_by": "", "updated_at": ""},
|
|
"candidates": [], "effective_approvers": [], "gmail": {"available": False, "connected": False, "smtp": True},
|
|
"bal_today": "2026-10-26", "bal_prior_col": True, "system_start_year": 2026, "hire_ready": True,
|
|
"bal_rows": [
|
|
{**row, "email": "lee@test.local", "name": "이팀장", "hire_date": "2020-03-02", "service_years": 6,
|
|
"period_start": "2026-03-02", "period_end": "2027-03-01", "granted": 17.0, "granted_so_far": 17.0,
|
|
"grants_tip": "26-03-02 근속 6년 17일(~27-03-01)", "used": 4.5, "available": 12.5,
|
|
"expiring": {"date": "2027-03-01", "days": 12.5}},
|
|
{**row, "email": "kim@test.local", "name": "김철수"},
|
|
]}
|
|
html = env.get_template("vacation/options.html").render(**octx)
|
|
with open(os.path.join(OUT_DIR, "vac_options.html"), "w", encoding="utf-8") as f:
|
|
f.write(html)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|