summaryrefslogtreecommitdiff
path: root/lib/rfqs/vendor-table/vendors-table-toolbar-actions.tsx
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-12-01 19:52:06 +0900
committerjoonhoekim <26rote@gmail.com>2025-12-01 19:52:06 +0900
commit44b74ff4170090673b6eeacd8c528e0abf47b7aa (patch)
tree3f3824b4e2cb24536c1677188b4cae5b8909d3da /lib/rfqs/vendor-table/vendors-table-toolbar-actions.tsx
parent4953e770929b82ef77da074f77071ebd0f428529 (diff)
(김준회) deprecated code 정리
Diffstat (limited to 'lib/rfqs/vendor-table/vendors-table-toolbar-actions.tsx')
-rw-r--r--lib/rfqs/vendor-table/vendors-table-toolbar-actions.tsx84
1 files changed, 0 insertions, 84 deletions
diff --git a/lib/rfqs/vendor-table/vendors-table-toolbar-actions.tsx b/lib/rfqs/vendor-table/vendors-table-toolbar-actions.tsx
deleted file mode 100644
index 864d0f4b..00000000
--- a/lib/rfqs/vendor-table/vendors-table-toolbar-actions.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-"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 { useToast } from "@/hooks/use-toast"
-
-interface VendorsTableToolbarActionsProps {
- table: Table<MatchedVendorRow>
- rfqId: number
-}
-
-export function VendorsTableToolbarActions({ table, rfqId }: VendorsTableToolbarActionsProps) {
- const { toast } = useToast()
- const fileInputRef = React.useRef<HTMLInputElement>(null)
-
- // 선택된 모든 행
- const selectedRows = table.getFilteredSelectedRowModel().rows
-
- // 조건에 맞는 협력업체만 필터링
- const eligibleVendors = React.useMemo(() => {
- return selectedRows
- .map(row => row.original)
- .filter(vendor => !vendor.rfqVendorStatus || vendor.rfqVendorStatus === "INVITED")
- }, [selectedRows])
-
- // 조건에 맞지 않는 협력업체 수
- const ineligibleCount = selectedRows.length - eligibleVendors.length
-
- function handleImportClick() {
- fileInputRef.current?.click()
- }
-
- function handleInviteClick() {
- // 조건에 맞지 않는 협력업체가 있다면 토스트 메시지 표시
- if (ineligibleCount > 0) {
- toast({
- title: "일부 협력업체만 초대됩니다",
- description: `선택한 ${selectedRows.length}개 중 ${eligibleVendors.length}개만 초대 가능합니다. 나머지 ${ineligibleCount}개는 초대 불가능한 상태입니다.`,
- // variant: "warning",
- })
- }
- }
-
- // 다이얼로그 표시 여부 - 적합한 협력업체가 1개 이상 있으면 표시
- const showInviteDialog = eligibleVendors.length > 0
-
- return (
- <div className="flex items-center gap-2">
- {selectedRows.length > 0 && (
- <>
- {showInviteDialog ? (
- <InviteVendorsDialog
- vendors={eligibleVendors}
- rfqId={rfqId}
- onSuccess={() => table.toggleAllRowsSelected(false)}
- onOpenChange={(open) => {
- // 다이얼로그가 열릴 때만 경고 표시
- if (open && ineligibleCount > 0) {
- handleInviteClick()
- }
- }}
- />
- ) : (
- <Button
- variant="default"
- size="sm"
- disabled={true}
- title="선택된 협력업체 중 초대 가능한 협력업체가 없습니다"
- >
- 초대 불가
- </Button>
- )}
- </>
- )}
-
- <AddVendorDialog rfqId={rfqId} />
- </div>
- )
-} \ No newline at end of file