summaryrefslogtreecommitdiff
path: root/lib/b-rfq/summary-table/summary-rfq-table-toolbar-actions.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/b-rfq/summary-table/summary-rfq-table-toolbar-actions.tsx')
-rw-r--r--lib/b-rfq/summary-table/summary-rfq-table-toolbar-actions.tsx68
1 files changed, 68 insertions, 0 deletions
diff --git a/lib/b-rfq/summary-table/summary-rfq-table-toolbar-actions.tsx b/lib/b-rfq/summary-table/summary-rfq-table-toolbar-actions.tsx
new file mode 100644
index 00000000..8ba95ce6
--- /dev/null
+++ b/lib/b-rfq/summary-table/summary-rfq-table-toolbar-actions.tsx
@@ -0,0 +1,68 @@
+"use client"
+
+import * as React from "react"
+import { type Table } from "@tanstack/react-table"
+import { Download, FileText, Mail, Search } from "lucide-react"
+import { useRouter } from "next/navigation"
+
+import { Button } from "@/components/ui/button"
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu"
+import { RfqDashboardView } from "@/db/schema"
+import { CreateRfqDialog } from "./add-new-rfq-dialog"
+
+interface RFQTableToolbarActionsProps {
+ table: Table<RfqDashboardView>
+}
+
+export function RFQTableToolbarActions({ table }: RFQTableToolbarActionsProps) {
+ const router = useRouter()
+
+ // 선택된 행 정보
+ const selectedRows = table.getFilteredSelectedRowModel().rows
+ const selectedCount = selectedRows.length
+ const isSingleSelected = selectedCount === 1
+
+ // RFQ 문서 확인 핸들러
+ const handleDocumentCheck = () => {
+ if (isSingleSelected) {
+ const selectedRfq = selectedRows[0].original
+ const rfqId = selectedRfq.rfqId
+
+ // RFQ 첨부문서 확인 페이지로 이동
+ router.push(`/b-rfq/${rfqId}`)
+ }
+ }
+
+ // 테이블 새로고침 핸들러
+ const handleRefresh = () => {
+ // 페이지 새로고침 또는 데이터 다시 fetch
+ router.refresh()
+ }
+
+ return (
+ <div className="flex items-center gap-2">
+ {/* 새 RFQ 생성 다이얼로그 */}
+ <CreateRfqDialog onSuccess={handleRefresh} />
+
+ {/* RFQ 문서 확인 버튼 - 단일 선택시만 활성화 */}
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={handleDocumentCheck}
+ disabled={!isSingleSelected}
+ className="flex items-center"
+ >
+ <Search className="mr-2 h-4 w-4" />
+ RFQ 문서 확인
+ </Button>
+
+
+ </div>
+ )
+}