Files
Aislo/M02_MasterTemplete/M02_MasterTemplete_Labor_Sheet.ts
T
eomsangdonandClaude Opus 5.5 cddb28b63a feat(714-2): 공용 단가산출 계산서 틀 — A00_Common/calc_sheet.ts(704-2 계산서 줄 올림 · 묶음 머리 변수 칸 · 바꾸면 onInput) · M02 계산서 보기 · M01 「인력·재료·경비」 보기가 한 벌로 씀(장비 한 줄 · 기준단위 · 환산 근거는 714-1 뒤)
- 704-2 Labor_Sheet 줄 · 소계 · 계 = calcSheetRows(표본 셋 DOM 전후 같음)
- 새 M01_MasterData_UI_LogicLab_Est.ts — /text 묶음 그대로 · 묶음이 쓰는 시험 입력(714-3 usedInputs) = 머리 변수 칸 · 「준비 중」 자리 걷음
- 낡은 시험 test_704_logic_standard 고침 — 계산서가 계산 줄 부품을 공용 계산서 안에서 씀(import 자리만 바뀜)
- 새 지킴 시험 test_714_2_calc_sheet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 16:03:36 +09:00

64 lines
2.5 KiB
TypeScript

/* =============================================================================
* M02_MasterTemplete_Labor_Sheet.ts
* 계산서 보기(704-2) — 기준 목록 줄을 누르면 담기 전에 한 장: 맨 위 「출처 · 판」 · 비목마다
* 「이름 | 노임 × 품 | 금액」 줄 · 소계 · 계(서버 M01 엔진 값 · `/logic-lib/sheet`) · 곁에 원문 띠 ·
* [담기] = 부르는 쪽 담기 동작 그대로(`put`). 줄 · 소계 · 계 = 공용 계산서(`A00_Common/calc_sheet.ts` · 714-2).
* ========================================================================== */
import { createButton, el, showToast } from "@ui/ui_template_elements";
import { openModal } from "@ui/ui_template_modal";
import { createText } from "@ui/ui_template_text";
import { calcSheetRows } from "../A00_Common/calc_sheet";
import { createSourceView } from "../M01_MasterData/M01_MasterData_UI_LogicLab_Source";
import { fetchStandardSheet, type StandardRow } from "./M02_MasterTemplete_Labor_Api";
import { tc } from "./M02_MasterTemplete_Labor_Text";
export function openStandardSheet(row: StandardRow, put: () => void): void {
const sheet = el("div", { className: "m02-std-sheet__body", attrs: { "data-std-sheet": "" } });
sheet.append(createText(tc("Loading")));
const source = createSourceView({
path: "/m02/logic-lib/source",
pdf: "/m02/logic-lib/source-pdf",
});
let close = (): void => {};
const add = createButton({
label: tc("Std_Put"),
variant: "filled",
onClick: () => {
close();
put();
},
});
({ close } = openModal({
title: `${tc("Std_Sheet")} — ${row.이름}`,
closeLabel: tc("Pick_Close"),
width: "1100px",
wide: true,
actions: [add],
mount: (body) =>
body.append(el("div", { className: "m02-std-sheet", children: [sheet, source.root] })),
}));
void fetchStandardSheet(row).then(
(got) => {
const head = [got.이름, got.규격, got.단위].filter(Boolean).join(" · ");
const lines: HTMLElement[] = [
createText(head, "muted", 14),
createText([got.출처, got.판].filter(Boolean).join(" · "), "hint"),
];
lines.push(
...calcSheetRows({
묶음: got.묶음,
계: got.계,
sumLabel: `${tc("Std_Sum")} (원/${got.단위 || "식"})`,
}),
);
sheet.replaceChildren(...lines);
source.show(got.출처);
},
(error) => {
sheet.replaceChildren(createText(tc("Load_Failed"), "error"));
showToast(error instanceof Error ? error.message : tc("Load_Failed"), "error");
},
);
}