- calc_sheet.ts bundle 꼴 · bundleLines(순수 · 같은 이름 k 번째끼리 짝) · 새 calc_sheet.css(장비 줄 누름 · 몫 들여씀) - M01 「인력·재료·경비」 = bundle 꼴 · 변수 칸 = 서버 쓰는입력 - 714-3 텍스트 수식 단추도 서버 쓰는입력 먼저(조건 · 재료 고르기 입력까지) · 없으면 조각 - 704-2 M02 계산서 보기 = 비목 꼴 그대로(DOM 전후 같음) - 장비 펼침 넉 줄(손료 · 주연료 · 잡품 · 운전사) = sub3 「펼침」 덧칸 뒤 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.8 KiB
TypeScript
47 lines
1.8 KiB
TypeScript
/* =============================================================================
|
|
* M01_MasterData_UI_LogicLab_Est.ts
|
|
* 「인력·재료·경비」 보기(PLAN 714-2) — 공용 단가산출 계산서(`A00_Common/calc_sheet.ts`)에 시험 계산 읽는 식(`/text`)을 그대로.
|
|
* 인력 · 재료 · 경비(장비) 묶음(714-1 줄 덧칸 `묶음`) · 묶음 머리 변수 칸 = 줄들의 `쓰는입력` · 바꾸면 시험 계산 입력 고침 + 다시 셈(정본 안 바뀜)
|
|
* ========================================================================== */
|
|
|
|
import { el } from "@ui/ui_template_elements";
|
|
import { createText } from "@ui/ui_template_text";
|
|
import { calcSheetRows } from "../A00_Common/calc_sheet";
|
|
import type { LogicInput } from "./M01_MasterData_UI_Logic_Api";
|
|
import { safeReason } from "./M01_MasterData_UI_Logic_Text";
|
|
import type { PreviewTextAnswer } from "./M01_MasterData_UI_LogicLab_Formula";
|
|
import { tl } from "./M01_MasterData_UI_LogicLab_Text";
|
|
|
|
export interface EstContext {
|
|
text: PreviewTextAnswer | null;
|
|
unit: string;
|
|
inputs: LogicInput[];
|
|
values: Record<string, string>;
|
|
onInput?: (name: string, value: string) => void;
|
|
}
|
|
|
|
export function buildEst(ctx: EstContext): HTMLElement {
|
|
const host = el("div", { className: "m01lab-est", attrs: { "data-est": "" } });
|
|
const text = ctx.text;
|
|
if (!text || (text.ok && text.계산됨 === false)) {
|
|
host.append(createText(tl("Formula_Slot"), "muted"));
|
|
return host;
|
|
}
|
|
if (!text.ok) {
|
|
host.append(createText(safeReason(text.reason), "error"));
|
|
return host;
|
|
}
|
|
host.append(
|
|
...calcSheetRows({
|
|
묶음: text.groups,
|
|
계: text.계,
|
|
sumLabel: `${tl("Total")} (${ctx.unit || "원"})`,
|
|
bundle: true,
|
|
inputs: ctx.inputs,
|
|
values: ctx.values,
|
|
onInput: ctx.onInput,
|
|
}),
|
|
);
|
|
return host;
|
|
}
|