diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-11 12:18:38 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-11 12:18:38 +0000 |
| commit | ff902243a658067fae858a615c0629aa2e0a4837 (patch) | |
| tree | 42d30e986d1cbfb282c644c01730cd053b816b7a /lib/b-rfq/summary-table/summary-rfq-table-toolbar-actions.tsx | |
| parent | 42e38f41cb4c0b4bf9c08b71ed087cd7f0c7fc18 (diff) | |
(대표님) 20250611 21시 15분 OCR 등
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.tsx | 68 |
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> + ) +} |
