"use client" import * as React from "react" import { type Table } from "@tanstack/react-table" import { useTransition } from "react" import { Button } from "@/components/ui/button" import { Plus, Send, Mail, CheckSquare } from "lucide-react" import { BiddingCompany } from "./bidding-pre-quote-vendor-columns" import { BiddingPreQuoteVendorCreateDialog } from "./bidding-pre-quote-vendor-create-dialog" import { BiddingPreQuoteInvitationDialog } from "./bidding-pre-quote-invitation-dialog" import { BiddingPreQuoteSelectionDialog } from "./bidding-pre-quote-selection-dialog" import { Bidding } from "@/db/schema" import { useToast } from "@/hooks/use-toast" interface BiddingPreQuoteVendorToolbarActionsProps { table: Table biddingId: number bidding: Bidding biddingCompanies: BiddingCompany[] onOpenItemsDialog: () => void onOpenTargetPriceDialog: () => void onOpenSelectionReasonDialog: () => void onSuccess: () => void } export function BiddingPreQuoteVendorToolbarActions({ table, biddingId, bidding, biddingCompanies, onOpenItemsDialog, onOpenTargetPriceDialog, onOpenSelectionReasonDialog, onSuccess }: BiddingPreQuoteVendorToolbarActionsProps) { const { toast } = useToast() const [isPending, startTransition] = useTransition() const [isCreateDialogOpen, setIsCreateDialogOpen] = React.useState(false) const [isInvitationDialogOpen, setIsInvitationDialogOpen] = React.useState(false) const [isSelectionDialogOpen, setIsSelectionDialogOpen] = React.useState(false) const handleCreateCompany = () => { setIsCreateDialogOpen(true) } const handleSendInvitations = () => { setIsInvitationDialogOpen(true) } const handleManageSelection = () => { const selectedRows = table.getFilteredSelectedRowModel().rows if (selectedRows.length === 0) { toast({ title: '선택 필요', description: '본입찰 선정 상태를 변경할 업체를 선택해주세요.', variant: 'destructive', }) return } setIsSelectionDialogOpen(true) } return ( <>
{ onSuccess() setIsCreateDialogOpen(false) }} /> row.original)} onSuccess={() => { onSuccess() table.resetRowSelection() }} /> ) }