Files
Aislo/M01_MasterData/M01_MasterData_UI_LogicLab_Foot.ts
T
eomsangdonandClaude Opus 5.5 604ab2cb73 refactor(853-1): M01 화면 죽은 것 걷음 — 묶음 ①
- 지움: UI_Logic_Pick.ts(부르는 곳 0) · UI_Logic_Edit.ts(buildEditor · qtyKind 죽음 · 남은 formatNumber 는 공용 다시 내보내기뿐) · UI_Tree.ts(공용 트리 다시 내보내기 껍데기)
- Logic_Note: buildNote 와 그것만 쓰던 relatedFinds · matchRow · tableView 등 걷음(살아 있는 loadTable · explain 남김)
- LogicLab_Foot.FOOT_OF · Draft.fileCount 걷음(부르는 곳 0)
- 글 키: Logic_Text 62 · LogicLab_Text 11 걷음(정적 · 동적 부름 0 · typecheck 가 지킴)
- import 를 본래 자리로: formatNumber · formatMoney 등 → common_util_money · renderTree → @ui/ui_template_tree
- UI_Logic_Money.ts 는 남김 — M02 네 파일이 import(sub2 몫)
- 시험: test_782_1 소유 선택지 시험 지움(죽은 buildEditor 글만 봄) · test_208_1 · test_modal_top 경로 목록에서 Logic_Pick 줄 뺌 · helper_717_1 의 Logic_Edit 가짜 모듈 뺌

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:35:53 +09:00

54 lines
2.1 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 "../common_util/common_util_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[];
/** 비목 소계 줄 — `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;
}