From 8547034e6d82e4d1184f35af2dbff67180d89dc8 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Wed, 26 Nov 2025 18:09:18 +0900
Subject: (김준회) dolce: 동기화 기능 추가, 로컬 다운로드, 삭제 추가, 동기화
 dialog 개선 등
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/dolce/table/detail-drawing-columns.tsx | 81 ++++++++----------------------
 1 file changed, 20 insertions(+), 61 deletions(-)

(limited to 'lib/dolce/table/detail-drawing-columns.tsx')

diff --git a/lib/dolce/table/detail-drawing-columns.tsx b/lib/dolce/table/detail-drawing-columns.tsx
index 747173af..30290817 100644
--- a/lib/dolce/table/detail-drawing-columns.tsx
+++ b/lib/dolce/table/detail-drawing-columns.tsx
@@ -13,54 +13,6 @@ import {
 import { Button } from "@/components/ui/button";
 import { Edit } from "lucide-react";
 
-// DOLCE API ENM 필드가 제대로 번역되지 않아 직접 매핑
-const DRAWING_USAGE_MAP: Record<string, { ko: string; en: string }> = {
-  APP: { ko: "승인용", en: "Approval" },
-  WOR: { ko: "작업용", en: "Working" },
-  // 참조용은 eVCP에서 사용하지 않으나 추가해둠
-  REF: { ko: "참조용", en: "Reference" },
-  REC: { ko: "입수용", en: "GTT→SHI" },
-  SUB: { ko: "제출용", en: "SHI→GTT" },
-  CMT: { ko: "코멘트", en: "Comment" },
-};
-
-const REGISTER_KIND_MAP: Record<string, { ko: string; en: string }> = {
-  APPR: { ko: "승인 제출용 도면(Full)", en: "For Approval(Full)" },
-  APPP: { ko: "승인 제출용 도면(Partial)", en: "For Approval(Partial)" },
-  WORK: { ko: "작업용 입수도면(Full)", en: "For Working(Full)" },
-  WORP: { ko: "작업용 입수도면(Partial)", en: "For Working(Partial)" },
-  RECW: { ko: "Working 도면입수(GTT→SHI)", en: "Working Dwg(GTT→SHI)" },
-  RECP: { ko: "Pre. 도면입수(GTT→SHI)", en: "Pre. Dwg(GTT→SHI)" },
-  GSUB: { ko: "SHI 입력 문서 (SHI→GTT)", en: "SHI Input Document(SHI→GTT)" },
-  CMTQ: { ko: "Comment-TQ", en: "Comment-TQ" },
-  CMTM: { ko: "MARK-UP", en: "MARK-UP" },
-  // FMEA는 미사용 코드
-  "FMEA-R1": { ko: "FMEA 1st Receipt", en: "FMEA 1st Receipt" },
-  "FMEA-R2": { ko: "FMEA 2nd Receipt", en: "FMEA 2nd Receipt" },
-  "FMEA-1": { ko: "FMEA 1st Submission", en: "FMEA 1st Submission" },
-  "FMEA-2": { ko: "FMEA 2nd Submission", en: "FMEA 2nd Submission" },
-  // 참조용 도면도 미사용 코드, 번역 받아야 적용 가능
-  PREF: { ko: "본선용 참조도면", en: "본선용 참조도면" },
-  RREF: { ko: "실적선 참조도면", en: "실적선 참조도면" },
-  "PREP-P": { ko: "본선용 참조도면(Partial)", en: "본선용 참조도면(Partial)" },
-  "RREP-P": { ko: "실적선 참조도면(Partial)", en: "실적선 참조도면(Partial)" },
-};
-
-// 카테고리는 API에서 ENM이 제공되는 것으로 가정 (필요시 추가)
-const translateDrawingUsage = (code: string | null, lng: string): string => {
-  if (!code) return "";
-  const mapped = DRAWING_USAGE_MAP[code];
-  if (!mapped) return code;
-  return lng === "en" ? mapped.en : mapped.ko;
-};
-
-const translateRegisterKind = (code: string | null, lng: string): string => {
-  if (!code) return "";
-  const mapped = REGISTER_KIND_MAP[code];
-  if (!mapped) return code;
-  return lng === "en" ? mapped.en : mapped.ko;
-};
-
 // Comment Dialog Component
 function CommentDialog({ comment }: { comment: string }) {
   const [open, setOpen] = useState(false);
@@ -99,9 +51,14 @@ export function createDetailDrawingColumns(
     {
       accessorKey: "RegisterSerialNo",
       header: t("detailDrawing.columns.serialNo"),
-      minSize: 80,
+      minSize: 120,
       cell: ({ row }) => {
-        return <div className="text-center">{row.getValue("RegisterSerialNo")}</div>;
+        const val = row.getValue("RegisterSerialNo") as number;
+        const status = row.getValue("Status") as string;
+        if (val === 0 || status === "EVCP Saved") {
+            return <div className="text-center">-</div>;
+        }
+        return <div className="text-center">{val}</div>;
       },
     },
     {
@@ -125,10 +82,8 @@ export function createDetailDrawingColumns(
       header: t("detailDrawing.columns.category"),
       minSize: 120,
       cell: ({ row }) => {
-        const categoryENM = row.getValue("CategoryENM") as string;
-        const categoryNM = row.original.CategoryNM;
-        // 영어인 경우 ENM, 한국어인 경우 NM 사용
-        return <div>{lng === "en" ? (categoryENM || categoryNM) : (categoryNM || categoryENM)}</div>;
+        // 항상 CategoryENM 필드를 보여줌
+        return <div>{row.getValue("CategoryENM")}</div>;
       },
     },
     // RegisterKind 로 DrawingUsage를 알 수 있으므로 주석 처리
@@ -144,14 +99,12 @@ export function createDetailDrawingColumns(
     //   },
     // },
     {
-      accessorKey: "RegisterKind",
+      accessorKey: "RegisterKindENM",
       header: t("detailDrawing.columns.registerKind"),
       minSize: 180,
       cell: ({ row }) => {
-        // API 응답의 RegisterKind는 코드값이므로 직접 매핑하여 번역
-        const kindCode = row.getValue("RegisterKind") as string;
-        const translated = translateRegisterKind(kindCode, lng);
-        return <div>{translated}</div>;
+        // 항상 RegisterKindENM 필드를 보여줌
+        return <div>{row.getValue("RegisterKindENM")}</div>;
       },
     },
     {
@@ -193,12 +146,18 @@ export function createDetailDrawingColumns(
         const isEditable = status === "Submitted";
         
         return (
-          <div className="flex items-center justify-center">
+          <div
+            className="flex items-center justify-center"
+            onClick={(e) => e.stopPropagation()}
+          >
             <Button
               variant="ghost"
               size="sm"
               disabled={!isEditable || !onEdit}
-              onClick={() => onEdit && onEdit(row.original)}
+              onClick={(e) => {
+                e.stopPropagation();
+                if (onEdit) onEdit(row.original);
+              }}
               title={!isEditable ? t("editDetailDialog.statusSubmittedOnly") : t("editDetailDialog.editButton")}
             >
               <Edit className="h-4 w-4" />
-- 
cgit v1.2.3

