From 90f79a7a691943a496f67f01c1e493256070e4de Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 7 Jul 2025 01:44:45 +0000
Subject: (대표님) 변경사항 20250707 10시 43분 - unstaged 변경사항 추가
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/evaluation/table/evaluation-columns.tsx | 213 +++++++++++++++-------------
 1 file changed, 114 insertions(+), 99 deletions(-)

(limited to 'lib/evaluation/table/evaluation-columns.tsx')

diff --git a/lib/evaluation/table/evaluation-columns.tsx b/lib/evaluation/table/evaluation-columns.tsx
index 10aa7704..e88c5764 100644
--- a/lib/evaluation/table/evaluation-columns.tsx
+++ b/lib/evaluation/table/evaluation-columns.tsx
@@ -8,10 +8,11 @@ import { type ColumnDef } from "@tanstack/react-table";
 import { Checkbox } from "@/components/ui/checkbox";
 import { Badge } from "@/components/ui/badge";
 import { Button } from "@/components/ui/button";
-import { Pencil, Eye, MessageSquare, Check, X, Clock, FileText } from "lucide-react";
+import { Pencil, Eye, MessageSquare, Check, X, Clock, FileText, Circle } from "lucide-react";
 import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header";
 import { PeriodicEvaluationView } from "@/db/schema";
 import { DataTableRowAction } from "@/types/table";
+import { vendortypeMap } from "@/types/evaluation";
 
 
 
@@ -48,6 +49,63 @@ const getStatusLabel = (status: string) => {
   return statusMap[status] || status;
 };
 
+// 부서별 상태 배지 함수
+const getDepartmentStatusBadge = (status: string | null) => {
+  if (!status) return (
+    <div className="flex items-center gap-1">
+      {/* <Circle className="w-4 h-4 fill-gray-300 text-gray-300" /> */}
+      <span className="text-xs text-gray-500">-</span>
+    </div>
+  );
+  
+  switch (status) {
+    case "NOT_ASSIGNED":
+      return (
+        <div className="flex items-center gap-1">
+          {/* <Circle className="w-4 h-4 fill-gray-400 text-gray-400" /> */}
+          <span className="text-xs text-gray-600">미지정</span>
+        </div>
+      );
+    case "NOT_STARTED":
+      return (
+        <div className="flex items-center gap-1">
+          <div className="w-4 h-4 rounded-full bg-red-500 shadow-sm" />
+
+          {/* <span className="text-xs text-red-600">시작전</span> */}
+        </div>
+      );
+    case "IN_PROGRESS":
+      return (
+        <div className="flex items-center gap-1">
+          <div className="w-4 h-4 rounded-full bg-yellow-500 shadow-sm" />
+          {/* <span className="text-xs text-yellow-600">진행중</span> */}
+        </div>
+      );
+    case "COMPLETED":
+      return (
+        <div className="flex items-center gap-1">
+          <div className="w-4 h-4 rounded-full bg-green-500 shadow-sm" />
+          {/* <span className="text-xs text-green-600">완료</span> */}
+        </div>
+      );
+    default:
+      return (
+        <div className="flex items-center gap-1">
+          {/* <Circle className="w-4 h-4 fill-gray-300 text-gray-300" /> */}
+          <span className="text-xs text-gray-500">-</span>
+        </div>
+      );
+  }
+};
+// 부서명 라벨
+const DEPARTMENT_LABELS = {
+  ORDER_EVAL: "발주",
+  PROCUREMENT_EVAL: "조달", 
+  QUALITY_EVAL: "품질",
+  DESIGN_EVAL: "설계",
+  CS_EVAL: "CS"
+} as const;
+
 // 등급별 색상
 const getGradeBadgeVariant = (grade: string | null) => {
   if (!grade) return "outline";
@@ -78,19 +136,15 @@ const getDivisionBadge = (division: string) => {
 
 // 자재구분 배지  
 const getMaterialTypeBadge = (materialType: string) => {
-  const typeMap = {
-    EQUIPMENT: "기자재",
-    BULK: "벌크",
-    EQUIPMENT_BULK: "기자재/벌크"
-  };
-  return <Badge variant="outline">{typeMap[materialType] || materialType}</Badge>;
+
+  return <Badge variant="outline">{vendortypeMap[materialType] || materialType}</Badge>;
 };
 
 // 내외자 배지
 const getDomesticForeignBadge = (domesticForeign: string) => {
   return (
     <Badge variant={domesticForeign === "DOMESTIC" ? "default" : "secondary"}>
-      {domesticForeign === "DOMESTIC" ? "내자" : "외자"}
+      {domesticForeign === "DOMESTIC" ? "D" : "F"}
     </Badge>
   );
 };
@@ -237,70 +291,41 @@ export function getPeriodicEvaluationsColumns({setRowAction}: GetColumnsProps):
     // 진행 현황
     // ═══════════════════════════════════════════════════════════════
     {
-      header: "평가자 진행 현황",
+      header: "부서별 평가 현황",
       columns: [
         {
-          accessorKey: "status",
-          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="진행상태" />,
-          cell: ({ row }) => {
-            const status = row.getValue<string>("status");
-            return (
-              <Badge variant={getStatusBadgeVariant(status)}>
-                {getStatusLabel(status)}
-              </Badge>
-            );
-          },
-          size: 100,
+          accessorKey: "orderEvalStatus",
+          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="발주" />,
+          cell: ({ row }) => getDepartmentStatusBadge(row.getValue("orderEvalStatus")),
+          size: 60,
         },
-
+        
         {
-          id: "reviewProgress",
-          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="리뷰진행" />,
-          cell: ({ row }) => {
-            const totalReviewers = row.original.totalReviewers || 0;
-            const completedReviewers = row.original.completedReviewers || 0;
-            
-            return getProgressBadge(completedReviewers, totalReviewers);
-          },
-          size: 120,
+          accessorKey: "procurementEvalStatus", 
+          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="조달" />,
+          cell: ({ row }) => getDepartmentStatusBadge(row.getValue("procurementEvalStatus")),
+          size: 70,
         },
-
+        
         {
-          accessorKey: "reviewCompletedAt",
-          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="검토완료일" />,
-          cell: ({ row }) => {
-            const completedAt = row.getValue<Date>("reviewCompletedAt");
-            return completedAt ? (
-              <span className="text-sm">
-                {new Intl.DateTimeFormat("ko-KR", {
-                  month: "2-digit",
-                  day: "2-digit",
-                }).format(new Date(completedAt))}
-              </span>
-            ) : (
-              <span className="text-muted-foreground">-</span>
-            );
-          },
-          size: 100,
+          accessorKey: "qualityEvalStatus",
+          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="품질" />,
+          cell: ({ row }) => getDepartmentStatusBadge(row.getValue("qualityEvalStatus")),
+          size: 70,
         },
-
+        
         {
-          accessorKey: "finalizedAt",
-          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="확정일" />,
-          cell: ({ row }) => {
-            const finalizedAt = row.getValue<Date>("finalizedAt");
-            return finalizedAt ? (
-              <span className="text-sm font-medium">
-                {new Intl.DateTimeFormat("ko-KR", {
-                  month: "2-digit",
-                  day: "2-digit",
-                }).format(new Date(finalizedAt))}
-              </span>
-            ) : (
-              <span className="text-muted-foreground">-</span>
-            );
-          },
-          size: 80,
+          accessorKey: "designEvalStatus",
+          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="설계" />,
+          cell: ({ row }) => getDepartmentStatusBadge(row.getValue("designEvalStatus")),
+          size: 70,
+        },
+        
+        {
+          accessorKey: "csEvalStatus",
+          header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="CS" />,
+          cell: ({ row }) => getDepartmentStatusBadge(row.getValue("csEvalStatus")),
+          size: 70,
         },
       ]
     },
@@ -321,7 +346,7 @@ export function getPeriodicEvaluationsColumns({setRowAction}: GetColumnsProps):
               </Badge>
             );
           },
-          size: 100,
+          size: 120,
         },
 
         {
@@ -519,7 +544,7 @@ export function getPeriodicEvaluationsColumns({setRowAction}: GetColumnsProps):
               <span className="text-muted-foreground">-</span>
             );
           },
-          size: 80,
+          minSize: 100,
         },
 
       ]
@@ -528,38 +553,28 @@ export function getPeriodicEvaluationsColumns({setRowAction}: GetColumnsProps):
 
 
     // ░░░ Actions ░░░
-    // {
-    //   id: "actions",
-    //   enableHiding: false,
-    //   size: 40,
-    //   minSize: 40,
-    //   cell: ({ row }) => {
-    //     return (
-    //       <div className="flex items-center gap-1">
-    //         <Button
-    //           variant="ghost"
-    //           size="icon"
-    //           className="size-8"
-    //           onClick={() => setRowAction({ row, type: "view" })}
-    //           aria-label="상세보기"
-    //           title="상세보기"
-    //         >
-    //           <Eye className="size-4" />
-    //         </Button>
-
-    //         <Button
-    //           variant="ghost"
-    //           size="icon"
-    //           className="size-8"
-    //           onClick={() => setRowAction({ row, type: "update" })}
-    //           aria-label="수정"
-    //           title="수정"
-    //         >
-    //           <Pencil className="size-4" />
-    //         </Button>
-    //       </div>
-    //     );
-    //   },
-    // },
+    {
+      id: "actions",
+      enableHiding: false,
+      size: 40,
+      minSize: 40,
+      cell: ({ row }) => {
+        return (
+          <div className="flex items-center gap-1">
+            <Button
+              variant="ghost"
+              size="icon"
+              className="size-8"
+              onClick={() => setRowAction({ row, type: "view" })}
+              aria-label="상세보기"
+              title="상세보기"
+            >
+              <Eye className="size-4" />
+            </Button>
+
+          </div>
+        );
+      },
+    },
   ];
 }
\ No newline at end of file
-- 
cgit v1.2.3

