From 1c790b57447aff36820437d6f18a969de9b45baa Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 13 May 2025 03:12:10 +0000
Subject: (대표님) lib/rfq-ships
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../vendor-table/vendors-table-toolbar-actions.tsx | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 lib/rfqs-ship/vendor-table/vendors-table-toolbar-actions.tsx

(limited to 'lib/rfqs-ship/vendor-table/vendors-table-toolbar-actions.tsx')

diff --git a/lib/rfqs-ship/vendor-table/vendors-table-toolbar-actions.tsx b/lib/rfqs-ship/vendor-table/vendors-table-toolbar-actions.tsx
new file mode 100644
index 00000000..a8825cc7
--- /dev/null
+++ b/lib/rfqs-ship/vendor-table/vendors-table-toolbar-actions.tsx
@@ -0,0 +1,62 @@
+"use client"
+
+import * as React from "react"
+import { type Table } from "@tanstack/react-table"
+ 
+import { MatchedVendorRow } from "@/config/vendorRfbColumnsConfig"
+import { InviteVendorsDialog } from "./invite-vendors-dialog"
+import { AddVendorDialog } from "./add-vendor-dialog"
+import { Button } from "@/components/ui/button"
+import { RfqType } from "@/lib/rfqs-ship/validations"
+
+interface VendorsTableToolbarActionsProps {
+  table: Table<MatchedVendorRow>
+  rfqId: number
+  rfqType: RfqType
+}
+
+export function VendorsTableToolbarActions({
+  table,
+  rfqId,
+  rfqType,
+}: VendorsTableToolbarActionsProps) {
+  // 선택된 행이 있는지 확인
+  const rowSelection = table.getState().rowSelection
+  const selectedRows = Object.keys(rowSelection).length
+  const hasSelectedRows = selectedRows > 0
+  
+  // 선택된 벤더 목록
+  const selectedVendors = React.useMemo(() => {
+    return Object.keys(rowSelection).map((id) =>
+      table.getRow(id).original
+    )
+  }, [rowSelection, table])
+  
+  return (
+    <div className="flex items-center justify-between gap-2">
+      <div className="flex items-center gap-2">
+        <AddVendorDialog rfqId={rfqId} />
+      </div>
+      <div className="flex items-center gap-2">
+        {hasSelectedRows && (
+          <InviteVendorsDialog
+            rfqId={rfqId}
+            rfqType={rfqType}
+            vendors={selectedVendors}
+            directCbe={true}
+            onSuccess={() => table.toggleAllRowsSelected(false)}
+          >
+            <Button
+              variant="default"
+              size="sm"
+              className="h-8"
+              disabled={!hasSelectedRows}
+            >
+              CBE 요청 ({selectedRows})
+            </Button>
+          </InviteVendorsDialog>
+        )}
+      </div>
+    </div>
+  )
+}
\ No newline at end of file
-- 
cgit v1.2.3

