summaryrefslogtreecommitdiff
path: root/components/bidding/price-adjustment-dialog.tsx
blob: 6a520eac24b2460e01486b89d0421b73c6d59074 (plain)
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
'use client'

import React from 'react'
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
} from '@/components/ui/dialog'
import { Badge } from '@/components/ui/badge'
import { Separator } from '@/components/ui/separator'
import { formatDate } from '@/lib/utils'

interface PriceAdjustmentData {
  id: number
  itemName?: string | null
  adjustmentReflectionPoint?: string | null
  majorApplicableRawMaterial?: string | null
  adjustmentFormula?: string | null
  rawMaterialPriceIndex?: string | null
  referenceDate?: Date | null
  comparisonDate?: Date | null
  adjustmentRatio?: string | null
  notes?: string | null
  adjustmentConditions?: string | null
  majorNonApplicableRawMaterial?: string | null
  adjustmentPeriod?: string | null
  contractorWriter?: string | null
  adjustmentDate?: Date | null
  nonApplicableReason?: string | null
  createdAt: Date
  updatedAt: Date
}

interface PriceAdjustmentDialogProps {
  open: boolean
  onOpenChange: (open: boolean) => void
  data: PriceAdjustmentData | null
  vendorName: string
}

export function PriceAdjustmentDialog({
  open,
  onOpenChange,
  data,
  vendorName,
}: PriceAdjustmentDialogProps) {
  if (!data) return null

  return (
    <Dialog open={open} onOpenChange={onOpenChange}>
      <DialogContent className="max-w-4xl max-h-[80vh] overflow-y-auto">
        <DialogHeader>
          <DialogTitle className="flex items-center gap-2">
            <span>하도급대금등 연동표</span>
            <Badge variant="secondary">{vendorName}</Badge>
          </DialogTitle>
          <DialogDescription>
            협력업체가 제출한 연동제 적용 정보입니다.
          </DialogDescription>
        </DialogHeader>

        <div className="space-y-6">
          {/* 기본 정보 */}
          <div>
            <h3 className="text-sm font-medium text-gray-900 mb-3">기본 정보</h3>
            <div className="grid grid-cols-2 gap-4">
              <div>
                <label className="text-xs text-gray-500">물품등의 명칭</label>
                <p className="text-sm font-medium">{data.itemName || '-'}</p>
              </div>
              <div>
                <label className="text-xs text-gray-500">조정대금 반영시점</label>
                <p className="text-sm font-medium">{data.adjustmentReflectionPoint || '-'}</p>
              </div>
            </div>
          </div>

          <Separator />

          {/* 원재료 정보 */}
          <div>
            <h3 className="text-sm font-medium text-gray-900 mb-3">원재료 정보</h3>
            <div className="space-y-4">
              <div>
                <label className="text-xs text-gray-500">연동대상 주요 원재료</label>
                <p className="text-sm font-medium whitespace-pre-wrap">
                  {data.majorApplicableRawMaterial || '-'}
                </p>
              </div>
              <div>
                <label className="text-xs text-gray-500">연동 미적용 주요 원재료</label>
                <p className="text-sm font-medium whitespace-pre-wrap">
                  {data.majorNonApplicableRawMaterial || '-'}
                </p>
              </div>
              <div>
                <label className="text-xs text-gray-500">연동 미적용 사유</label>
                <p className="text-sm font-medium whitespace-pre-wrap">
                  {data.nonApplicableReason || '-'}
                </p>
              </div>
            </div>
          </div>

          <Separator />

          {/* 연동 공식 및 지표 */}
          <div>
            <h3 className="text-sm font-medium text-gray-900 mb-3">연동 공식 및 지표</h3>
            <div className="space-y-4">
              <div>
                <label className="text-xs text-gray-500">하도급대금등 연동 산식</label>
                <div className="p-3 bg-gray-50 rounded-md">
                  <p className="text-sm font-mono whitespace-pre-wrap">
                    {data.adjustmentFormula || '-'}
                  </p>
                </div>
              </div>
              <div>
                <label className="text-xs text-gray-500">원재료 가격 기준지표</label>
                <p className="text-sm font-medium whitespace-pre-wrap">
                  {data.rawMaterialPriceIndex || '-'}
                </p>
              </div>
              <div className="grid grid-cols-2 gap-4">
                <div>
                  <label className="text-xs text-gray-500">원재료 기준 가격의 변동률 산정을 위한 기준시점</label>
                  <p className="text-sm font-medium">{data.referenceDate ? formatDate(data.referenceDate, "kr") : '-'}</p>
                </div>
                <div>
                  <label className="text-xs text-gray-500">원재료 기준 가격의 변동률 산정을 위한 비교시점</label>
                  <p className="text-sm font-medium">{data.comparisonDate ? formatDate(data.comparisonDate, "kr") : '-'}</p>
                </div>
              </div>
              <div>
                <label className="text-xs text-gray-500">반영비율</label>
                <p className="text-sm font-medium">
                  {data.adjustmentRatio ? `${data.adjustmentRatio}%` : '-'}
                </p>
              </div>
            </div>
          </div>

          <Separator />

          {/* 조정 조건 및 기타 */}
          <div>
            <h3 className="text-sm font-medium text-gray-900 mb-3">조정 조건 및 기타</h3>
            <div className="space-y-4">
              <div>
                <label className="text-xs text-gray-500">조정요건</label>
                <p className="text-sm font-medium whitespace-pre-wrap">
                  {data.adjustmentConditions || '-'}
                </p>
              </div>
              <div className="grid grid-cols-2 gap-4">
                <div>
                  <label className="text-xs text-gray-500">조정주기</label>
                  <p className="text-sm font-medium">{data.adjustmentPeriod || '-'}</p>
                </div>
                <div>
                  <label className="text-xs text-gray-500">조정일</label>
                  <p className="text-sm font-medium">{data.adjustmentDate ? formatDate(data.adjustmentDate, "kr") : '-'}</p>
                </div>
              </div>
              <div>
                <label className="text-xs text-gray-500">수탁기업(협력사)작성자</label>
                <p className="text-sm font-medium">{data.contractorWriter || '-'}</p>
              </div>
              <div>
                <label className="text-xs text-gray-500">기타사항</label>
                <p className="text-sm font-medium whitespace-pre-wrap">
                  {data.notes || '-'}
                </p>
              </div>
            </div>
          </div>

          <Separator />

          {/* 메타 정보 */}
          <div className="text-xs text-gray-500 space-y-1">
            <p>작성일: {formatDate(data.createdAt, "kr")}</p>
            <p>수정일: {formatDate(data.updatedAt, "kr")}</p>
          </div>

          <Separator />

          {/* 참고 경고문 */}
          <div className="text-xs text-red-600 space-y-2 bg-red-50 p-3 rounded-md border border-red-200">
            <p className="font-medium">※ 참고사항</p>
            <div className="space-y-1">
              <p>• 납품대금의 10% 이상을 차지하는 주요 원재료가 있는 경우 모든 주요 원재료에 대해서 적용 또는 미적용에 대한 연동표를 작성해야 한다.</p>
              <p>• 납품대급연동표를 허위로 작성하거나 근거자료를 허위로 제출할 경우 본 계약이 체결되지 않을 수 있으며, 본 계약이 체결되었더라도 계약의 전부 또는 일부를 해제 또는 해지할 수 있다.</p>
            </div>
          </div>
        </div>
      </DialogContent>
    </Dialog>
  )
}