From 2650b7c0bb0ea12b68a58c0439f72d61df04b2f1 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 25 Jul 2025 07:51:15 +0000
Subject: (대표님) 정기평가 대상, 미들웨어 수정, nextauth 토큰 처리 개선, GTC
 등 (최겸) 기술영업
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/possible-items-table-columns.tsx         | 86 ++++++++++++----------
 1 file changed, 47 insertions(+), 39 deletions(-)

(limited to 'lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx')

diff --git a/lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx b/lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx
index 7fdcc900..e9707a88 100644
--- a/lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx
+++ b/lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx
@@ -4,22 +4,8 @@ import { ColumnDef } from "@tanstack/react-table";
 import { Checkbox } from "@/components/ui/checkbox";
 import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header";
 import Link from "next/link";
-// 타입만 import
-type TechVendorPossibleItemsData = {
-  id: number;
-  vendorId: number;
-  vendorCode: string | null;
-  vendorName: string;
-  techVendorType: string;
-  vendorStatus: string;
-  itemCode: string;
-  itemList: string | null;
-  workType: string | null;
-  shipTypes: string | null;
-  subItemList: string | null;
-  createdAt: Date;
-  updatedAt: Date;
-};
+// 새로운 스키마에 맞는 타입 import
+import type { TechVendorPossibleItemsData } from "../service";
 import { format } from "date-fns";
 import { ko } from "date-fns/locale";
 import { Badge } from "@/components/ui/badge";
@@ -152,6 +138,22 @@ export function getColumns(): ColumnDef<TechVendorPossibleItemsData>[] {
         );
       },
     },
+    {
+      accessorKey: "vendorEmail",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="벤더이메일" />
+      ),
+      cell: ({ row }) => {
+        const vendorEmail = row.getValue("vendorEmail") as string | null;
+        return <div className="max-w-[200px] truncate">{vendorEmail || "-"}</div>;
+      },
+      filterFn: (row, id, value) => {
+        const vendorEmail = row.getValue(id) as string | null;
+        if (!value) return true;
+        if (!vendorEmail) return false;
+        return vendorEmail.toLowerCase().includes(value.toLowerCase());
+      },
+    },
     {
       accessorKey: "techVendorType",
       header: ({ column }) => (
@@ -216,29 +218,35 @@ export function getColumns(): ColumnDef<TechVendorPossibleItemsData>[] {
       },
     },
 
-    {
-      accessorKey: "vendorStatus",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="벤더상태" />
-      ),
-      cell: ({ row }) => {
-        const vendorStatus = row.getValue("vendorStatus") as string;
-        const getStatusColor = (status: string) => {
-          switch (status) {
-            case "ACTIVE": return "bg-green-100 text-green-800";
-            case "PENDING_INVITE": return "bg-yellow-100 text-yellow-800";
-            case "PENDING_REVIEW": return "bg-blue-100 text-blue-800";
-            case "INACTIVE": return "bg-gray-100 text-gray-800";
-            default: return "bg-gray-100 text-gray-800";
-          }
-        };
-        return (
-          <Badge className={getStatusColor(vendorStatus)}>
-            {vendorStatus}
-          </Badge>
-        );
-      },
-    },
+    // {
+    //   accessorKey: "vendorStatus",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="벤더상태" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const vendorStatus = row.getValue("vendorStatus") as string;
+    //     const getStatusColor = (status: string) => {
+    //       switch (status) {
+    //         case "ACTIVE": return "bg-green-100 text-green-800";
+    //         case "PENDING_INVITE": return "bg-yellow-100 text-yellow-800";
+    //         case "PENDING_REVIEW": return "bg-blue-100 text-blue-800";
+    //         case "INACTIVE": return "bg-gray-100 text-gray-800";
+    //         default: return "bg-gray-100 text-gray-800";
+    //       }
+    //     };
+    //     return (
+    //       <Badge className={getStatusColor(vendorStatus)}>
+    //         {vendorStatus}
+    //       </Badge>
+    //     );
+    //   },
+    //   filterFn: (row, id, value) => {
+    //     const vendorStatus = row.getValue(id) as string;
+    //     if (!value) return true;
+    //     if (!vendorStatus) return false;
+    //     return vendorStatus === value;
+    //   },
+    // },
     {
       accessorKey: "createdAt",
       header: ({ column }) => (
-- 
cgit v1.2.3

