From 79cfa7ea8f21ae227dbb2843ae536fe876ba7c55 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 27 Nov 2025 03:08:50 +0000 Subject: (최겸) 구매 입찰 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bidding/create/bidding-create-dialog.tsx | 112 +++++---------------- 1 file changed, 24 insertions(+), 88 deletions(-) (limited to 'components/bidding/create') diff --git a/components/bidding/create/bidding-create-dialog.tsx b/components/bidding/create/bidding-create-dialog.tsx index cf662cd1..f298721b 100644 --- a/components/bidding/create/bidding-create-dialog.tsx +++ b/components/bidding/create/bidding-create-dialog.tsx @@ -36,10 +36,6 @@ import { getPlaceOfDestinationForSelection, } from '@/lib/procurement-select/service' import { TAX_CONDITIONS } from '@/lib/tax-conditions/types' -import { getBiddingNoticeTemplate } from '@/lib/bidding/service' -import TiptapEditor from '@/components/qna/tiptap-editor' - -// Dropzone components import { Dropzone, DropzoneDescription, @@ -101,10 +97,6 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp const [selectedBidPic, setSelectedBidPic] = React.useState(undefined) const [selectedSupplyPic, setSelectedSupplyPic] = React.useState(undefined) - // 입찰공고 템플릿 관련 상태 - const [noticeTemplate, setNoticeTemplate] = React.useState('') - const [isLoadingTemplate, setIsLoadingTemplate] = React.useState(false) - // -- 데이터 로딩 및 상태 동기화 로직 const loadPaymentTerms = React.useCallback(async () => { try { @@ -174,59 +166,9 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp setBiddingConditions((prev) => ({ ...prev, taxConditions: 'V1' })) form.setValue('biddingConditions.taxConditions', 'V1') } - - // 초기 표준 템플릿 로드 - const loadInitialTemplate = async () => { - try { - const standardTemplate = await getBiddingNoticeTemplate('standard') - if (standardTemplate) { - console.log('standardTemplate', standardTemplate) - setNoticeTemplate(standardTemplate.content) - form.setValue('content', standardTemplate.content) - } - } catch (error) { - console.error('Failed to load initial template:', error) - toast.error('기본 템플릿을 불러오는데 실패했습니다.') - } - } - loadInitialTemplate() } }, [isOpen, loadPaymentTerms, loadIncoterms, loadShippingPlaces, loadDestinationPlaces, form]) - // 입찰공고 템플릿 로딩 - const noticeTypeValue = form.watch('noticeType') - const selectedNoticeType = React.useMemo(() => noticeTypeValue, [noticeTypeValue]) - - React.useEffect(() => { - const loadNoticeTemplate = async () => { - 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) - } - } - - loadNoticeTemplate() - }, [selectedNoticeType, form]) - // SHI용 파일 첨부 핸들러 const handleShiFileUpload = (event: React.ChangeEvent) => { const files = Array.from(event.target.files || []) @@ -313,7 +255,6 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp setVendorAttachmentFiles([]) setSelectedBidPic(undefined) setSelectedSupplyPic(undefined) - setNoticeTemplate('') if (onSuccess) { onSuccess() } @@ -337,7 +278,6 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp setVendorAttachmentFiles([]) setSelectedBidPic(undefined) setSelectedSupplyPic(undefined) - setNoticeTemplate('') setBiddingConditions({ paymentTerms: '', taxConditions: 'V1', @@ -1097,7 +1037,7 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp {/* 입찰공고 내용 */} - + {/* 입찰공고 내용

@@ -1127,14 +1067,14 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp )} /> - {/* {isLoadingTemplate && ( + {isLoadingTemplate && (

입찰공고 템플릿을 불러오는 중...
- )} */} + )} -
+
*/} {/* SHI용 첨부파일 */} @@ -1162,18 +1102,16 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp }) }} > - {() => ( - - -
- -
- 파일을 드래그하여 업로드 -
-
-
-
- )} + + + + 파일을 드래그하거나 클릭하여 업로드 + + + PDF, Word, Excel, 이미지 파일 (최대 600MB) + + + {shiAttachmentFiles.length > 0 && ( @@ -1236,18 +1174,16 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp }) }} > - {() => ( - - -
- -
- 파일을 드래그하여 업로드 -
-
-
-
- )} + + + + 파일을 드래그하거나 클릭하여 업로드 + + + 협력업체용 문서나 파일을 업로드 하세요. (최대 600MB) + + + {vendorAttachmentFiles.length > 0 && ( -- cgit v1.2.3