summaryrefslogtreecommitdiff
path: root/lib/rfq-last/vendor-response
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rfq-last/vendor-response')
-rw-r--r--lib/rfq-last/vendor-response/editor/quotation-items-table.tsx2
-rw-r--r--lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx36
2 files changed, 23 insertions, 15 deletions
diff --git a/lib/rfq-last/vendor-response/editor/quotation-items-table.tsx b/lib/rfq-last/vendor-response/editor/quotation-items-table.tsx
index c9790880..4a8960ff 100644
--- a/lib/rfq-last/vendor-response/editor/quotation-items-table.tsx
+++ b/lib/rfq-last/vendor-response/editor/quotation-items-table.tsx
@@ -53,6 +53,8 @@ export default function QuotationItemsTable({ prItems }: QuotationItemsTableProp
const currency = watch("vendorCurrency") || "USD"
const quotationItems = watch("quotationItems")
+
+ console.log(prItems,"prItems")
// PR 아이템 정보를 quotationItems에 초기화
useEffect(() => {
diff --git a/lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx b/lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx
index 6da704cd..569546dd 100644
--- a/lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx
+++ b/lib/rfq-last/vendor-response/editor/vendor-response-editor.tsx
@@ -19,6 +19,22 @@ import { Shield, FileText, CheckCircle, XCircle, Clock, Download, Eye, Save, Sen
import { Progress } from "@/components/ui/progress"
import { Alert, AlertDescription } from "@/components/ui/alert"
+
+const quotationItemSchema = z.object({
+ rfqPrItemId: z.number(),
+ unitPrice: z.number().min(0),
+ totalPrice: z.number().min(0),
+ vendorDeliveryDate: z.date().optional().nullable(),
+ leadTime: z.number().optional(),
+ manufacturer: z.string().optional(),
+ manufacturerCountry: z.string().optional(),
+ modelNo: z.string().optional(),
+ technicalCompliance: z.boolean(),
+ alternativeProposal: z.string().optional(),
+ discountRate: z.number().optional(),
+ itemRemark: z.string().optional(),
+ deviationReason: z.string().optional(),
+}).passthrough(); // ⬅️ 여기가 핵심: 정의 안 된 키도 유지
// 폼 스키마 정의
const vendorResponseSchema = z.object({
// 상업 조건
@@ -59,21 +75,7 @@ const vendorResponseSchema = z.object({
technicalProposal: z.string().optional(),
// 견적 아이템
- quotationItems: z.array(z.object({
- rfqPrItemId: z.number(),
- unitPrice: z.number().min(0),
- totalPrice: z.number().min(0),
- vendorDeliveryDate: z.date().optional().nullable(),
- leadTime: z.number().optional(),
- manufacturer: z.string().optional(),
- manufacturerCountry: z.string().optional(),
- modelNo: z.string().optional(),
- technicalCompliance: z.boolean(),
- alternativeProposal: z.string().optional(),
- discountRate: z.number().optional(),
- itemRemark: z.string().optional(),
- deviationReason: z.string().optional(),
- }))
+quotationItems: z.array(quotationItemSchema),
})
type VendorResponseFormData = z.infer<typeof vendorResponseSchema>
@@ -104,6 +106,8 @@ export default function VendorResponseEditor({
const [attachments, setAttachments] = useState<File[]>([])
const [uploadProgress, setUploadProgress] = useState(0) // 추가
+ console.log(existingResponse,"existingResponse")
+
// Form 초기값 설정
const defaultValues: VendorResponseFormData = {
@@ -175,6 +179,8 @@ export default function VendorResponseEditor({
}
}, [errors])
+ console.log(methods.getValues())
+
const handleFormSubmit = (isSubmit: boolean = false) => {