diff options
Diffstat (limited to 'lib/bidding/detail/table/bidding-detail-vendor-columns.tsx')
| -rw-r--r-- | lib/bidding/detail/table/bidding-detail-vendor-columns.tsx | 112 |
1 files changed, 74 insertions, 38 deletions
diff --git a/lib/bidding/detail/table/bidding-detail-vendor-columns.tsx b/lib/bidding/detail/table/bidding-detail-vendor-columns.tsx index a0b69020..5368b287 100644 --- a/lib/bidding/detail/table/bidding-detail-vendor-columns.tsx +++ b/lib/bidding/detail/table/bidding-detail-vendor-columns.tsx @@ -19,22 +19,26 @@ import { import { QuotationVendor } from "@/lib/bidding/detail/service" interface GetVendorColumnsProps { - onEdit: (vendor: QuotationVendor) => void onViewPriceAdjustment?: (vendor: QuotationVendor) => void onViewItemDetails?: (vendor: QuotationVendor) => void onSendBidding?: (vendor: QuotationVendor) => void onUpdateParticipation?: (vendor: QuotationVendor, participated: boolean) => void onViewQuotationHistory?: (vendor: QuotationVendor) => void biddingStatus?: string // 입찰 상태 정보 추가 + biddingTargetPrice?: number | string | null // 입찰 내정가 + biddingFinalBidPrice?: number | string | null // 최종 확정금액 + biddingCurrency?: string // 입찰 통화 } export function getBiddingDetailVendorColumns({ - onEdit, onViewItemDetails, onSendBidding, onUpdateParticipation, onViewQuotationHistory, - biddingStatus + biddingStatus, + biddingTargetPrice, + biddingFinalBidPrice, + biddingCurrency }: GetVendorColumnsProps): ColumnDef<QuotationVendor>[] { return [ { @@ -97,6 +101,54 @@ export function getBiddingDetailVendorColumns({ }, }, { + accessorKey: 'targetPrice', + header: '내정가', + cell: ({ row }) => { + const hasTargetPrice = biddingTargetPrice && Number(biddingTargetPrice) > 0 + return ( + <div className="text-right font-mono text-sm text-muted-foreground"> + {hasTargetPrice ? ( + <> + {Number(biddingTargetPrice).toLocaleString()} {row.original.currency} + </> + ) : ( + <span>-</span> + )} + </div> + ) + }, + }, + { + accessorKey: 'priceRatio', + header: '내정가 대비', + cell: ({ row }) => { + const hasAmount = row.original.quotationAmount && Number(row.original.quotationAmount) > 0 + const hasTargetPrice = biddingTargetPrice && Number(biddingTargetPrice) > 0 + + if (!hasAmount || !hasTargetPrice) { + return <div className="text-right text-muted-foreground">-</div> + } + + const quotationAmount = Number(row.original.quotationAmount) + const targetPrice = Number(biddingTargetPrice) + const ratio = (quotationAmount / targetPrice) * 100 + + // 비율에 따른 색상 결정 + const getColorClass = (ratio: number) => { + if (ratio < 100) return 'text-blue-600 font-bold' // 내정가보다 낮음 + if (ratio === 100) return 'text-green-600 font-bold' // 내정가와 같음 + if (ratio <= 110) return 'text-orange-600 font-bold' // 10% 이내 초과 + return 'text-red-600 font-bold' // 10% 이상 초과 + } + + return ( + <div className={`text-right font-mono ${getColorClass(ratio)}`}> + {ratio.toFixed(1)}% + </div> + ) + }, + }, + { accessorKey: 'biddingResult', header: '입찰결과', cell: ({ row }) => { @@ -121,6 +173,25 @@ export function getBiddingDetailVendorColumns({ ), }, { + accessorKey: 'finalBidPrice', + header: '확정금액', + cell: ({ row }) => { + const hasFinalPrice = biddingFinalBidPrice && Number(biddingFinalBidPrice) > 0 + const currency = biddingCurrency || row.original.currency + return ( + <div className="text-right font-mono font-bold text-green-700"> + {hasFinalPrice ? ( + <> + {Number(biddingFinalBidPrice).toLocaleString()} {currency} + </> + ) : ( + <span className="text-muted-foreground">-</span> + )} + </div> + ) + }, + }, + { accessorKey: 'isBiddingParticipated', header: '입찰참여', cell: ({ row }) => { @@ -183,41 +254,6 @@ export function getBiddingDetailVendorColumns({ </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuLabel>작업</DropdownMenuLabel> - <DropdownMenuItem - onClick={() => onEdit(vendor)} - disabled={vendor.isBiddingParticipated !== true || biddingStatus === 'vendor_selected'} - > - 발주비율 산정 - {vendor.isBiddingParticipated !== true && ( - <span className="text-xs text-muted-foreground ml-2">(입찰참여 필요)</span> - )} - {biddingStatus === 'vendor_selected' && ( - <span className="text-xs text-muted-foreground ml-2">(낙찰 완료)</span> - )} - </DropdownMenuItem> - - {/* 입찰 참여여부 관리 */} - {vendor.isBiddingParticipated === null && onUpdateParticipation && ( - <> - <DropdownMenuSeparator /> - <DropdownMenuItem onClick={() => onUpdateParticipation(vendor, true)}> - 응찰 설정 - </DropdownMenuItem> - <DropdownMenuItem onClick={() => onUpdateParticipation(vendor, false)}> - 응찰포기 설정 - </DropdownMenuItem> - </> - )} - - {/* 입찰 보내기 (응찰한 업체만) */} - {vendor.isBiddingParticipated === true && onSendBidding && ( - <> - <DropdownMenuSeparator /> - <DropdownMenuItem onClick={() => onSendBidding(vendor)}> - 입찰 보내기 - </DropdownMenuItem> - </> - )} {/* 입찰 히스토리 (응찰한 업체만) */} {vendor.isBiddingParticipated === true && onViewQuotationHistory && ( |
