feat: [order] 수주 확정 모달에 품목 정보 테이블 추가
- 총금액 표시 제거 - 수주 품목 테이블 추가 (품목명, 층, 부호, 사이즈, 수량) - nodes 기반 렌더링 우선, products fallback - 모달 너비 max-w-md → max-w-lg 확장
This commit is contained in:
@@ -363,11 +363,21 @@ export default function OrderDetailPage() {
|
||||
});
|
||||
if (result.success && result.data) {
|
||||
setOrder(result.data.order);
|
||||
const { deletedCounts } = result.data;
|
||||
toast.success(
|
||||
`생산지시가 되돌려졌습니다. (작업지시 ${deletedCounts.workOrders}건, 품목 ${deletedCounts.workOrderItems}건, 결과 ${deletedCounts.workResults}건 삭제)`
|
||||
);
|
||||
if (result.data.deletedCounts) {
|
||||
// force 모드 (개발): 물리 삭제 건수
|
||||
const { deletedCounts } = result.data;
|
||||
toast.success(
|
||||
`생산지시가 되돌려졌습니다. (작업지시 ${deletedCounts.workOrders}건, 품목 ${deletedCounts.workOrderItems}건, 결과 ${deletedCounts.workResults}건 삭제)`
|
||||
);
|
||||
} else {
|
||||
// cancel 모드 (운영): 취소 처리 건수
|
||||
const msg = result.data.cancelledCount
|
||||
? `생산지시가 취소되었습니다. (${result.data.cancelledCount}건 취소)`
|
||||
: '생산지시가 되돌려졌습니다.';
|
||||
toast.success(msg);
|
||||
}
|
||||
setIsRevertDialogOpen(false);
|
||||
setRevertReason("");
|
||||
} else {
|
||||
toast.error(result.error || "생산지시 되돌리기에 실패했습니다.");
|
||||
}
|
||||
@@ -1133,7 +1143,7 @@ export default function OrderDetailPage() {
|
||||
|
||||
{/* 수주 확정 다이얼로그 */}
|
||||
<Dialog open={isConfirmDialogOpen} onOpenChange={setIsConfirmDialogOpen}>
|
||||
<DialogContent className="max-w-md">
|
||||
<DialogContent className="max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<CheckCircle2 className="h-5 w-5 text-green-600" />
|
||||
@@ -1156,18 +1166,70 @@ export default function OrderDetailPage() {
|
||||
<span className="text-muted-foreground">현장명</span>
|
||||
<span>{order.siteName}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">총금액</span>
|
||||
<span className="font-medium text-green-600">
|
||||
{formatAmount(order.totalAmount || 0)}원
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-muted-foreground">현재 상태</span>
|
||||
{getOrderStatusBadge(order.status)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 수주 품목 정보 */}
|
||||
{((order.nodes && order.nodes.length > 0) || (order.products && order.products.length > 0)) && (
|
||||
<div className="border rounded-lg overflow-hidden">
|
||||
<div className="bg-gray-50 px-4 py-2 text-sm font-medium text-gray-700">
|
||||
수주 품목 ({order.nodes?.length || order.products?.length || 0}건)
|
||||
</div>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="text-center w-[50px]">No</TableHead>
|
||||
<TableHead>품목</TableHead>
|
||||
<TableHead className="text-center">층</TableHead>
|
||||
<TableHead className="text-center">부호</TableHead>
|
||||
<TableHead className="text-center">사이즈</TableHead>
|
||||
<TableHead className="text-center">수량</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{order.nodes && order.nodes.length > 0 ? (
|
||||
order.nodes.map((node, idx) => {
|
||||
const product = order.products?.[idx];
|
||||
const width = (node.options?.width as number) || product?.openWidth;
|
||||
const height = (node.options?.height as number) || product?.openHeight;
|
||||
const productName = product?.productName || node.name || '-';
|
||||
const floor = product?.floor || '-';
|
||||
const code = product?.code || '-';
|
||||
return (
|
||||
<TableRow key={node.id}>
|
||||
<TableCell className="text-center text-xs">{idx + 1}</TableCell>
|
||||
<TableCell className="text-xs">{productName}</TableCell>
|
||||
<TableCell className="text-center text-xs">{floor}</TableCell>
|
||||
<TableCell className="text-center text-xs">{code}</TableCell>
|
||||
<TableCell className="text-center text-xs whitespace-nowrap">
|
||||
{width && height ? `${width} × ${height}` : '-'}
|
||||
</TableCell>
|
||||
<TableCell className="text-center text-xs">{node.quantity}</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
})
|
||||
) : order.products?.map((product, idx) => (
|
||||
<TableRow key={idx}>
|
||||
<TableCell className="text-center text-xs">{idx + 1}</TableCell>
|
||||
<TableCell className="text-xs">{product.productName || '-'}</TableCell>
|
||||
<TableCell className="text-center text-xs">{product.floor || '-'}</TableCell>
|
||||
<TableCell className="text-center text-xs">{product.code || '-'}</TableCell>
|
||||
<TableCell className="text-center text-xs whitespace-nowrap">
|
||||
{product.openWidth && product.openHeight
|
||||
? `${product.openWidth} × ${product.openHeight}`
|
||||
: '-'}
|
||||
</TableCell>
|
||||
<TableCell className="text-center text-xs">{product.quantity}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 확정 안내 */}
|
||||
<div className="bg-green-50 border border-green-200 rounded-lg p-4 text-sm space-y-1">
|
||||
<p className="font-medium mb-2 text-green-700">확정 후 변경사항</p>
|
||||
|
||||
Reference in New Issue
Block a user