refactor(856-3): 일위대가 단가산출 줄 누름 = 줄 쌓기 한 길 — 프로젝트 사본은 굳힌 SK 문서 보기만 · M01 로직 줄 창 걷음

- 프로젝트 사본(구조물 고르기 카드 · B08 카드) 단가산출 줄 누름 = 사본 참조사본의 굳힌 SK 문서째 줄 쌓기 보기만(memory · 고침 칸 잠김 · 저장 없음 · 층 파일 읽기 0) · 사본에 없으면 알림
- 셈 주입 원본 층 카드 = 그 층 SK 줄 쌓기 읽기만(옛 「프로젝트 사본 줄」 안내 대신)
- M01 로직을 바로 담은 줄(저장본 0) = 창 없이 안내 한 줄 · 프로젝트 · 셈 주입 표(늘 보기만)의 [로직 추가] M01 바로 담기 갈래 지움(서버 from-logic 은 project 층 안 받음 · 서버 고침 0)
- Labor_RowModal = 자재 모달만 · Labor_LogicMats 고침 손잡이 · setLogicMark · 안 쓰는 글 키 지움
- 시험: 856-0 가짜 DOM 에 사본 보기 · 원본 층 읽기만 · 로직 줄 안내 덧 · 소스 글자 시험(175 · 222-1 · 742-1 · 806-1 둘 · logic_mats) 지움 · 811-1 · mat_marks 는 글자 줄만 지우고 700 줄 · 날 단추 · 서버 ↔ 화면 허용 값 짝 남김

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 05:32:35 +09:00
co-authored by Claude Opus 5.5
parent 605ca0cbed
commit 482ef981c0
20 changed files with 146 additions and 374 deletions
@@ -333,6 +333,7 @@ export function createItemCards(opts: ItemCardsOptions): ItemCardsHandle {
? {
calc: (doc, 수량) => via.calc(at, doc, 수량),
readArea: () => src.read("area", at),
...(via.sk ? { skCopy: via.sk } : {}), // 856-3 사본 단가산출 줄 = 보기만
}
: {}),
onChanged: (dirty) => laborCard.saver.mark(dirty && laborWritable()),
@@ -12,7 +12,7 @@ import {
type Layer,
} from "./M02_MasterTemplete_Api_Fetch";
import type { LaborDoc } from "./M02_MasterTemplete_Labor_Api";
import type { LaborCalc } from "./M02_MasterTemplete_Labor_Calc";
import type { LaborCalc, LaborRef } from "./M02_MasterTemplete_Labor_Calc";
/** 집계표 열 하나에 딸린 문서 — 구조물 도면 · 면적산출 */
export type ItemPart = "structure" | "area";
@@ -34,6 +34,8 @@ export interface ItemSource {
doc: LaborDoc,
수량?: Record<string, number>,
) => Promise<LaborCalc & { 알약: unknown[] }>;
/** 프로젝트 사본(856-3) — 단가산출 줄의 굳힌 SK 문서(`참조사본`) · 줄 누름 = 줄 쌓기 보기만 */
sk?: (ref: LaborRef) => Promise<Record<string, unknown> | null>;
};
}
@@ -12,6 +12,7 @@
import type { DataColumn } from "@ui/ui_template_data_table";
import type { Layer } from "./M02_MasterTemplete_Api_Fetch";
import type { LaborCalc, LaborDoc } from "./M02_MasterTemplete_Labor_Api";
import type { LaborRef } from "./M02_MasterTemplete_Labor_Calc";
import { mountLaborTable } from "./M02_MasterTemplete_Labor_Table";
export interface LaborDetailOptions {
@@ -32,6 +33,8 @@ export interface LaborDetailOptions {
/** 셈 · 면적 자리 주입(142-1 · 고르기 모달 = 프로젝트 복사본) — 없으면 층 길 */
calc?: (doc: LaborDoc, 수량?: Record<string, number>) => Promise<LaborCalc & { 알약: unknown[] }>;
readArea?: () => Promise<{ 문서: unknown; 판?: string | null }>;
/** 프로젝트 사본(856-3) — 단가산출 줄의 굳힌 SK 문서 · 있으면 그 줄 누름 = 줄 쌓기 보기만 */
skCopy?: (ref: LaborRef) => Promise<Record<string, unknown> | null>;
}
/** 덧칸 — `cell(n, 열)` = 문서 줄 n 의 값 · `onRow(n)` 참 = 기본 줄 모달 안 엶 */
@@ -2,34 +2,19 @@
* M02_MasterTemplete_Labor_LogicMats.ts
* 자재목록 표의 로직 자재 줄(103-1) — 담은 로직 맨 위 층 재료 줄(서버 calc `줄[].재료`) · 사용자 자재 줄과 같은 칸
* (코드 · 이름 · 규격 · 수량 · 단위 · 가격 다섯 · 단가 / 금액) · 사용자 자재 앞.
* · 삭제 없음 · [바꾸기] = M01 자재품목 표에서 고름(문서 `담은로직[].고름` · 엔진 `choosing`) · 바꾼 줄만 [기본](고름 풂)
* · 금액은 로직 단가 안이라 합에 다시 안 더함(보기만) · 수량은 로직 것(누름 · 알약 없음)
* · 하위 로직 안 재료는 안 보임(엔진이 맨 위 층만 고름)
* · 줄 누름(148-1) = 그 로직 줄 [옵션] 모달(읽기만이면 보기) · [바꾸기] · [기본]은 고칠 때만
* · 보기만(856-3 — 로직 줄 창 · [바꾸기] · [기본] · 세 칸 고침 걷음 · 일위대가 면적 보기 `Labor_View` 가 씀)
* · 금액은 로직 단가 안이라 합에 다시 안 더함 · 수량은 로직 것 · 하위 로직 안 재료는 안 보임(엔진이 맨 위 층만 고름)
* ========================================================================== */
import { createButton, el } from "@ui/ui_template_elements";
import { el } from "@ui/ui_template_elements";
import { formatMoney } from "../common_util/common_util_money";
import { openPickTable } from "../M01_MasterData/M01_MasterData_UI_Logic_PickTable";
import { headWord } from "../M01_MasterData/M01_MasterData_UI_LogicLab_Modal";
import type { LaborCalc, LaborRow, MatMarkKey } from "./M02_MasterTemplete_Labor_Api";
import type { LaborCalc, LaborRow } from "./M02_MasterTemplete_Labor_Api";
import { lineId } from "./M02_MasterTemplete_Labor_Calc";
import { markCells } from "./M02_MasterTemplete_Labor_MatMarks";
import { moneyCell, PRICE_SLOTS } from "./M02_MasterTemplete_Labor_Rows";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import type { LogicMat } from "./M02_Labor_LogicMats_Model";
export interface LogicMatHandlers {
/** 줄 누름(148-1) = 그 자재를 낸 로직 줄 [옵션] 모달 — `row` = 담은 로직 차례 */
open: (row: number) => void;
/** [바꾸기]로 고른 품목 키 — `row` = 담은 로직 차례 · `at` = 호표 차례 · 없으면(읽기만) 단추 칸 없음 */
swap?: (row: number, at: number, key: string) => void;
/** [기본] — 그 줄 고름 풂 */
reset?: (row: number, at: number) => void;
/** 세 칸(148-4) — 로직 줄 `자재표시` · 없으면 글만 */
mark?: (row: number, at: number, key: MatMarkKey, v: string) => void;
}
const num = (v: number | null): string =>
v === null
? "—"
@@ -40,21 +25,14 @@ export function logicMatRows(
rows: LaborRow[],
calc: LaborCalc | null,
wait: boolean,
on?: LogicMatHandlers,
): HTMLElement[] {
return rows.flatMap((row, r) => {
return rows.flatMap((row) => {
const line = row.참조 ? undefined : calc?.줄.find((l) => lineId(l) === lineId(row));
return (line?.재료 ?? []).map((mat) => matRow(row, r, mat, wait, on));
return (line?.재료 ?? []).map((mat) => matRow(row, mat, wait));
});
}
function matRow(
row: LaborRow,
r: number,
mat: LogicMat,
wait: boolean,
on?: LogicMatHandlers,
): HTMLElement {
function matRow(row: LaborRow, mat: LogicMat, wait: boolean): HTMLElement {
const item = mat.품목;
const name = item?.이름 ?? mat.이름;
const owner = `${row.별칭 ?? row.로직} · ${mat.이름}`;
@@ -69,51 +47,8 @@ function matRow(
};
const money = moneyCell(mat.단가, mat.금액, wait, tc("Labor_AppliedSum"));
money.title = tc("LogicMat_Inside");
const swap = on?.swap;
const reset = on?.reset;
const tools = swap
? [
el("td", {
className: "m02-labrow__move",
children: [
el("div", {
className: "ui-btn-group",
children: [
createButton({
label: tc("LogicMat_Swap"),
variant: "ghost",
onClick: (e) => {
e.stopPropagation();
openPickTable({
kind: "재료",
title: `${tc("LogicMat_PickTitle")} · ${mat.이름}`,
seed: headWord(name),
alt: [headWord(mat.이름)],
isCurrent: (x) => String(x["키"]) === item?.키,
onPick: (x) => swap(r, mat.차례, String(x["키"])),
});
},
}),
...(mat.고름 && reset
? [
createButton({
label: tc("LogicMat_Reset"),
variant: "ghost",
onClick: (e) => {
e.stopPropagation();
reset(r, mat.차례);
},
}),
]
: []),
],
}),
],
}),
]
: [];
const tr = el("tr", {
className: `m02-labrow__row m02-labrow__logic-mat${mat.고름 ? " is-picked-mat" : ""}${on ? " is-open" : ""}`,
return el("tr", {
className: `m02-labrow__row m02-labrow__logic-mat${mat.고름 ? " is-picked-mat" : ""}`,
attrs: { "data-labor-logic-mat": `${row.로직}|${mat.차례}` },
children: [
el("td", { className: "m02-labrow__code", text: item?.키 ?? "—" }),
@@ -146,15 +81,9 @@ function matRow(
text: mat.단위,
attrs: { "data-label": tc("Labor_Unit") },
}),
...markCells(
row.자재표시?.[String(mat.차례)] ?? {},
on?.mark ? (k, v) => on.mark?.(r, mat.차례, k, v) : undefined,
),
...markCells(row.자재표시?.[String(mat.차례)] ?? {}),
...PRICE_SLOTS.map(priceCell),
money,
...tools,
],
});
if (on) tr.addEventListener("click", () => on.open(r));
return tr;
}
@@ -10,7 +10,6 @@ import { createSelectField, el } from "@ui/ui_template_elements";
import {
MAT_MARK_DEFAULT,
MAT_MARKS,
type LaborRow,
type MatMarkKey,
type MatMarks,
} from "./M02_MasterTemplete_Labor_Api";
@@ -60,12 +59,3 @@ export function setMark(target: MatMarks, key: MatMarkKey, v: string): void {
if (v) (target as Record<string, string>)[key] = v;
else delete target[key];
}
/** 로직 줄 `자재표시` 한 차례 한 칸 — 빈 차례 · 빈 묶음은 뺌 */
export function setLogicMark(row: LaborRow, at: number, key: MatMarkKey, v: string): void {
const all = (row.자재표시 ??= {});
const one = (all[String(at)] ??= {});
setMark(one, key, v);
if (!Object.keys(one).length) delete all[String(at)];
if (!Object.keys(all).length) delete row.자재표시;
}
@@ -1,134 +1,20 @@
/* =============================================================================
* M02_MasterTemplete_Labor_RowModal.ts
* 일위대가표 줄 누름 모달(PLAN 723-2 · 요구서_내역16 2장 4 · 5 · 856-1) — 일위대가표에서 빠진 줄 동작을 모달 안으로.
* · 로직 줄(단가산출 문서 없음) · 셈 주입 줄(프로젝트 사본) = 머리(이름 · 「1 ㎡ 당」 · 옵션 값 · 메모) + 안내 한 줄
* (856-1 — 옛 단가산출 상세 몸 · [적용] 걷음 · 고침 = 단가산출 줄 쌓기 · 856-3 에서 줄 쌓기 보기로) ·
* 로직 자재(바꾸기 · 기본 · 세 칸 · `Labor_LogicMats`)
* · 사용자 자재 줄 = 자재 모달(세 칸 · `Labor_MatTable` 한 줄)
* 일위대가표 사용자 자재 줄 누름 모달(PLAN 723-2 · 요구서_내역16 2장 4 · 5) — 세 칸(`Labor_MatTable` 한 줄) · 가격 다섯 보기.
* · 고침 = 그 줄 화면 캐시(저장은 [저장]) · 금액은 표가 다시 셈 → `watch` 로 받아 다시 그림
* · 단가산출(SK) 줄 = `Labor_SkEdit`(프로젝트 사본 = 보기만) · M01 로직 줄 창은 걷음(856-3)
* ========================================================================== */
import { createBanner } from "@ui/ui_template_banner";
import { el, showToast } from "@ui/ui_template_elements";
import { el } from "@ui/ui_template_elements";
import { openModal } from "@ui/ui_template_modal";
import { createText } from "@ui/ui_template_text";
import type { ItemLogic } from "./M02_MasterTemplete_Api_Fetch";
import type { LaborCalc, LaborMat, LaborRow, MatMarkKey } from "./M02_MasterTemplete_Labor_Api";
import { logicMatRows } from "./M02_MasterTemplete_Labor_LogicMats";
import { setLogicMark, setMark } from "./M02_MasterTemplete_Labor_MatMarks";
import type { LaborCalc, LaborMat } from "./M02_MasterTemplete_Labor_Api";
import { setMark } from "./M02_MasterTemplete_Labor_MatMarks";
import { matTable } from "./M02_MasterTemplete_Labor_MatTable";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import { valueLine } from "./M02_Labor_Values_Model";
/** 표가 다시 센 답을 받음 — 돌려준 함수 = 그만 받음 */
export type CalcWatch = (fn: (calc: LaborCalc | null) => void) => () => void;
export interface RowModalOptions {
row: LaborRow;
logic: ItemLogic | null;
title: string;
/** 일위대가 머리(이름 · 「1 ㎡ 당」) */
head: string;
readOnly: boolean;
/** 셈 주입(프로젝트 복사본) — 안내 글이 다름 */
inject: boolean;
/** 사용자 자재 코드 — 로직 자재 [바꾸기]로 같은 품목 막음 */
userMats: string[];
watch: CalcWatch;
/** 고침 뒤 — `again` = 서버 다시 셈(입력 · 고름 · 별도계상) · 아니면 화면만 */
done: (again: boolean) => void;
}
const TEXT = {
NoDoc: [
"M01 로직을 바로 담은 줄 — 단가산출 화면 없음 · 고침은 단가산출로 담아(일위대가 [로직 추가]) 그 줄에서",
"Uses the M01 logic directly — add it as a build-up to edit",
],
FromSk: [
"단가산출 「{k}」 에서 담아 온 줄 — 고침은 그 단가산출에서 고쳐 다시 담음",
"Copied from build-up 「{k}」 — edit it there and re-add",
],
Inject: [
"프로젝트 사본 줄 — 단가산출 화면 없음 · 수식 고침은 M02 단가산출에서 고쳐 [재생성]",
"Project copy line — edit the build-up in M02 and regenerate",
],
} as const;
const t = (k: keyof typeof TEXT): string => TEXT[k][0];
export function openRowModal(o: RowModalOptions): void {
const row = o.row;
const edit = !o.readOnly;
const info = el("div", { attrs: { "data-row-head": "" } });
const mats = el("div", { attrs: { "data-row-mats": "" } });
let calc: LaborCalc | null = null;
const draw = (): void => {
const values = valueLine(o.logic?.입력 ?? [], row.입력값);
info.replaceChildren(
createText(o.head, "muted", 14),
...(values.text ? [createText(values.text)] : []),
...(values.empty
? [createText(tc("Labor_Empty").replace("{n}", String(values.empty)), "error")]
: []),
...(row.켜쌓기율 != null
? [createText(tc("Labor_Layer").replace("{n}", String(row.켜쌓기율)), "muted")]
: []),
...(row.메모 ? [createText(row.메모, "muted")] : []),
);
const lead = row.참조
? []
: logicMatRows([row], calc, !calc, {
open: () => undefined,
...(edit
? {
swap: (_r: number, at: number, key: string) => {
if (o.userMats.includes(key))
return showToast(tc("Labor_AlreadyMat").replace("{value}", key), "error");
row.고름 = { ...row.고름, [String(at)]: key };
o.done(true);
},
reset: (_r: number, at: number) => {
if (!row.고름) return;
delete row.고름[String(at)];
if (!Object.keys(row.고름).length) delete row.고름;
o.done(true);
},
mark: (_r: number, at: number, key: MatMarkKey, v: string) => {
setLogicMark(row, at, key, v);
o.done(key === "별도계상");
draw();
},
}
: {}),
});
mats.replaceChildren(
...(lead.length
? [el("h4", { text: tc("Labor_Mats") }), matTable({ mats: [], calc, lead })]
: []),
);
};
// 안내 한 줄(856-1) — 로직 줄 = 온 단가산출(`본뜬`) · 셈 주입 = 프로젝트 사본
const from = row.본뜬 && typeof row.본뜬.이름 === "string" ? row.본뜬.이름 : "";
const note = createBanner({
tone: "info",
text: o.inject ? t("Inject") : from ? t("FromSk").replace("{k}", from) : t("NoDoc"),
});
const stop = o.watch((c) => {
calc = c;
draw();
});
openModal({
title: o.title,
closeLabel: tc("In_Close"),
width: "1100px",
wide: true,
beforeClose: () => (stop(), true),
mount: (body) => body.append(info, note, mats),
});
draw();
}
export interface MatModalOptions {
mat: LaborMat;
watch: CalcWatch;
@@ -5,6 +5,8 @@
* · [저장] = 수식 저장(`flush`) → 그 SK 문서 저장(`saveTemplate` · 그 층 · 그 주인) → 닫음 → 부르는 쪽이 일위대가 금액을 다시 셈
* · 그 층을 못 고치면(위 층 · 남의 주인) 읽기만 · [저장] 없음 · 고친 것 있이 닫으면 물음(버리면 수식 캐시도 비움)
* · 머리(808-1 · 요구 701-4 · 5) = 단가산출 페이지 머리와 같음 — 보기 고르기 · [단가 갱신] · [재생성] · [저장] · [닫기]
* · 프로젝트 사본(856-3 · `copy`) = 사본의 굳힌 SK 문서째 줄 쌓기 보기만(`memory` · 파일 안 읽음 · 저장 없음) ·
* 고침은 M02 단가산출에서 고쳐 [재생성](요구 898 ①)
* 짝 모달 = `Labor_RefEdit`(일위조합 SC 줄).
* ========================================================================== */
@@ -23,6 +25,8 @@ export interface SkEditOptions {
/** 일위대가 머리(이름 · 「1 ㎡ 당」) */
head: string;
readOnly: boolean;
/** 프로젝트 사본(856-3) — 그 사본의 굳힌 SK 문서(있으면 보기만 · 파일 안 읽음) */
copy?: Record<string, unknown>;
/** 닫힘 — `saved` = 그 SK 문서를 저장함(부르는 쪽이 금액을 다시 셈) */
closed: (saved: boolean) => void;
}
@@ -39,12 +43,16 @@ export async function openSkEdit(opt: SkEditOptions): Promise<void> {
const at = `${layer}/${opt.ref.주인 ?? ""}/${opt.ref.키}`;
if (opened.has(at)) return;
opened.add(at);
let doc: unknown;
let version: string;
const copy = !!opt.copy;
const readOnly = copy || opt.readOnly;
let doc: unknown = opt.copy;
let version = "";
try {
const got = await readTemplate(layer, "sangeun", opt.ref.키, null, opt.ref.주인);
doc = got.문서;
version = got.판 ?? "";
if (!copy) {
const got = await readTemplate(layer, "sangeun", opt.ref.키, null, opt.ref.주인);
doc = got.문서;
version = got.판 ?? "";
}
} catch (error) {
opened.delete(at);
return void showToast(error instanceof Error ? error.message : tc("Load_Failed"), "error");
@@ -72,12 +80,13 @@ export async function openSkEdit(opt: SkEditOptions): Promise<void> {
const host = el("div", { attrs: { "data-labor-sk": opt.ref.키 } });
const slot = el("span", { className: "m02-main__tools" }); // 보기 고르기 · [단가 갱신] · [재생성](808-1 · 페이지 머리와 같음)
handle = mountSangeunDetail(host, doc, {
layer,
owner: opt.ref.주인,
readOnly: opt.readOnly,
onChanged: (d) => (dirty = d && !opt.readOnly),
// 사본 = 층 읽기 길(굳힌 문서째 셈 · 주인 층 권한 없이)
layer: copy ? "system" : layer,
owner: copy ? null : opt.ref.주인,
readOnly,
onChanged: (d) => (dirty = d && !readOnly),
onVersion: (v) => (version = v), // 수식 저장이 파일 판을 바꿈 — 문서 저장이 이어 받음
mode: "page", // 페이지와 같은 길 — 수식 저장 단추는 이 [저장] 한 번에 모임
mode: copy ? "memory" : "page", // 페이지와 같은 길 — 수식 저장 단추는 이 [저장] 한 번에 모임
slot,
});
const ok = createButton({
@@ -110,13 +119,17 @@ export async function openSkEdit(opt: SkEditOptions): Promise<void> {
body.append(
createText(opt.head, "muted", 14),
createText(
opt.readOnly ? `${tc("Ref_Shared")} · ${tc("Ref_ReadOnly")}` : tc("Ref_Shared"),
copy
? tc("Ref_Copy")
: opt.readOnly
? `${tc("Ref_Shared")} · ${tc("Ref_ReadOnly")}`
: tc("Ref_Shared"),
"hint",
),
host,
);
head.append(slot);
if (!opt.readOnly) head.append(ok); // [저장] = 머리 [닫기] 왼쪽
if (!readOnly) head.append(ok); // [저장] = 머리 [닫기] 왼쪽
},
});
}
@@ -7,15 +7,16 @@
* 금액 빠짐) → 그 줄 금액 · 합계 바로(짝 셈 `Labor_Calc.settle`) · 구조물 조합 · 공사 알약이 이어지면 그 값이 앞섬
* · 합계 열 = 「기준단위 단가」(줄 1 단위) · 「수량 반영 금액」(× 수량)
* · 머리 단추 = [항목 추가](736-1 · 자재는 찾기 창에서 고름 → 자재 목록) · 줄 우클릭 · 줄 끝 ⋯ = 위로 · 아래로 · 별칭 · 삭제
* · 줄 누름 = 줄 모달(`Labor_RowModal` — 옵션 · 메모 · 켜쌓기율 · 로직 자재 바꾸기 · 세 칸 · 안내 한 줄 · 856-1) ·
* 사전조합 참조 줄 = 서고 원본 모달(`Labor_RefEdit`) · 사용자 자재 줄 = 자재 모달(세 칸)
* · 줄 누름 = 단가산출 줄 = 줄 쌓기(`Labor_SkEdit` · 프로젝트 사본 = 굳힌 문서 보기만 · 856-3) ·
* 사전조합 참조 줄 = 서고 원본 모달(`Labor_RefEdit`) · 사용자 자재 줄 = 자재 모달(세 칸) ·
* M01 로직을 바로 담은 줄 = 안내 한 줄(창 없음 · 새로 안 생김)
* · 금액 = 서버 calc(최신 응답만 · 저장 안 함) · [저장]은 UI_Main(서버가 다시 셈)
* · 안 이은 고정 줄(729-3) = 격자 위 띠 · [연결](`Labor_Unlinked` — 이음만 · 저장은 [저장])
* 구조물 조합 일위대가(카드 · 열 상세 · PLAN 806-1)도 이 한 부품 — `mode` 없음 = 조합 갈래: 정보 칸(이름 · 구분)
* 없음 · 수량 칸 = 수량산출 모달(`Labor_Combo` — 면적산출 잇기) · 규격 열 줄(`Labor_Spec`) · 다이어그램(열 상세) ·
* 새 줄 수량 = 면적을 따름(빈 값). 단가산출(SK) 참조 줄 누름 = 그 단가산출 문서 모달(`Labor_SkEdit` — 수식 탭 · 저장 = 그 SK).
* 811-1(요구 707-1) — 단가산출 줄 = SK 참조 한 행(저장 때 안 펼침) · [로직 추가] M01 기초 = 이 층 SK 사본 · 다른 층 SK =
* 이 층 사본 뒤 참조(`Labor_SkPick`) · 프로젝트 · 셈 주입 = 옛 로직 줄.
* 이 층 사본 뒤 참조(`Labor_SkPick`) · 프로젝트 · 셈 주입 표 = 늘 보기만이라 [로직 추가] 없음(856-3).
* ========================================================================== */
import { createButton, createInputField, el, showToast } from "@ui/ui_template_elements";
@@ -49,7 +50,7 @@ import { unlinkedBar } from "./M02_MasterTemplete_Labor_Unlinked";
import { pasteInto } from "./M02_MasterTemplete_Labor_Paste";
import { openLogicPicker, withSangeun } from "./M02_MasterTemplete_Labor_Pick";
import { openRefEdit } from "./M02_MasterTemplete_Labor_RefEdit";
import { openMatModal, openRowModal } from "./M02_MasterTemplete_Labor_RowModal";
import { openMatModal } from "./M02_MasterTemplete_Labor_RowModal";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import { insideKeys } from "./M02_Labor_LogicMats_Model";
import { valueLine } from "./M02_Labor_Values_Model";
@@ -333,26 +334,23 @@ export function mountLaborTable(
closed: () => alive && recalc(),
});
if (row.고정) return; // 고정 줄 = 숫자 그대로(이름 · 별칭은 우클릭)
// 단가산출(SK) 줄 = 그 단가산출 문서 모달(수식 탭 · 806-1) — 셈 주입(프로젝트 복사본)엔 줄 모달(안내 · 856-3 까지)
if (isSkRef(row.참조) && !opt.calc)
return void openSkEdit({
ref: row.참조,
title: nameOf(row),
head: head(),
readOnly: !edit || row.참조.층 !== opt.layer,
closed: (done) => alive && done && recalc(), // 저장했으면 금액을 다시 셈
});
openRowModal({
row,
logic: logics.get(row.로직) ?? null,
if (!isSkRef(row.참조)) return showToast(tc("Logic_Direct"), "info"); // M01 로직 줄 — 창 없음(856-3)
const ref = row.참조;
const sk = {
ref,
title: nameOf(row),
head: head(),
watch,
readOnly: !edit,
inject: !!opt.calc,
userMats: cur.자재.map((m) => m.코드),
done: (again) => changed(!again),
});
readOnly: !edit || ref.층 !== opt.layer,
closed: (done: boolean) => alive && done && recalc(), // 저장했으면 금액을 다시 셈
};
// 단가산출(SK) 줄 = 그 단가산출 문서 줄 쌓기(806-1) · 프로젝트 사본 = 굳힌 문서 보기만(856-3)
if (!opt.skCopy) return void openSkEdit(sk);
void opt
.skCopy(ref)
.then(
(copy) => (copy ? void openSkEdit({ ...sk, copy }) : showToast(tc("Sk_NoCopy"), "error")),
failed,
);
}
function openMat(i: number): void {
const mat = cur.자재[i];
@@ -456,7 +454,7 @@ export function mountLaborTable(
changed();
},
};
/** SK 사본 길(811-1) — M02 층 일위대가 · 조합만(프로젝트 · 셈 주입 = 옛 로직 줄) */
/** SK 사본 길(811-1) — M02 층 일위대가 · 조합만(프로젝트 · 셈 주입 = 늘 보기만 · [로직 추가] 없음 · 856-3) */
const own: SkPickScope | null =
opt.layer !== "project" && !opt.calc ? { layer: opt.layer, owner: library.owner } : null;
const addLogic = createButton({
@@ -464,16 +462,12 @@ export function mountLaborTable(
variant: "filled",
onClick: () =>
openLogicPicker((x) => {
// 811-1 — M01 기초 = 이 층 SK 사본 참조 한 행(펼치지 않음)
if (own)
// 811-1 — M01 기초 = 이 층 SK 사본 참조 한 행(펼치지 않음)
return void skFromLogic(own, x.키).then(
void skFromLogic(own, x.키).then(
(r) => r && alive && addRef(r, x.이름 || x.키, null),
failed,
);
if (cur.담은로직.some((r) => r.로직 === x.키))
return showToast(tc("Labor_Already").replace("{value}", `${x.키} ${x.이름}`), "error");
cur.담은로직.push({ 로직: x.키, 별칭: null, 메모: null, 입력값: {}, 수량: fresh() });
void loadLogics().then(() => changed());
}, withSangeun(library)),
});
@@ -538,7 +532,7 @@ export function mountLaborTable(
className: "m01-logic__section-head",
children: [
el("h3", { text: tc("Grid_Title") }),
...(edit && !(combo && opt.card)
...(edit && own && !(combo && opt.card)
? [el("div", { className: "ui-btn-group", children: [addLogic] })]
: []),
],
@@ -42,6 +42,15 @@ const TEXT = {
"Edits the library original — every structure using it follows",
],
Ref_ReadOnly: ["이 층은 고칠 수 없음 — 읽기만", "Read-only layer"],
Ref_Copy: [
"프로젝트 사본 — 보기만 · 고침은 M02 단가산출에서 고쳐 [재생성]",
"Project copy — view only · edit the build-up in M02 and regenerate",
],
Sk_NoCopy: ["사본에 이 단가산출 문서가 없음", "This copy has no build-up document"],
Logic_Direct: [
"M01 로직을 바로 담은 줄 — 단가산출 화면 없음 · 단가산출로 담아 쓰세요(일위대가 [로직 추가])",
"Uses the M01 logic directly — add it as a build-up to view or edit",
],
Lib_SaveFailed: ["저장 못 함", "Save failed"],
Ref_Discard: ["저장 안 한 고침을 버리고 닫음?", "Discard unsaved edits?"],
Labor_Source: ["원문", "Source"],
@@ -109,13 +118,9 @@ const TEXT = {
],
Labor_Code: ["코드", "Code"],
Labor_Spec: ["규격", "Spec"],
Labor_Already: ["이미 담은 단가산출 기초 — {value}", "Already added — {value}"],
Labor_AlreadyMat: ["이미 담은 자재 — {value}", "Already added — {value}"],
// 로직 자재(103-1)
Labor_InLogicMat: ["로직 자재에 있는 품목 — {value}", "Already a logic material — {value}"],
LogicMat_Swap: ["바꾸기", "Change"],
LogicMat_Reset: ["기본", "Default"],
LogicMat_PickTitle: ["로직 자재 바꾸기", "Change logic material"],
LogicMat_Inside: [
"로직 단가 안 금액 — 합계에 다시 안 더함",
"Inside the logic price — not added again",