feat(M02): 단가산출 자재 줄 누름 = 그 로직 [옵션] 모달 · 읽기 전용은 보기만(148-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015sDZSjFvoiDjdGpgj3muc3
This commit is contained in:
2026-10-09 19:00:20 +09:00
co-authored by Claude Opus 5.5
parent 09b3b50efc
commit bb4450d729
3 changed files with 33 additions and 10 deletions
@@ -228,7 +228,7 @@ export function mountLaborDetail(
cur.담은로직,
calc ?? last,
!calc && !fail,
edit ? { swap: swapMat, reset: resetMat } : undefined,
edit ? { open: openRow, swap: swapMat, reset: resetMat } : { open: openRow },
),
},
edit ? { open: openMat, remove: removeMat } : { open: openMat },
@@ -5,6 +5,7 @@
* · 삭제 없음 · [바꾸기] = M01 자재품목 표에서 고름(문서 `담은로직[].고름` · 엔진 `choosing`) · 바꾼 줄만 [기본](고름 풂)
* · 금액은 로직 단가 안이라 합에 다시 안 더함(보기만) · 수량은 로직 것(누름 · 알약 없음)
* · 하위 로직 안 재료는 안 보임(엔진이 맨 위 층만 고름)
* · 줄 누름(148-1) = 그 로직 줄 [옵션] 모달(읽기만이면 보기) · [바꾸기] · [기본]은 고칠 때만
* ========================================================================== */
import { createButton, el } from "@ui/ui_template_elements";
@@ -18,10 +19,12 @@ import { tc } from "./M02_MasterTemplete_Labor_Text";
import type { LogicMat } from "./M02_Labor_LogicMats_Model";
export interface LogicMatHandlers {
/** [바꾸기]로 고른 품목 키 — `row` = 담은 로직 차례 · `at` = 호표 차례 */
swap: (row: number, at: number, key: string) => void;
/** 줄 누름(148-1) = 그 자재를 낸 로직 줄 [옵션] 모달 — `row` = 담은 로직 차례 */
open: (row: number) => void;
/** [바꾸기]로 고른 품목 키 — `row` = 담은 로직 차례 · `at` = 호표 차례 · 없으면(읽기만) 단추 칸 없음 */
swap?: (row: number, at: number, key: string) => void;
/** [기본] — 그 줄 고름 풂 */
reset: (row: number, at: number) => void;
reset?: (row: number, at: number) => void;
}
const num = (v: number | null): string =>
@@ -63,7 +66,9 @@ function matRow(
};
const money = moneyCell(mat.단가, mat.금액, wait, tc("Labor_AppliedSum"));
money.title = tc("LogicMat_Inside");
const tools = on
const swap = on?.swap;
const reset = on?.reset;
const tools = swap
? [
el("td", {
className: "m02-labrow__move",
@@ -82,18 +87,18 @@ function matRow(
seed: headWord(name),
alt: [headWord(mat.이름)],
isCurrent: (x) => String(x["키"]) === item?.키,
onPick: (x) => on.swap(r, mat.차례, String(x["키"])),
onPick: (x) => swap(r, mat.차례, String(x["키"])),
});
},
}),
...(mat.고름
...(mat.고름 && reset
? [
createButton({
label: tc("LogicMat_Reset"),
variant: "ghost",
onClick: (e) => {
e.stopPropagation();
on.reset(r, mat.차례);
reset(r, mat.차례);
},
}),
]
@@ -104,8 +109,8 @@ function matRow(
}),
]
: [];
return el("tr", {
className: `m02-labrow__row m02-labrow__logic-mat${mat.고름 ? " is-picked-mat" : ""}`,
const tr = el("tr", {
className: `m02-labrow__row m02-labrow__logic-mat${mat.고름 ? " is-picked-mat" : ""}${on ? " is-open" : ""}`,
attrs: { "data-labor-logic-mat": `${row.로직}|${mat.차례}` },
children: [
el("td", { className: "m02-labrow__code", text: item?.키 ?? "—" }),
@@ -141,4 +146,6 @@ function matRow(
...tools,
],
});
if (on) tr.addEventListener("click", () => on.open(r));
return tr;
}