From e4b2bef735e6aab6a5ecae9a017c5c618a6d3a4b Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Thu, 3 Jul 2025 02:48:24 +0000
Subject: (최겸) 기술영업 벤더 아이템 조회 아이콘 기능 추가
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/tech-vendors-table-columns.tsx           | 50 ++++++++++++++++++----
 1 file changed, 41 insertions(+), 9 deletions(-)

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

diff --git a/lib/tech-vendors/table/tech-vendors-table-columns.tsx b/lib/tech-vendors/table/tech-vendors-table-columns.tsx
index 22e89dd0..438fceac 100644
--- a/lib/tech-vendors/table/tech-vendors-table-columns.tsx
+++ b/lib/tech-vendors/table/tech-vendors-table-columns.tsx
@@ -3,7 +3,7 @@
 import * as React from "react"
 import { type DataTableRowAction } from "@/types/table"
 import { type ColumnDef } from "@tanstack/react-table"
-import { Ellipsis } from "lucide-react"
+import { Ellipsis, Package } from "lucide-react"
 import { toast } from "sonner"
 
 import { getErrorMessage } from "@/lib/handle-error"
@@ -47,6 +47,7 @@ type NextRouter = ReturnType<typeof useRouter>;
 interface GetColumnsProps {
   setRowAction: React.Dispatch<React.SetStateAction<DataTableRowAction<TechVendor> | null>>;
   router: NextRouter;
+  openItemsDialog: (vendor: TechVendor) => void;
 }
 
 
@@ -55,7 +56,7 @@ interface GetColumnsProps {
 /**
  * tanstack table 컬럼 정의 (중첩 헤더 버전)
  */
-export function getColumns({ setRowAction, router }: GetColumnsProps): ColumnDef<TechVendor>[] {
+export function getColumns({ setRowAction, router, openItemsDialog }: GetColumnsProps): ColumnDef<TechVendor>[] {
   // ----------------------------------------------------------------
   // 1) select 컬럼 (체크박스)
   // ----------------------------------------------------------------
@@ -230,12 +231,6 @@ export function getColumns({ setRowAction, router }: GetColumnsProps): ColumnDef
                   className: "bg-slate-800 text-white border-slate-900",
                   iconColor: "text-white"
                 };
-              case "PENDING_REVIEW":
-                return {
-                  variant: "default",
-                  className: "bg-gray-100 text-gray-800 border-gray-300",
-                  iconColor: "text-gray-600"
-                };
               default:
                 return {
                   variant: "default",
@@ -251,7 +246,7 @@ export function getColumns({ setRowAction, router }: GetColumnsProps): ColumnDef
               "ACTIVE": "활성 상태",
               "INACTIVE": "비활성 상태",
               "BLACKLISTED": "거래 금지",
-              "PENDING_REVIEW": "비교 견적",
+              "PENDING_REVIEW": "비교 견적"
             };
             
             return statusMap[status] || status;
@@ -306,6 +301,43 @@ export function getColumns({ setRowAction, router }: GetColumnsProps): ColumnDef
     }
   });
 
+  // Possible Items 컬럼 추가 (액션 컬럼 직전에)
+  const possibleItemsColumn: ColumnDef<TechVendor> = {
+    id: "possibleItems",
+    header: ({ column }) => (
+      <DataTableColumnHeaderSimple column={column} title="자재 그룹" />
+    ),
+    cell: ({ row }) => {
+      const vendor = row.original;
+
+      const handleClick = () => {
+        openItemsDialog(vendor);
+      };
+
+      return (
+        <Button
+          variant="ghost"
+          size="sm"
+          className="relative h-8 w-8 p-0 group"
+          onClick={handleClick}
+          aria-label="View possible items"
+        >
+          <Package className="h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" />
+          <span className="sr-only">
+            Possible Items 보기
+          </span>
+        </Button>
+      );
+    },
+    enableSorting: false,
+    enableResizing: false,
+    size: 80,
+    meta: {
+      excelHeader: "Possible Items"
+    },
+  };
+
+  columns.push(possibleItemsColumn);
   columns.push(actionsColumn); // 마지막에 액션 컬럼 추가
    
   return columns;
-- 
cgit v1.2.3

