feat(M02): 일위대가 자재목록 [자재 추가] — M01 자재 하나씩(M02_Material_Pick) · 같은 자재 두 번 막음(39-3 C5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MgChuAcyBqUkhHMTXomQC7
This commit is contained in:
@@ -17,7 +17,6 @@ import {
|
||||
fetchLogicInputs,
|
||||
type LaborCalc,
|
||||
type LaborDoc,
|
||||
type LaborMat,
|
||||
type LaborRow,
|
||||
} from "./M02_MasterTemplete_Labor_Api";
|
||||
import {
|
||||
@@ -30,6 +29,7 @@ import { openLogicPicker } from "./M02_MasterTemplete_Labor_Pick";
|
||||
import { logicTable, matTable, qtyText } from "./M02_MasterTemplete_Labor_Rows";
|
||||
import { tc } from "./M02_MasterTemplete_Labor_Text";
|
||||
import { keepKnown } from "./M02_Labor_Values_Model";
|
||||
import { pickMaterial } from "./M02_Material_Pick";
|
||||
import "../M01_MasterData/M01_MasterData_UI_Logic_Style.css";
|
||||
import "../M01_MasterData/M01_MasterData_UI_LogicLab_Style.css";
|
||||
import "@ui/ui_template_general_layout.css";
|
||||
@@ -67,8 +67,6 @@ export interface LaborDetailOptions {
|
||||
onChanged: (dirty: boolean) => void;
|
||||
/** 「면적산출에서 잇기」 — 그 열 면적산출 상세로(없으면 단추 없음) */
|
||||
goArea: (() => void) | null;
|
||||
/** 자재 하나 고르기(`M02_Material_Pick`) — 없으면 [자재 추가] 없음 */
|
||||
pickMaterial?: (done: (m: Omit<LaborMat, "수량">) => void) => void;
|
||||
}
|
||||
|
||||
export interface LaborDetailHandle {
|
||||
@@ -253,24 +251,21 @@ export function mountLaborDetail(
|
||||
void loadLogics().then(changed);
|
||||
}),
|
||||
});
|
||||
const pick = opt.pickMaterial;
|
||||
const addMat = pick
|
||||
? createButton({
|
||||
label: tc("Labor_AddMat"),
|
||||
variant: "filled",
|
||||
size: "sm",
|
||||
onClick: () =>
|
||||
pick((m) => {
|
||||
if (cur.자재.some((x) => x.코드 === m.코드))
|
||||
return showToast(
|
||||
tc("Labor_AlreadyMat").replace("{value}", `${m.코드} ${m.이름 ?? ""}`),
|
||||
"error",
|
||||
);
|
||||
cur.자재.push({ ...m, 수량: null });
|
||||
changed();
|
||||
}),
|
||||
})
|
||||
: null;
|
||||
const addMat = createButton({
|
||||
label: tc("Labor_AddMat"),
|
||||
variant: "filled",
|
||||
size: "sm",
|
||||
onClick: () =>
|
||||
pickMaterial((m) => {
|
||||
if (cur.자재.some((x) => x.코드 === m.코드))
|
||||
return showToast(
|
||||
tc("Labor_AlreadyMat").replace("{value}", `${m.코드} ${m.이름 ?? ""}`),
|
||||
"error",
|
||||
);
|
||||
cur.자재.push({ 코드: m.코드, 이름: m.이름, 규격: m.규격, 단위: m.단위, 수량: null });
|
||||
changed();
|
||||
}),
|
||||
});
|
||||
|
||||
const unit = createInputField({ type: "text", label: tc("Labor_Unit") });
|
||||
unit.input.value = cur.단위 ?? "";
|
||||
|
||||
Reference in New Issue
Block a user