/* ============================================================================= * M02_MasterTemplete_UI_Page.ts * 마스터 템플릿 화면 — 좌측 도킹 패널(층 · 양식 목록) / 우측 편집 칸(표·도면 부품) * * 화면은 로그인만 확인 — 시스템 층 고치기는 시스템 관리자일 때만 켬(서버도 막음). * ========================================================================== */ import "@ui/ui_template_workflow_layout.css"; import { el } from "@ui/ui_template_elements"; import { t as L } from "@ui/ui_template_locale"; import { createWorkflowOverlays } from "@ui/ui_template_overlay"; import { fetchSessionUser } from "../A06_Login/A06_Login_Api_Fetch"; import { createMain } from "./M02_MasterTemplete_UI_Main"; import { buildSide } from "./M02_MasterTemplete_UI_Side"; import "./M02_MasterTemplete_UI_Style.css"; export async function renderM02MasterTemplate(root: HTMLElement): Promise { const user = await fetchSessionUser().catch(() => null); const isAdmin = user?.role === "SYSTEM_ADMIN"; const main = createMain(isAdmin); const side = buildSide({ isAdmin, onOpen: (sel) => void main.open(sel), getOpen: main.current, }); const layout = el("div", { className: "ui-workflow-layout m02-master" }); const overlays = createWorkflowOverlays({ title: L("M02_Title"), optionsContent: el("div", { className: "m02-master__side", children: [side.root] }), showProjectName: false, onOptionsOpenChange: (isOpen) => layout.classList.toggle("is-options-open", isOpen), }); layout.append( el("div", { className: "ui-workflow-layout__body", children: [el("main", { className: "ui-workflow-layout__main", children: [main.root] })], }), overlays.root, ); root.innerHTML = ""; root.append(layout); }