diff options
Diffstat (limited to 'lib/bidding/vendor/components/pr-items-pricing-table.tsx')
| -rw-r--r-- | lib/bidding/vendor/components/pr-items-pricing-table.tsx | 140 |
1 files changed, 75 insertions, 65 deletions
diff --git a/lib/bidding/vendor/components/pr-items-pricing-table.tsx b/lib/bidding/vendor/components/pr-items-pricing-table.tsx index a0230478..7dd8384e 100644 --- a/lib/bidding/vendor/components/pr-items-pricing-table.tsx +++ b/lib/bidding/vendor/components/pr-items-pricing-table.tsx @@ -42,7 +42,7 @@ interface PrItem { materialGroupInfo: string | null materialNumber: string | null materialInfo: string | null - requestedDeliveryDate: Date | null + requestedDeliveryDate: Date | string | null annualUnitPrice: string | null currency: string | null quantity: string | null @@ -54,6 +54,11 @@ interface PrItem { materialWeight: string | null prNumber: string | null hasSpecDocument: boolean | null + specification: string | null + bidUnitPrice?: string | number | null + bidAmount?: string | number | null + proposedDeliveryDate?: string | Date | null + technicalSpecification?: string | null } interface PrItemQuotation { @@ -189,6 +194,18 @@ export function PrItemsPricingTable({ if (existing) { return existing } + + // prItems 자체에 견적 정보가 있는 경우 활용 + if (item.bidUnitPrice !== undefined || item.bidAmount !== undefined) { + return { + prItemId: item.id, + bidUnitPrice: item.bidUnitPrice ? Number(item.bidUnitPrice) : 0, + bidAmount: item.bidAmount ? Number(item.bidAmount) : 0, + proposedDeliveryDate: item.proposedDeliveryDate ? (item.proposedDeliveryDate instanceof Date ? item.proposedDeliveryDate.toISOString().split('T')[0] : String(item.proposedDeliveryDate)) : '', + technicalSpecification: item.technicalSpecification || '' + } + } + return { prItemId: item.id, bidUnitPrice: 0, @@ -288,22 +305,22 @@ export function PrItemsPricingTable({ <Table> <TableHeader> <TableRow> - <TableHead>아이템번호</TableHead> - <TableHead>PR번호</TableHead> - <TableHead>품목정보</TableHead> - <TableHead>자재내역</TableHead> + <TableHead>자재번호</TableHead> + <TableHead>자재명</TableHead> + <TableHead>SHI 납품예정일</TableHead> + <TableHead>업체 납품예정일</TableHead> <TableHead>수량</TableHead> - <TableHead>단위</TableHead> + <TableHead>구매단위</TableHead> <TableHead>가격단위</TableHead> - <TableHead>중량</TableHead> - <TableHead>중량단위</TableHead> <TableHead>구매단위</TableHead> - <TableHead>SHI 납품요청일</TableHead> + <TableHead>총중량</TableHead> + <TableHead>중량단위</TableHead> <TableHead>입찰단가</TableHead> <TableHead>입찰금액</TableHead> - <TableHead>납품예정일</TableHead> - {/* <TableHead>기술사양</TableHead> */} - <TableHead>SPEC</TableHead> + <TableHead>업체 통화</TableHead> + <TableHead>자재내역상세</TableHead> + <TableHead>스팩</TableHead> + <TableHead>P/R번호</TableHead> </TableRow> </TableHeader> <TableBody> @@ -318,35 +335,46 @@ export function PrItemsPricingTable({ return ( <TableRow key={item.id}> - <TableCell className="font-medium"> - {item.itemNumber || '-'} - </TableCell> - <TableCell>{item.prNumber || '-'}</TableCell> <TableCell> - <div className="max-w-32 truncate" title={item.itemInfo || ''}> - {item.itemInfo || '-'} - </div> + {item.materialNumber || '-'} </TableCell> <TableCell> <div className="max-w-32 truncate" title={item.materialInfo || ''}> {item.materialInfo || '-'} </div> </TableCell> + <TableCell> + {item.requestedDeliveryDate ? + formatDate(new Date(item.requestedDeliveryDate), 'KR') : '-' + } + </TableCell> + <TableCell> + {readOnly ? ( + quotation.proposedDeliveryDate ? + formatDate(quotation.proposedDeliveryDate, 'KR') : '-' + ) : ( + <Input + type="date" + value={quotation.proposedDeliveryDate} + onChange={(e) => updateQuotation( + item.id, + 'proposedDeliveryDate', + e.target.value + )} + className="w-40" + /> + )} + </TableCell> <TableCell className="text-right"> {item.quantity ? parseFloat(item.quantity).toLocaleString() : '-'} </TableCell> <TableCell>{item.quantityUnit || '-'}</TableCell> <TableCell>{item.priceUnit || '-'}</TableCell> + <TableCell>{item.purchaseUnit || '-'}</TableCell> <TableCell className="text-right"> {item.totalWeight ? parseFloat(item.totalWeight).toLocaleString() : '-'} </TableCell> <TableCell>{item.weightUnit || '-'}</TableCell> - <TableCell>{item.purchaseUnit || '-'}</TableCell> - <TableCell> - {item.requestedDeliveryDate ? - formatDate(item.requestedDeliveryDate, 'KR') : '-' - } - </TableCell> <TableCell> {readOnly ? ( <span className="font-medium"> @@ -355,12 +383,23 @@ export function PrItemsPricingTable({ ) : ( <Input type="number" - value={quotation.bidUnitPrice} - onChange={(e) => updateQuotation( - item.id, - 'bidUnitPrice', - parseFloat(e.target.value) || 0 - )} + inputMode="decimal" + min={0} + pattern="^(0|[1-9][0-9]*)(\.[0-9]+)?$" + value={quotation.bidUnitPrice === 0 ? '' : quotation.bidUnitPrice} + onChange={(e) => { + let value = e.target.value + if (/^0[0-9]+/.test(value)) { + value = value.replace(/^0+/, '') + if (value === '') value = '0' + } + const numericValue = parseFloat(value) + updateQuotation( + item.id, + 'bidUnitPrice', + isNaN(numericValue) ? 0 : numericValue + ) + }} className="w-32 text-right" placeholder="단가" /> @@ -371,42 +410,12 @@ export function PrItemsPricingTable({ {formatCurrency(quotation.bidAmount)} </div> </TableCell> + <TableCell>{currency}</TableCell> <TableCell> - {readOnly ? ( - quotation.proposedDeliveryDate ? - formatDate(quotation.proposedDeliveryDate, 'KR') : '-' - ) : ( - <Input - type="date" - value={quotation.proposedDeliveryDate} - onChange={(e) => updateQuotation( - item.id, - 'proposedDeliveryDate', - e.target.value - )} - className="w-40" - /> - )} + <div className="max-w-48 truncate" title={item.specification || ''}> + {item.specification || '-'} + </div> </TableCell> - {/* <TableCell> - {readOnly ? ( - <div className="max-w-32 truncate" title={quotation.technicalSpecification || ''}> - {quotation.technicalSpecification || '-'} - </div> - ) : ( - <Textarea - value={quotation.technicalSpecification} - onChange={(e) => updateQuotation( - item.id, - 'technicalSpecification', - e.target.value - )} - placeholder="기술사양 입력" - className="w-48 min-h-[60px]" - rows={2} - /> - )} - </TableCell> */} <TableCell> {item.hasSpecDocument ? ( <div className="space-y-1"> @@ -435,6 +444,7 @@ export function PrItemsPricingTable({ <Badge variant="outline">SPEC 없음</Badge> )} </TableCell> + <TableCell>{item.prNumber || '-'}</TableCell> </TableRow> ) })} |
