diff options
Diffstat (limited to 'lib/bidding/detail/table/bidding-detail-content.tsx')
| -rw-r--r-- | lib/bidding/detail/table/bidding-detail-content.tsx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/bidding/detail/table/bidding-detail-content.tsx b/lib/bidding/detail/table/bidding-detail-content.tsx index 91bea2f4..a96509a9 100644 --- a/lib/bidding/detail/table/bidding-detail-content.tsx +++ b/lib/bidding/detail/table/bidding-detail-content.tsx @@ -7,6 +7,10 @@ import { QuotationDetails, QuotationVendor } from '@/lib/bidding/detail/service' import { BiddingDetailVendorTableContent } from './bidding-detail-vendor-table' import { BiddingDetailItemsDialog } from './bidding-detail-items-dialog' import { BiddingDetailTargetPriceDialog } from './bidding-detail-target-price-dialog' +import { BiddingPreQuoteItemDetailsDialog } from '../../../bidding/pre-quote/table/bidding-pre-quote-item-details-dialog' +import { getPrItemsForBidding } from '../../../bidding/pre-quote/service' +import { useToast } from '@/hooks/use-toast' +import { useTransition } from 'react' interface BiddingDetailContentProps { bidding: Bidding @@ -21,6 +25,9 @@ export function BiddingDetailContent({ quotationVendors, prItems }: BiddingDetailContentProps) { + const { toast } = useToast() + const [isPending, startTransition] = useTransition() + const [dialogStates, setDialogStates] = React.useState({ items: false, targetPrice: false, @@ -29,6 +36,11 @@ export function BiddingDetailContent({ }) const [refreshTrigger, setRefreshTrigger] = React.useState(0) + + // PR 아이템 다이얼로그 관련 state + const [isItemDetailsDialogOpen, setIsItemDetailsDialogOpen] = React.useState(false) + const [selectedVendorForDetails, setSelectedVendorForDetails] = React.useState<QuotationVendor | null>(null) + const [prItemsForDialog, setPrItemsForDialog] = React.useState<any[]>([]) const handleRefresh = React.useCallback(() => { setRefreshTrigger(prev => prev + 1) @@ -42,6 +54,25 @@ export function BiddingDetailContent({ setDialogStates(prev => ({ ...prev, [type]: false })) }, []) + const handleViewItemDetails = React.useCallback((vendor: QuotationVendor) => { + startTransition(async () => { + try { + // PR 아이템 정보 로드 + const prItemsData = await getPrItemsForBidding(bidding.id) + setPrItemsForDialog(prItemsData) + setSelectedVendorForDetails(vendor) + setIsItemDetailsDialogOpen(true) + } catch (error) { + console.error('Failed to load PR items:', error) + toast({ + title: '오류', + description: '품목 정보를 불러오는데 실패했습니다.', + variant: 'destructive', + }) + } + }) + }, [bidding.id, toast]) + return ( <div className="space-y-6"> <BiddingDetailVendorTableContent @@ -53,6 +84,7 @@ export function BiddingDetailContent({ onOpenTargetPriceDialog={() => openDialog('targetPrice')} onOpenSelectionReasonDialog={() => openDialog('selectionReason')} onOpenAwardDialog={() => openDialog('award')} + onViewItemDetails={handleViewItemDetails} onEdit={undefined} onDelete={undefined} onSelectWinner={undefined} @@ -72,6 +104,16 @@ export function BiddingDetailContent({ bidding={bidding} onSuccess={handleRefresh} /> + + <BiddingPreQuoteItemDetailsDialog + open={isItemDetailsDialogOpen} + onOpenChange={setIsItemDetailsDialogOpen} + biddingId={bidding.id} + biddingCompanyId={selectedVendorForDetails?.id || 0} + companyName={selectedVendorForDetails?.vendorName || ''} + prItems={prItemsForDialog} + currency={bidding.currency || 'KRW'} + /> </div> ) } |
