From b75b1cd920efd61923f7b2dbc4c49987b7b0c4e1 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 20 Nov 2025 10:25:41 +0000 Subject: (최겸) 구매 입찰 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bidding/create/bidding-create-dialog.tsx | 118 ++++++++++----------- 1 file changed, 56 insertions(+), 62 deletions(-) (limited to 'components/bidding/create/bidding-create-dialog.tsx') diff --git a/components/bidding/create/bidding-create-dialog.tsx b/components/bidding/create/bidding-create-dialog.tsx index ad9555db..9b0a6f66 100644 --- a/components/bidding/create/bidding-create-dialog.tsx +++ b/components/bidding/create/bidding-create-dialog.tsx @@ -45,6 +45,7 @@ import { DropzoneDescription, DropzoneInput, DropzoneTitle, + DropzoneTrigger, DropzoneUploadIcon, DropzoneZone, } from "@/components/ui/dropzone" @@ -198,28 +199,28 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp React.useEffect(() => { const loadNoticeTemplate = async () => { - if (selectedNoticeType) { - setIsLoadingTemplate(true) - try { - const template = await getBiddingNoticeTemplate(selectedNoticeType) - if (template) { - setNoticeTemplate(template.content) - // 폼의 content 필드도 업데이트 - form.setValue('content', template.content) - } else { - // 템플릿이 없으면 표준 템플릿 사용 - const defaultTemplate = await getBiddingNoticeTemplate('standard') - if (defaultTemplate) { - setNoticeTemplate(defaultTemplate.content) - form.setValue('content', defaultTemplate.content) - } + setIsLoadingTemplate(true) + try { + // 처음 로드할 때는 무조건 standard 템플릿 사용 + const templateType = selectedNoticeType || 'standard' + const template = await getBiddingNoticeTemplate(templateType) + if (template) { + setNoticeTemplate(template.content) + // 폼의 content 필드도 업데이트 + form.setValue('content', template.content) + } else { + // 템플릿이 없으면 표준 템플릿 사용 + const defaultTemplate = await getBiddingNoticeTemplate('standard') + if (defaultTemplate) { + setNoticeTemplate(defaultTemplate.content) + form.setValue('content', defaultTemplate.content) } - } catch (error) { - console.error('Failed to load notice template:', error) - toast.error('입찰공고 템플릿을 불러오는데 실패했습니다.') - } finally { - setIsLoadingTemplate(false) } + } catch (error) { + console.error('Failed to load notice template:', error) + toast.error('입찰공고 템플릿을 불러오는데 실패했습니다.') + } finally { + setIsLoadingTemplate(false) } } @@ -279,30 +280,13 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp return } - // 첨부파일 정보 설정 (실제로는 파일 업로드 후 저장해야 함) - const attachments = shiAttachmentFiles.map((file, index) => ({ - id: `shi_${Date.now()}_${index}`, - fileName: file.name, - fileSize: file.size, - filePath: '', // 실제 업로드 후 경로 - uploadedAt: new Date().toISOString(), - type: 'shi' as const, - })) - - const vendorAttachments = vendorAttachmentFiles.map((file, index) => ({ - id: `vendor_${Date.now()}_${index}`, - fileName: file.name, - fileSize: file.size, - filePath: '', // 실제 업로드 후 경로 - uploadedAt: new Date().toISOString(), - type: 'vendor' as const, - })) + // 첨부파일 정보 설정 // sparePartOptions가 undefined인 경우 빈 문자열로 설정 const biddingData = { ...data, - attachments, - vendorAttachments, + attachments: shiAttachmentFiles, // 실제 파일 객체들 전달 + vendorAttachments: vendorAttachmentFiles, // 실제 파일 객체들 전달 biddingConditions: { ...data.biddingConditions, sparePartOptions: data.biddingConditions.sparePartOptions || '', @@ -396,7 +380,7 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp - {/* 1행: 입찰명, 낙찰수, 입찰유형, 계약구분 */} + {/* 1행: 입찰명, 낙찰업체 수, 입찰유형, 계약구분 */}
( - 낙찰수 * + 낙찰업체 수* @@ -1138,12 +1128,12 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp )} /> - {isLoadingTemplate && ( + {/* {isLoadingTemplate && (
입찰공고 템플릿을 불러오는 중...
- )} + )} */} @@ -1174,14 +1164,16 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp }} > {() => ( - -
- -
- 파일을 드래그하여 업로드 + + +
+ +
+ 파일을 드래그하여 업로드 +
-
- + + )} @@ -1246,14 +1238,16 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp }} > {() => ( - -
- -
- 파일을 드래그하여 업로드 + + +
+ +
+ 파일을 드래그하여 업로드 +
-
- + + )} -- cgit v1.2.3