summaryrefslogtreecommitdiff
path: root/lib/tbe/table/tbe-table-toolbar-actions.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tbe/table/tbe-table-toolbar-actions.tsx')
-rw-r--r--lib/tbe/table/tbe-table-toolbar-actions.tsx28
1 files changed, 20 insertions, 8 deletions
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"