From ef4c533ebacc2cdc97e518f30e9a9350004fcdfb Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 28 Apr 2025 02:13:30 +0000
Subject: ~20250428 작업사항
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/tbe/table/tbe-table-toolbar-actions.tsx | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

(limited to 'lib/tbe/table/tbe-table-toolbar-actions.tsx')

diff --git a/lib/tbe/table/tbe-table-toolbar-actions.tsx b/lib/tbe/table/tbe-table-toolbar-actions.tsx
index 6a336135..cf6a041e 100644
--- a/lib/tbe/table/tbe-table-toolbar-actions.tsx
+++ b/lib/tbe/table/tbe-table-toolbar-actions.tsx
@@ -28,19 +28,31 @@ export function VendorsTableToolbarActions({ table,rfqId }: VendorsTableToolbarA
     fileInputRef.current?.click()
   }
 
+  // 선택된 행이 있는 경우 rfqId 확인
+  const uniqueRfqIds = table.getFilteredSelectedRowModel().rows.length > 0 
+    ? [...new Set(table.getFilteredSelectedRowModel().rows.map(row => row.original.rfqId))]
+    : [];
+  
+  const hasMultipleRfqIds = uniqueRfqIds.length > 1;
+
+  const invitationPossibeVendors = React.useMemo(() => {
+    return table
+      .getFilteredSelectedRowModel()
+      .rows
+      .map(row => row.original)
+      .filter(vendor => vendor.technicalResponseStatus === null);
+  }, [table.getFilteredSelectedRowModel().rows]);
+  
   return (
     <div className="flex items-center gap-2">
-      {table.getFilteredSelectedRowModel().rows.length > 0 ? (
+      {invitationPossibeVendors.length > 0 && (
         <InviteVendorsDialog
-          vendors={table
-            .getFilteredSelectedRowModel()
-            .rows.map((row) => row.original)}
-          rfqId = {rfqId}
+          vendors={invitationPossibeVendors}
+          rfqId={rfqId}
           onSuccess={() => table.toggleAllRowsSelected(false)}
+          hasMultipleRfqIds={hasMultipleRfqIds}
         />
-      ) : null}
-
-    
+      )}
       <Button
         variant="outline"
         size="sm"
-- 
cgit v1.2.3

