From 6c11fccc84f4c84fa72ee01f9caad9f76f35cea2 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 16 Sep 2025 09:20:58 +0000 Subject: (대표님, 최겸) 계약, 업로드 관련, 메뉴처리, 입찰, 프리쿼트, rfqLast관련, tbeLast관련 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table/bidding-detail-vendor-create-dialog.tsx | 4 +- .../detail/table/bidding-detail-vendor-table.tsx | 32 ++-------- .../bidding-detail-vendor-toolbar-actions.tsx | 68 ++++++++++++---------- 3 files changed, 43 insertions(+), 61 deletions(-) (limited to 'lib/bidding/detail/table') diff --git a/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx b/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx index 5e85af06..f35957bc 100644 --- a/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx +++ b/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx @@ -36,7 +36,7 @@ import { import { Check, ChevronsUpDown, Search } from 'lucide-react' import { cn } from '@/lib/utils' import { createBiddingDetailVendor } from '@/lib/bidding/detail/service' -import { searchVendors } from '@/lib/vendors/service' +import { searchVendorsForBidding } from '@/lib/bidding/service' import { useToast } from '@/hooks/use-toast' import { useTransition } from 'react' @@ -83,7 +83,7 @@ export function BiddingDetailVendorCreateDialog({ } try { - const result = await searchVendors(vendorSearchValue.trim(), 10) + const result = await searchVendorsForBidding(vendorSearchValue.trim(), biddingId, 10) setVendors(result) } catch (error) { console.error('Vendor search failed:', error) diff --git a/lib/bidding/detail/table/bidding-detail-vendor-table.tsx b/lib/bidding/detail/table/bidding-detail-vendor-table.tsx index 95f63ce9..a9778636 100644 --- a/lib/bidding/detail/table/bidding-detail-vendor-table.tsx +++ b/lib/bidding/detail/table/bidding-detail-vendor-table.tsx @@ -20,7 +20,7 @@ import { } from '@/lib/bidding/detail/service' import { selectWinnerSchema } from '@/lib/bidding/validation' import { useToast } from '@/hooks/use-toast' -import { useTransition } from 'react' +import { useTransition, useCallback } from 'react' interface BiddingDetailVendorTableContentProps { biddingId: number @@ -114,29 +114,7 @@ export function BiddingDetailVendorTableContent({ const [priceAdjustmentData, setPriceAdjustmentData] = React.useState(null) const [isPriceAdjustmentDialogOpen, setIsPriceAdjustmentDialogOpen] = React.useState(false) - const handleDelete = (vendor: QuotationVendor) => { - if (!confirm(`${vendor.vendorName} 업체를 삭제하시겠습니까?`)) return - - startTransition(async () => { - const response = await deleteQuotationVendor(vendor.id) - - if (response.success) { - toast({ - title: '성공', - description: response.message, - }) - onRefresh() - } else { - toast({ - title: '오류', - description: response.error, - variant: 'destructive', - }) - } - }) - } - - const handleSelectWinner = (vendor: QuotationVendor) => { + const handleSelectWinner = useCallback((vendor: QuotationVendor) => { if (!vendor.awardRatio || vendor.awardRatio <= 0) { toast({ title: '오류', @@ -180,7 +158,7 @@ export function BiddingDetailVendorTableContent({ }) } }) - } + }, [toast, startTransition, biddingId, userId, selectWinnerSchema, selectWinner, onRefresh]) const handleEdit = (vendor: QuotationVendor) => { setSelectedVendor(vendor) @@ -214,12 +192,12 @@ export function BiddingDetailVendorTableContent({ const columns = React.useMemo( () => getBiddingDetailVendorColumns({ onEdit: onEdit || handleEdit, - onDelete: onDelete || handleDelete, + onDelete: onDelete, onSelectWinner: onSelectWinner || handleSelectWinner, onViewPriceAdjustment: handleViewPriceAdjustment, onViewItemDetails: onViewItemDetails }), - [onEdit, onDelete, onSelectWinner, handleEdit, handleDelete, handleSelectWinner, handleViewPriceAdjustment, onViewItemDetails] + [onEdit, onDelete, onSelectWinner, handleEdit, handleSelectWinner, handleViewPriceAdjustment, onViewItemDetails] ) const { table } = useDataTable({ diff --git a/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx b/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx index 0b707944..893fb185 100644 --- a/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx +++ b/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx @@ -180,6 +180,8 @@ export function BiddingDetailVendorToolbarActions({ <>
{/* 상태별 액션 버튼 */} + {bidding.status !== 'bidding_closed' && bidding.status !== 'vendor_selected' && ( + <> */} - - - - + + + + + + + )}