From 4fe733d7d9d3d873fa395133e9a42cf9fc8c44dc Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 24 Sep 2025 07:59:35 +0000 Subject: (최겸) 구매 피드백 반영(용어 수정, 견적유형, 조건설정, 첨부파일 선택사항 등) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rfq-last/table/create-general-rfq-dialog.tsx | 67 +++++------------------- 1 file changed, 12 insertions(+), 55 deletions(-) (limited to 'lib/rfq-last/table/create-general-rfq-dialog.tsx') diff --git a/lib/rfq-last/table/create-general-rfq-dialog.tsx b/lib/rfq-last/table/create-general-rfq-dialog.tsx index 2c69f4b7..f7515787 100644 --- a/lib/rfq-last/table/create-general-rfq-dialog.tsx +++ b/lib/rfq-last/table/create-general-rfq-dialog.tsx @@ -70,22 +70,13 @@ const itemSchema = z.object({ // 일반견적 생성 폼 스키마 const createGeneralRfqSchema = z.object({ rfqType: z.string().min(1, "견적 종류를 선택해주세요"), - customRfqType: z.string().optional(), rfqTitle: z.string().min(1, "견적명을 입력해주세요"), dueDate: z.date({ - required_error: "마감일을 선택해주세요", + required_error: "제출마감일을 선택해주세요", }), - picUserId: z.number().min(1, "구매 담당자를 선택해주세요"), + picUserId: z.number().min(1, "견적담당자를 선택해주세요"), remark: z.string().optional(), items: z.array(itemSchema).min(1, "최소 하나의 아이템을 추가해주세요"), -}).refine((data) => { - if (data.rfqType === "기타") { - return data.customRfqType && data.customRfqType.trim().length > 0 - } - return true -}, { - message: "견적 종류를 직접 입력해주세요", - path: ["customRfqType"], }) type CreateGeneralRfqFormValues = z.infer @@ -120,7 +111,6 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp resolver: zodResolver(createGeneralRfqSchema), defaultValues: { rfqType: "", - customRfqType: "", rfqTitle: "", dueDate: undefined, picUserId: userId || undefined, @@ -142,12 +132,9 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp name: "items", }) - // 견적 종류 변경 시 customRfqType 필드 초기화 + // 견적 종류 변경 const handleRfqTypeChange = (value: string) => { form.setValue("rfqType", value) - if (value !== "기타") { - form.setValue("customRfqType", "") - } } // RFQ 코드 미리보기 생성 @@ -233,7 +220,6 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp if (!newOpen) { form.reset({ rfqType: "", - customRfqType: "", rfqTitle: "", dueDate: undefined, picUserId: userId || undefined, @@ -269,12 +255,9 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp setIsLoading(true) try { - // 견적 종류가 "기타"인 경우 customRfqType 사용 - const finalRfqType = data.rfqType === "기타" ? data.customRfqType || "기타" : data.rfqType - // 서버 액션 호출 const result = await createGeneralRfqAction({ - rfqType: finalRfqType, + rfqType: data.rfqType, rfqTitle: data.rfqTitle, dueDate: data.dueDate, picUserId: data.picUserId, @@ -325,7 +308,6 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp }) } - const isCustomRfqType = form.watch("rfqType") === "기타" return ( @@ -360,7 +342,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp control={form.control} name="rfqType" render={({ field }) => ( - + 견적 종류 * @@ -371,50 +353,25 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp - 정기견적 - 긴급견적 단가계약 - 기술견적 - 예산견적 - 기타 + 매각계약 + 일반계약 )} /> - - {/* 기타 견적 종류 입력 필드 */} - {isCustomRfqType && ( - ( - - - 견적 종류 직접 입력 * - - - - - - - )} - /> - )} - {/* 마감일 */} + {/* 제출마감일 */} ( - 마감일 * + 제출마감일 * @@ -429,7 +386,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp {field.value ? ( format(field.value, "yyyy-MM-dd") ) : ( - 마감일을 선택하세요 + 제출마감일을 선택하세요 (미선택 시 생성일 +7일) )} @@ -483,7 +440,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp render={({ field }) => ( - 구매 담당자 * + 견적담당자 * @@ -503,7 +460,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp ) : ( <> - {selectedUser ? selectedUser.name : "구매 담당자를 선택하세요"} + {selectedUser ? selectedUser.name : "견적담당자를 선택하세요"} -- cgit v1.2.3