diff options
Diffstat (limited to 'lib/bidding/list/create-bidding-dialog.tsx')
| -rw-r--r-- | lib/bidding/list/create-bidding-dialog.tsx | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/lib/bidding/list/create-bidding-dialog.tsx b/lib/bidding/list/create-bidding-dialog.tsx index 2f458873..90abda57 100644 --- a/lib/bidding/list/create-bidding-dialog.tsx +++ b/lib/bidding/list/create-bidding-dialog.tsx @@ -201,8 +201,8 @@ export function CreateBiddingDialog() { materialGroupInfo: '', materialNumber: '', materialInfo: '', - priceUnit: '', - purchaseUnit: '1', + priceUnit: '1', + purchaseUnit: 'EA', materialWeight: '', wbsCode: '', wbsName: '', @@ -427,8 +427,8 @@ export function CreateBiddingDialog() { materialGroupInfo: '', materialNumber: '', materialInfo: '', - priceUnit: '', - purchaseUnit: '1', + priceUnit: '1', + purchaseUnit: 'EA', materialWeight: '', wbsCode: '', wbsName: '', @@ -471,8 +471,8 @@ export function CreateBiddingDialog() { prev.map((item) => { if (item.id === id) { const updatedItem = { ...item, ...updates } - // 내정단가, 수량, 중량, 구매단위가 변경되면 내정금액 재계산 - if (updates.targetUnitPrice || updates.quantity || updates.totalWeight || updates.purchaseUnit) { + // 내정단가, 수량, 중량, 가격단위가 변경되면 내정금액 재계산 + if (updates.targetUnitPrice || updates.quantity || updates.totalWeight || updates.priceUnit) { updatedItem.targetAmount = calculateTargetAmount(updatedItem) } return updatedItem @@ -497,17 +497,17 @@ export function CreateBiddingDialog() { const calculateTargetAmount = (item: PRItemInfo) => { const unitPrice = parseFloat(item.targetUnitPrice) || 0 - const purchaseUnit = parseFloat(item.purchaseUnit) || 1 // 기본값 1 + const priceUnit = parseFloat(item.priceUnit) || 1 // 기본값 1 let amount = 0 if (quantityWeightMode === 'quantity') { const quantity = parseFloat(item.quantity) || 0 - // (수량 / 구매단위) * 내정단가 - amount = (quantity / purchaseUnit) * unitPrice + // (수량 / 가격단위) * 내정단가 + amount = (quantity / priceUnit) * unitPrice } else { const weight = parseFloat(item.totalWeight) || 0 - // (중량 / 구매단위) * 내정단가 - amount = (weight / purchaseUnit) * unitPrice + // (중량 / 가격단위) * 내정단가 + amount = (weight / priceUnit) * unitPrice } // 소수점 버림 @@ -772,6 +772,7 @@ export function CreateBiddingDialog() { <th className="border-r px-3 py-3 text-left text-xs font-medium min-w-[300px]">자재명</th> <th className="border-r px-3 py-3 text-left text-xs font-medium min-w-[120px]">수량</th> <th className="border-r px-3 py-3 text-left text-xs font-medium min-w-[80px]">단위</th> + <th className="border-r px-3 py-3 text-left text-xs font-medium min-w-[80px]">가격단위</th> <th className="border-r px-3 py-3 text-left text-xs font-medium min-w-[80px]">구매단위</th> <th className="border-r px-3 py-3 text-left text-xs font-medium min-w-[120px]">내정단가</th> <th className="border-r px-3 py-3 text-left text-xs font-medium min-w-[120px]">내정금액</th> @@ -955,13 +956,48 @@ export function CreateBiddingDialog() { type="number" min="1" step="1" - placeholder="구매단위" - value={item.purchaseUnit || ''} - onChange={(e) => updatePRItem(item.id, { purchaseUnit: e.target.value })} + placeholder="가격단위" + value={item.priceUnit || ''} + onChange={(e) => updatePRItem(item.id, { priceUnit: e.target.value })} className="h-8 text-xs" /> </td> <td className="border-r px-3 py-2"> + {quantityWeightMode === 'quantity' ? ( + <Select + value={item.purchaseUnit || item.quantityUnit || 'EA'} + onValueChange={(value) => updatePRItem(item.id, { purchaseUnit: value })} + > + <SelectTrigger className="h-8 text-xs"> + <SelectValue /> + </SelectTrigger> + <SelectContent> + <SelectItem value="EA">EA</SelectItem> + <SelectItem value="SET">SET</SelectItem> + <SelectItem value="LOT">LOT</SelectItem> + <SelectItem value="M">M</SelectItem> + <SelectItem value="M2">M²</SelectItem> + <SelectItem value="M3">M³</SelectItem> + </SelectContent> + </Select> + ) : ( + <Select + value={item.purchaseUnit || item.weightUnit || 'KG'} + onValueChange={(value) => updatePRItem(item.id, { purchaseUnit: value })} + > + <SelectTrigger className="h-8 text-xs"> + <SelectValue /> + </SelectTrigger> + <SelectContent> + <SelectItem value="KG">KG</SelectItem> + <SelectItem value="TON">TON</SelectItem> + <SelectItem value="G">G</SelectItem> + <SelectItem value="LB">LB</SelectItem> + </SelectContent> + </Select> + )} + </td> + <td className="border-r px-3 py-2"> <Input type="number" min="0" |
