Files
Aislo/B09_Estimation/B09_Estimation_UI_Shell.ts
T
eomsangdonandClaude Opus 5 ef48e6edd3 refactor(b09): 옛 탭 옮기기 ⑤ 기초자료 — 산출 조건(UI_Factors) · 목록표 셋 · 자재단가대비표 · 환율및기초자료를 새 틀 탭 파일로
- 저장하면 이 탭 자료와 설계내역서 한 벌(UI_Store forgetBill)을 함께 새로 받음 — 값이 다시 섬
- 화면 확인: 옮기기 전후 같음 — 표 6 · 줄 737 · 고르개 32 개 고른 값 전부 같음 · 숫자 칸 2 · 글 35,074 자
- 계산 입력 확인: 기계 작업효율 E 평균 0.50 → 상한 0.55 를 화면에서 고르면 「사용자가 고른 값」 · 제 2 호표 2,511 → 2,284 ·
  되돌린 뒤(기본값) 2,511 그대로 — 검증 프로젝트 설정 원래대로 복구

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016VBGFXB9AbJBwXP19z75Qq
2026-09-14 02:47:03 +09:00

97 lines
3.7 KiB
TypeScript

/* =============================================================================
* B09_Estimation_UI_Shell.ts
* 로그인 후 09: 6차 워크플로우 (원가계산) — 화면 **틀** (PLAN 12장 · 2026-09-14 브레인 판정)
*
* - 틀은 탭 줄과 등록만. 탭마다 파일 하나(`B09_Estimation_UI_Tab_<이름>.ts`) — 계약은 `_Shell_Types`.
* - ⚠ 등록 권한 = 랩탑_서브. 다른 창은 탭 파일을 만들고 이름을 알려 등록을 부탁함.
* - 탭을 고를 때마다 본문·좌측 칸을 비우고 `render(ctx, arg)`. `ctx.open(key, arg)` = 다른 탭으로 들어가기.
* ========================================================================== */
import { createWorkflowLayout } from "@ui/ui_template_workflow_layout";
import { CURRENT_PROJECT_ID_KEY } from "@config/config_frontend";
import { workflowSteps } from "../A00_Common/b_page_scaffold";
import { goToWorkflowStage, WORKFLOW_STEP_ROUTES } from "../A00_Common/b_workflow_nav";
import type { B09Tab, B09TabContext } from "./B09_Estimation_UI_Shell_Types";
import { L, el, injectSheetStyles } from "./B09_Estimation_UI_Sheet";
import { costSheetTab } from "./B09_Estimation_UI_Tab_CostSheet";
import { rateTableTab } from "./B09_Estimation_UI_Tab_RateTable";
import { billTab } from "./B09_Estimation_UI_Tab_Bill";
import { unitPriceTab } from "./B09_Estimation_UI_Tab_UnitPrice";
import { priceBasisTab } from "./B09_Estimation_UI_Tab_PriceBasis";
import { machineTab } from "./B09_Estimation_UI_Tab_Machine";
import { priceCompareTab } from "./B09_Estimation_UI_Tab_PriceCompare";
import { summaryTab } from "./B09_Estimation_UI_Tab_Summary";
import { listsTab } from "./B09_Estimation_UI_Tab_Lists";
import { designDocTab } from "./B09_Estimation_UI_Tab_DesignDoc";
import { basisSheetTab } from "./B09_Estimation_UI_Tab_BasisSheet";
import { supplyTab } from "./B09_Estimation_UI_Tab_Supply";
import { baseDataTab } from "./B09_Estimation_UI_Tab_BaseData";
/** 탭 등록 — 한 줄에 탭 하나. */
const TABS: B09Tab[] = [
costSheetTab, // 랩탑_메인
rateTableTab, // 랩탑_메인
billTab,
unitPriceTab,
priceBasisTab,
machineTab,
priceCompareTab,
summaryTab,
listsTab,
supplyTab,
baseDataTab,
designDocTab,
basisSheetTab,
];
export async function renderB09Estimation(root: HTMLElement): Promise<void> {
injectSheetStyles();
const projectId = localStorage.getItem(CURRENT_PROJECT_ID_KEY);
const page = el("div", "b09s-page");
const bar = el("div", "b09s-tabs");
const body = el("div", "b09s-body");
const panel = el("div");
page.append(bar, body);
let active = TABS[0].key;
const open = (key: string, arg?: string): void => {
const tab = TABS.find((item) => item.key === key);
if (!tab) return;
active = key;
drawBar();
body.replaceChildren();
panel.replaceChildren();
const ctx: B09TabContext = { projectId, body, panel, root, open };
tab.render(ctx, arg);
};
const drawBar = (): void => {
bar.replaceChildren(
...TABS.map((tab) => {
const button = el(
"button",
`b09s-tab${tab.key === active ? " is-active" : ""}`,
tab.label(),
);
button.type = "button";
button.dataset.tab = tab.key;
button.addEventListener("click", () => open(tab.key));
return button;
}),
);
};
const layout = createWorkflowLayout({
title: L("B09_Estimation_Title"),
steps: workflowSteps(),
activeStep: 6,
leftPanel: panel,
mainContent: page,
routes: WORKFLOW_STEP_ROUTES,
onStepClick: (stepIndex) => {
if (projectId) goToWorkflowStage(projectId, WORKFLOW_STEP_ROUTES[stepIndex]);
},
});
root.append(layout.root);
open(active);
}