Files
Aislo/M02_MasterTemplete/M02_MasterTemplete_Labor_Sheet.ts
T
eomsangdonandClaude Opus 5.5 508e1ec34d feat(M02 기준 목록): 로직 고르기 창 = 기준 목록 표 · 줄 누름 = 계산서 보기 → [담기] (PLAN 704-1 · 704-2)
- 고르기 창 단가산출 줄 → 공용 표(품명 · 규격 · 단위 · 금액 · 출처) · 공종 거름 · 찾기 = 공용 matchLogic(규격 · 실무 낱말 별칭까지) · GF 번호 숨김 · 창 폭 960
- 기준 목록이 오기 전 · 서버 셈 도중 = 로직 줄(금액 빈칸) · 서고 · 덧줄 목록은 그대로
- 계산서 창 `M02_MasterTemplete_Labor_Sheet` — 맨 위 출처 · 노임 판 · 「이름 | 노임 × 품 | 금액」 줄 · 비목 소계 · 계(계산 줄 부품) · 곁에 원문 띠 · [담기] = 지금 담기 동작 그대로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:02:07 +09:00

77 lines
3.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* =============================================================================
* M02_MasterTemplete_Labor_Sheet.ts
* 계산서 보기(704-2) — 기준 목록 줄을 누르면 담기 전에 한 장: 맨 위 「출처 · 판」 · 비목마다
* 「이름 | 노임 × 품 | 금액」 줄 · 소계 · 계(서버 M01 엔진 값 · `/logic-lib/sheet`) · 곁에 원문 띠 ·
* [담기] = 부르는 쪽 담기 동작 그대로(`put`).
* ========================================================================== */
import { createButton, el, showToast } from "@ui/ui_template_elements";
import { createCalcFormula, createCalcFormulaRow } from "@ui/ui_template_calc_row";
import { openModal } from "@ui/ui_template_modal";
import { createText } from "@ui/ui_template_text";
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";
const won = (v: number | null, digits = 0): string =>
v === null ? "-" : v.toLocaleString("ko-KR", { maximumFractionDigits: digits });
const out = (v: number | null, key = false, digits = 0): HTMLElement =>
el("span", { className: `ui-calc-row__out${key ? " is-key" : ""}`, text: won(v, digits) });
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"),
];
for (const g of got.묶음) {
for (const line of g.줄) {
const text = line.글.replace(/ = [^=]*$/, "").replaceAll(" * ", " × ");
lines.push(
createCalcFormulaRow(line.이름, createCalcFormula(text), out(line.금액, false, 1)),
);
}
lines.push(
createCalcFormulaRow(`${g.비목}${g.끝수 ? ` (${g.끝수})` : ""}`, null, out(g.소계, true)),
);
}
lines.push(
createCalcFormulaRow(`${tc("Std_Sum")} (원/${got.단위 || "식"})`, null, out(got.계, true)),
);
sheet.replaceChildren(...lines);
source.show(got.출처);
},
(error) => {
sheet.replaceChildren(createText(tc("Load_Failed"), "error"));
showToast(error instanceof Error ? error.message : tc("Load_Failed"), "error");
},
);
}