diff options
| author | joonhoekim <26rote@gmail.com> | 2025-08-26 12:09:39 +0000 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-08-26 12:09:39 +0000 |
| commit | 1110427907bbe9c11a378da4c1a233b83b5ca3b1 (patch) | |
| tree | 8bd7ed2ce7ec47a7f05693f5d3afcc22b1bb7e19 /lib/po/vendor-table/shi-vendor-po-toolbar-actions.tsx | |
| parent | 5f479f7252a7aa3328bfe186893de8b011e21b15 (diff) | |
(김준회) 구매정의서 구현 - PO (shi & vendor)
Diffstat (limited to 'lib/po/vendor-table/shi-vendor-po-toolbar-actions.tsx')
| -rw-r--r-- | lib/po/vendor-table/shi-vendor-po-toolbar-actions.tsx | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/po/vendor-table/shi-vendor-po-toolbar-actions.tsx b/lib/po/vendor-table/shi-vendor-po-toolbar-actions.tsx new file mode 100644 index 00000000..a18c02da --- /dev/null +++ b/lib/po/vendor-table/shi-vendor-po-toolbar-actions.tsx @@ -0,0 +1,66 @@ +"use client" + +import * as React from "react" +import { type Table } from "@tanstack/react-table" +import { Download, RefreshCcw } from "lucide-react" +import { toast } from "sonner" + +import { exportTableToExcel } from "@/lib/export" +import { Button } from "@/components/ui/button" +import { VendorPO } from "./types" + +interface ShiVendorPOToolbarActionsProps { + table: Table<VendorPO> + selectedRows: number[] + onAction: (poId: number, action: string) => Promise<void> + onViewItems: (po: VendorPO) => void +} + +export function ShiVendorPOToolbarActions({ + table, + selectedRows, + onAction, + onViewItems +}: ShiVendorPOToolbarActionsProps) { + + const handleRefresh = async () => { + try { + toast.success("데이터를 새로고침했습니다.") + // TODO: 실제 데이터 새로고침 로직 추가 + window.location.reload() + } catch (error) { + toast.error("데이터 새로고침 중 오류가 발생했습니다.") + } + } + + return ( + <div className="flex items-center gap-2"> + {/* Refresh 버튼 */} + <Button + variant="samsung" + size="sm" + className="gap-2" + onClick={handleRefresh} + > + <RefreshCcw className="size-4" aria-hidden="true" /> + <span className="hidden sm:inline">Refresh</span> + </Button> + + {/* Export 버튼 */} + <Button + variant="outline" + size="sm" + onClick={() => + exportTableToExcel(table, { + filename: "vendor-po-list", + excludeColumns: ["select", "actions"], + }) + } + className="gap-2" + > + <Download className="size-4" aria-hidden="true" /> + <span className="hidden sm:inline">Export</span> + </Button> + </div> + ) +} |
