- 앞 커밋 글 그대로(층 · 부름 common_util_m02_call · 찾아 넣기 창 StackFind 주입 · 단위 고르기 부품 상자 · 합계 상자 A00 · 기계 칸 부품) - 앞 커밋에서 git add 가 옛 경로에 걸려 고친 파일이 빠짐 — 두 커밋을 같이 올림 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
2.0 KiB
TypeScript
50 lines
2.0 KiB
TypeScript
/* =============================================================================
|
|
* formula_doc_foot.ts
|
|
* 수식 탭 맨 아래 합계 상자(PLAN 803-2a · 요구 667-2 · 737-1) — 노무비 · 재료비 · 경비 · 계 네 칸 · 화면(모달) 바닥에 붙음
|
|
* 값 = 계산기 셈 그대로(여기서 다시 셈 안 함) · 셈 못 함 = 「—」 · 856-4 = M01 `LogicLab_Foot` 을 여기로(쓰는 곳 하나)
|
|
* ========================================================================== */
|
|
|
|
import { createCalcFormulaRow } from "@ui/ui_template_calc_row";
|
|
import { el } from "@ui/ui_template_elements";
|
|
import { formatMoney } from "../common_util/common_util_money";
|
|
import type { DocAnswer } from "../common_util/common_util_formula_doc_calc";
|
|
import { ft } from "./formula_doc_text";
|
|
import "./formula_doc_foot.css";
|
|
|
|
const num = (v: unknown): number => (typeof v === "number" && Number.isFinite(v) ? v : 0);
|
|
const PARTS = [
|
|
["labor", "노무비"],
|
|
["material", "재료비"],
|
|
["cost", "경비"],
|
|
] as const;
|
|
|
|
export function docFoot(a: DocAnswer): HTMLElement {
|
|
const done = !!a.셈됨 && typeof a.계 === "number";
|
|
const sums = { labor: num(a.노무비), material: num(a.재료비), cost: num(a.경비) };
|
|
const total = num(a.계);
|
|
const cells = PARTS.map(([k, label]) => {
|
|
const out = el("span", {
|
|
className: "ui-calc-row__out is-key",
|
|
text: done ? formatMoney(sums[k]) : "—",
|
|
});
|
|
const row = createCalcFormulaRow(label, null, out);
|
|
row.dataset.group = k;
|
|
row.dataset.subtotal = done ? String(sums[k]) : "";
|
|
return row;
|
|
});
|
|
return el("div", {
|
|
className: "m01lab__foot",
|
|
children: [
|
|
el("div", { className: "m01lab__sums", children: cells }),
|
|
el("p", {
|
|
className: "m01lab__total",
|
|
attrs: { "data-sum": done ? String(total) : "" },
|
|
children: [
|
|
el("span", { text: `${ft("Sum")} ` }),
|
|
el("span", { text: done ? formatMoney(total) : "—" }),
|
|
],
|
|
}),
|
|
],
|
|
});
|
|
}
|