diff --git a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_CheckRows.ts b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_CheckRows.ts index 8b90df4f8..35dee7c48 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_CheckRows.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_CheckRows.ts @@ -26,7 +26,7 @@ import type { LaborCalc } from "./M02_MasterTemplete_Labor_Api"; import { markCells, markHeads } from "./M02_MasterTemplete_Labor_MatMarks"; import { moneyCell, PRICE_SLOTS } from "./M02_MasterTemplete_Labor_Rows"; import { tc } from "./M02_MasterTemplete_Labor_Text"; -import { formatPrice } from "../common_util/common_util_money"; +import { formatNumber, formatPrice } from "../common_util/common_util_money"; import { tableOf } from "./logic/M02_MasterTemplete_Hopyo_Draft"; /** 드롭다운 — 저장 값(서버 뺌 까닭) → 화면 글 */ @@ -62,8 +62,7 @@ export interface RowsContext { options: (line: HopyoLine, at: number) => void; } -const num = (v: number): string => - Number(v.toPrecision(12)).toLocaleString("ko-KR", { maximumFractionDigits: 6 }); +const num = formatNumber; const small = (text: string, cls = "m02-labrow__note"): HTMLElement => el("small", { className: cls, text, attrs: { title: text } }); diff --git a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Compare.ts b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Compare.ts index 80426135e..827e5cdf5 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Compare.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Compare.ts @@ -12,6 +12,7 @@ import { t as L, type LocaleKey } from "@ui/ui_template_locale"; import { createSegment } from "@ui/ui_template_segment"; import { createTable } from "@ui/ui_template_table"; import { createText } from "@ui/ui_template_text"; +import { formatNumber, formatPrice } from "../common_util/common_util_money"; import type { CompareLook, ElemCand, @@ -26,7 +27,7 @@ const LOOK: Record = { 기초만: { tone: "neutral", key: "M02_CmpBase" }, }; const LOOKS = Object.keys(LOOK) as CompareLook[]; -const num = (n: number | null): string => (n === null ? "—" : String(Number(n.toPrecision(4)))); +const num = (n: number | null): string => (n === null ? "—" : formatNumber(n)); /** 선택 칸 글 뒤 요약 — 「같음 3 · 품 다름 1」 · 견줌 못함 = "" */ export const compareBrief = (c: SangeunCompare | null | undefined): string => @@ -112,7 +113,7 @@ export function elemChoices(cands: ElemCand[], pick: (c: ElemCand) => void): HTM const box = el("div", { className: "ui-toolbar", attrs: { "data-elem": "" } }); box.title = L("M02_ElemTitle"); for (const c of cands.slice(0, 3)) { - const price = c.단가 ? ` · ${c.단가.toLocaleString()}` : ""; + const price = c.단가 ? ` · ${formatPrice(c.단가)}` : ""; const b = createButton({ label: `${c.이름}${c.규격 ? ` ${c.규격}` : ""} [${c.단위 ?? ""}]${price}`, size: 24,