Files
Aislo/M01_MasterData/M01_MasterData_UI_LogicLab_Foot.ts
T
eomsangdonandClaude Sonnet 5.5 b58b01a007 feat(748-3): 텍스트 수식 바닥 노무비 · 재료비 · 경비 고정 줄(계 없음) · 비목 상자 사이 간격 = 바닥 줄 위 여유
- 새 `LogicLab_Foot` — 바닥 비목 소계 줄 한 부품(단가산출 상세 4 칸 · 텍스트 수식 3 칸 계 칸 없음) · 상자 소계는 그대로
- 비목 상자 사이 간격 = 바닥 줄 위 여유(공통 값 `--m01lab-box-gap` 12px · 두 보기)
- 줄마다 붙던 옵션 값 칩 걷음은 748-2 커밋에 함께(위 옵션 칸이 대신)
- 낡은 시험 고침: test_737 바닥 줄 부품 · 칸 수 · 상자 간격 대조

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 22:20:09 +09:00

60 lines
2.3 KiB
TypeScript

/* =============================================================================
* M01_MasterData_UI_LogicLab_Foot.ts
* 화면(모달) 바닥에 붙는 비목 소계 줄(737-1 · PLAN 748-3) — 단가산출 상세(노무비 · 재료비 · 경비 · 계 네 칸) ·
* 텍스트 수식(노무비 · 재료비 · 경비 세 칸 · 계 칸 없음 — 중복 표기) 두 보기가 같이 씀.
* 값 = 서버 셈 그대로(여기서 다시 셈 안 함) · 계산 전 「—」.
* ========================================================================== */
import { createCalcFormulaRow } from "@ui/ui_template_calc_row";
import { el } from "@ui/ui_template_elements";
import { formatMoney } from "./M01_MasterData_UI_Logic_Money";
import { tl } from "./M01_MasterData_UI_LogicLab_Text";
export type FootKey = "labor" | "material" | "cost";
const LABEL: Record<FootKey, string> = { labor: "노무비", material: "재료비", cost: "경비" };
export const FOOT_KEYS = Object.keys(LABEL) as FootKey[];
/** 서버 비목 이름 → 칸 */
export const FOOT_OF: Record<string, FootKey> = {
노무비: "labor",
재료비: "material",
경비: "cost",
};
/** 비목 소계 줄 — `total` 을 주면 맨 끝 「계」 칸까지 네 칸(주지 않으면 세 칸) */
export function buildFoot(
sums: Record<FootKey, number>,
calculated: boolean,
total?: number,
): HTMLElement {
const cells = FOOT_KEYS.map((k) => {
const out = el("span", {
className: "ui-calc-row__out is-key",
text: calculated ? formatMoney(sums[k]) : "—",
});
const row = createCalcFormulaRow(LABEL[k], null, out);
row.dataset.group = k;
row.dataset.subtotal = calculated ? String(sums[k]) : "";
return row;
});
const foot = el("div", {
className: "m01lab__foot",
children: [
el("div", { className: "m01lab__sums", children: cells }),
...(total === undefined
? []
: [
el("p", {
className: "m01lab__total",
attrs: { "data-sum": calculated ? String(total) : "" },
children: [
el("span", { text: `${tl("Total")} ` }),
el("span", { text: calculated ? formatMoney(total) : "—" }),
],
}),
]),
],
});
if (total === undefined) foot.dataset.cols = "3";
return foot;
}