/* ============================================================================= * M02_MasterTemplete_Labor_National.ts * 「전국」 자재 줄(PLAN 361-2) — 실무자료 만들기가 `본뜬.전국자재` 에 적은 자재(키 · 단가 없음 · 361-1)를 * 상세 자재목록 아래 보기 전용 표로 · 이름 · 규격 · 수량 · 단위 · 세 칸(글만) · 금액 칸 비움 · 단추 없음. * 없으면 아무것도 안 그림 · 셈 · 문서 꼴 · 저장 길은 그대로(보기만). * ========================================================================== */ import { el } from "@ui/ui_template_elements"; import { currentLanguageIndex } from "@ui/ui_template_locale"; import type { LaborDoc } from "./M02_MasterTemplete_Labor_Api"; import { markCells, markHeads } from "./M02_MasterTemplete_Labor_MatMarks"; import { tc } from "./M02_MasterTemplete_Labor_Text"; const TEXT = { Title: [ "전국 자재 — 지역은 프로젝트에서 · 금액 없음(보기만)", "Nationwide materials — region set in the project · no price (view only)", ], Code: ["전국", "Nationwide"], Region: ["지역은 프로젝트에서", "Region set in the project"], } as const; const say = (k: keyof typeof TEXT): string => TEXT[k][currentLanguageIndex as 0 | 1] ?? TEXT[k][0]; /** `본뜬.전국자재` 표 — 없으면 [] */ export function nationalRows(origin: LaborDoc["본뜬"]): HTMLElement[] { const mats = origin?.전국자재 ?? []; if (!mats.length) return []; const heads = [ tc("Labor_Code"), tc("Col_Name"), tc("Labor_Spec"), tc("Labor_QtyCol"), tc("Labor_Unit"), ...markHeads(), tc("Labor_AppliedSum"), ]; const rows = mats.map((m) => el("tr", { className: "m02-labrow__row", attrs: { "data-labor-national": m.이름 }, children: [ el("td", { className: "m02-labrow__code", text: say("Code") }), el("td", { className: "m02-labrow__name", children: [ el("strong", { text: m.이름 }), el("small", { className: "m02-labrow__note", text: say("Region") }), ], }), el("td", { className: "m02-labrow__spec", text: m.규격, attrs: { title: m.규격 } }), el("td", { className: "m02-labrow__num", text: String(m.수량?.손 ?? "") }), el("td", { className: "m02-labrow__unit", text: m.단위 }), ...markCells(m), el("td", { className: "m02-labrow__num", text: "—" }), ], }), ); return [ el("p", { className: "m02-labrow__muted", text: say("Title") }), el("div", { className: "ui-general-block__table-wrap", attrs: { "data-labor-national-table": "" }, children: [ el("table", { className: "ui-general-block__table m02-labrow", children: [ el("thead", { children: [el("tr", { children: heads.map((t) => el("th", { text: t })) })], }), el("tbody", { children: rows }), ], }), ], }), ]; }