fix(M02 카드 번호 배지): 카드 머리 번호(SD · SU · SA) 배지 = 시스템 관리자에게만 · 그 밖은 이름 풍선말로만

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 19:48:27 +09:00
co-authored by Claude Sonnet 5.5
parent 4603a08c6c
commit 78878e13f4
@@ -38,6 +38,7 @@ import type { ItemPart, ItemSource } from "./M02_MasterTemplete_ItemSource";
import type { LaborDetailHandle } from "./M02_MasterTemplete_Labor_Detail";
import "./M02_MasterTemplete_Structure.css";
import { createBadge } from "@ui/ui_template_badge";
import { fetchSessionUser } from "../A06_Login/A06_Login_Api_Fetch";
/** 집계표 열 하나에 딸린 문서 셋 — 번호 칸 · 이름 */
export type EditKind = ItemPart;
@@ -188,6 +189,10 @@ export function createItemCards(opts: ItemCardsOptions): ItemCardsHandle {
const reload = (): void => void load(column ? { id: column, label } : null, true);
/** 카드 틀 하나 — 제목 옆 = ? · 제목 줄 오른쪽 = [저장] · [〇〇 수정](빈 단추 한 모양) · 부제 = 번호 · 이름 */
const setNo = (card: Pick<Card, "no" | "name">, text: string): void => {
card.no.textContent = text;
card.name.title = text;
};
const makeCard = (
kind: CardKind,
title: string,
@@ -195,7 +200,10 @@ export function createItemCards(opts: ItemCardsOptions): ItemCardsHandle {
save: () => Promise<void>,
) => {
const no = createBadge("", "accent"); // 번호 = 배지 부품
no.hidden = !!opts.picker;
no.hidden = true; // 번호 배지 = 시스템 관리자에게만 · 그 밖은 이름 풍선말
void fetchSessionUser().then((user) => {
no.hidden = user?.role !== "SYSTEM_ADMIN";
});
no.classList.add("m02-struct__no");
const name = el("span", { className: "m02-struct__title" });
const shell = cardShell({ title, body, sub: [no, name] });
@@ -312,8 +320,10 @@ export function createItemCards(opts: ItemCardsOptions): ItemCardsHandle {
if (mine !== seq) return;
laborVer = got.판 ?? "";
const d = (got.문서 ?? {}) as { 일위대가번?: string };
laborCard.no.textContent =
d.일위대가번 || numberOf("labor", at) || fill(TEXT.noFieldNumber, PART_FIELD.labor);
setNo(
laborCard,
d.일위대가번 || numberOf("labor", at) || fill(TEXT.noFieldNumber, PART_FIELD.labor),
);
const via = src.labor; // 자료 자리 길(142-1 · 고르기 모달) — 셈 · 면적도 그 자리에서
laborEd = mod.mountLaborDetail(laborHost, got.문서, {
layer,
@@ -449,10 +459,9 @@ export function createItemCards(opts: ItemCardsOptions): ItemCardsHandle {
const paintBody = (mine: number): void => {
const at = column ?? "";
paintTools();
info.no.textContent = doc?.도번 || numberOf("structure", at) || TEXT.noNumber;
setNo(info, doc?.도번 || numberOf("structure", at) || TEXT.noNumber);
for (const c of sheets) {
c.no.textContent =
c.number || numberOf(c.kind, at) || fill(TEXT.noFieldNumber, PART_FIELD[c.kind]);
setNo(c, c.number || numberOf(c.kind, at) || fill(TEXT.noFieldNumber, PART_FIELD[c.kind]));
void paintSheet(c, mine);
}
paintDrawing();
@@ -505,7 +514,7 @@ export function createItemCards(opts: ItemCardsOptions): ItemCardsHandle {
column = col.id;
label = col.label;
for (const c of cards) c.name.textContent = label;
info.no.textContent = numberOf("structure", col.id) || TEXT.noNumber;
setNo(info, numberOf("structure", col.id) || TEXT.noNumber);
doc = null;
docVersion = null;
previewHost.replaceChildren();