From 8642ee064ddf96f1db2b948b4cc8bbbd6cfee820 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 12 Nov 2025 10:42:36 +0000 Subject: (최겸) 구매 일반계약, 입찰 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/table/quotation-history-dialog.tsx | 254 +++++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 lib/bidding/detail/table/quotation-history-dialog.tsx (limited to 'lib/bidding/detail/table/quotation-history-dialog.tsx') diff --git a/lib/bidding/detail/table/quotation-history-dialog.tsx b/lib/bidding/detail/table/quotation-history-dialog.tsx new file mode 100644 index 00000000..b816368a --- /dev/null +++ b/lib/bidding/detail/table/quotation-history-dialog.tsx @@ -0,0 +1,254 @@ +'use client' + +import * as React from 'react' +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog' +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@/components/ui/table' +import { Badge } from '@/components/ui/badge' +import { Button } from '@/components/ui/button' +import { formatDate } from '@/lib/utils' +import { History, Eye } from 'lucide-react' + +interface QuotationHistoryItem { + id: string + round: number + submittedAt: Date + totalAmount: number + currency: string + vsTargetPrice: number // 퍼센트 + items: Array<{ + itemCode: string + itemName: string + specification: string + quantity: number + unit: string + unitPrice: number + totalPrice: number + deliveryDate: Date + }> +} + +interface QuotationHistoryDialogProps { + open: boolean + onOpenChange: (open: boolean) => void + vendorName: string + history: QuotationHistoryItem[] + biddingCurrency: string + targetPrice?: number +} + +export function QuotationHistoryDialog({ + open, + onOpenChange, + vendorName, + history, + biddingCurrency, + targetPrice +}: QuotationHistoryDialogProps) { + const [selectedHistory, setSelectedHistory] = React.useState(null) + const [detailDialogOpen, setDetailDialogOpen] = React.useState(false) + + const handleViewDetail = (historyItem: QuotationHistoryItem) => { + setSelectedHistory(historyItem) + setDetailDialogOpen(true) + } + + const handleDetailDialogClose = () => { + setDetailDialogOpen(false) + setSelectedHistory(null) + } + + return ( + <> + + + + + + 견적 히스토리 - {vendorName} + + + {vendorName} 업체의 제출한 견적 내역을 확인할 수 있습니다. + + + +
+ {history.length > 0 ? ( + + + + 차수 + 제출일시 + 견적금액 + 내정가대비 (%) + 액션 + + + + {history.map((item) => ( + + + {item.round}차 + + + {formatDate(item.submittedAt, 'KR')} + + + {item.totalAmount.toLocaleString()} {item.currency} + + + {targetPrice && targetPrice > 0 ? ( + + {item.vsTargetPrice > 0 ? '+' : ''}{item.vsTargetPrice.toFixed(1)}% + + ) : ( + '-' + )} + + + + + + ))} + +
+ ) : ( +
+ 제출된 견적 내역이 없습니다. +
+ )} +
+
+
+ + {/* 상세 다이얼로그 */} + {selectedHistory && ( + + )} + + ) +} + +// 견적 히스토리 상세 다이얼로그 +interface QuotationHistoryDetailDialogProps { + open: boolean + onOpenChange: (open: boolean) => void + vendorName: string + historyItem: QuotationHistoryItem +} + +function QuotationHistoryDetailDialog({ + open, + onOpenChange, + vendorName, + historyItem +}: QuotationHistoryDetailDialogProps) { + return ( + + + + + 견적 상세 - {vendorName} ({historyItem.round}차) + + + 제출일시: {formatDate(historyItem.submittedAt, 'KR')} + + + +
+ {/* 요약 정보 */} +
+
+ +
+ {historyItem.totalAmount.toLocaleString()} {historyItem.currency} +
+
+
+ +
+ {historyItem.items.length}개 +
+
+
+ +
+ {formatDate(historyItem.submittedAt, 'KR')} +
+
+
+ + {/* 품목 상세 테이블 */} + + + + 품목코드 + 품목명 + 규격 + 수량 + 단위 + 단가 + 금액 + 납기요청일 + + + + {historyItem.items.map((item, index) => ( + + + {item.itemCode} + + + {item.itemName} + + + {item.specification || '-'} + + + {item.quantity.toLocaleString()} + + {item.unit} + + {item.unitPrice.toLocaleString()} {historyItem.currency} + + + {item.totalPrice.toLocaleString()} {historyItem.currency} + + + {formatDate(item.deliveryDate, 'KR')} + + + ))} + +
+
+
+
+ ) +} -- cgit v1.2.3