1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
'use client'
import * as React from 'react'
import { Bidding } from '@/db/schema'
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@/components/ui/table'
import { formatDate } from '@/lib/utils'
interface PrItem {
id: number
biddingId: number
itemName: string
itemCode: string
specification: string
quantity: number | null
unit: string | null
estimatedPrice: number | null
budget: number | null
deliveryDate: Date | null
notes: string | null
createdAt: Date
updatedAt: Date
}
interface BiddingDetailItemsDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
prItems: PrItem[]
bidding: Bidding
}
export function BiddingDetailItemsDialog({
open,
onOpenChange,
prItems,
bidding
}: BiddingDetailItemsDialogProps) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-6xl max-h-[80vh] overflow-y-auto">
<DialogHeader>
<DialogTitle>품목 정보</DialogTitle>
<DialogDescription>
입찰번호: {bidding.biddingNumber} - 품목 상세 정보
</DialogDescription>
</DialogHeader>
<div className="space-y-4">
<div className="grid grid-cols-2 gap-4 text-sm">
<div>
<span className="font-medium">프로젝트:</span> {bidding.projectName || '-'}
</div>
<div>
<span className="font-medium">품목:</span> {bidding.itemName || '-'}
</div>
</div>
<div className="border rounded-lg">
<Table>
<TableHeader>
<TableRow>
<TableHead>품목코드</TableHead>
<TableHead>품목명</TableHead>
<TableHead>규격</TableHead>
<TableHead className="text-right">수량</TableHead>
<TableHead>단위</TableHead>
<TableHead className="text-right">예상단가</TableHead>
<TableHead className="text-right">예산</TableHead>
<TableHead>납기요청일</TableHead>
<TableHead>비고</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{prItems.length > 0 ? (
prItems.map((item) => (
<TableRow key={item.id}>
<TableCell className="font-mono text-sm">
{item.itemCode}
</TableCell>
<TableCell className="font-medium">
{item.itemName}
</TableCell>
<TableCell className="text-sm">
{item.specification || '-'}
</TableCell>
<TableCell className="text-right">
{item.quantity ? Number(item.quantity).toLocaleString() : '-'}
</TableCell>
<TableCell>{item.unit}</TableCell>
<TableCell className="text-right font-mono">
{item.estimatedPrice ? Number(item.estimatedPrice).toLocaleString() : '-'} {bidding.currency}
</TableCell>
<TableCell className="text-right font-mono">
{item.budget ? Number(item.budget).toLocaleString() : '-'} {bidding.currency}
</TableCell>
<TableCell className="text-sm">
{item.deliveryDate ? formatDate(item.deliveryDate, 'KR') : '-'}
</TableCell>
<TableCell className="text-sm">
{item.notes || '-'}
</TableCell>
</TableRow>
))
) : (
<TableRow>
<TableCell colSpan={9} className="text-center py-8">
등록된 품목이 없습니다.
</TableCell>
</TableRow>
)}
</TableBody>
</Table>
</div>
{prItems.length > 0 && (
<div className="text-sm text-muted-foreground">
총 {prItems.length}개 품목
</div>
)}
</div>
</DialogContent>
</Dialog>
)
}
|