diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-11-27 03:08:50 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-11-27 03:08:50 +0000 |
| commit | 79cfa7ea8f21ae227dbb2843ae536fe876ba7c55 (patch) | |
| tree | f12efae72c62286c1a2e9a3f31d695ca22d83b6e /components/bidding/create | |
| parent | e1da84ac863989b9f63b089c09aaa2bbcdc3d6cd (diff) | |
(최겸) 구매 입찰 수정
Diffstat (limited to 'components/bidding/create')
| -rw-r--r-- | components/bidding/create/bidding-create-dialog.tsx | 112 |
1 files changed, 24 insertions, 88 deletions
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<PurchaseGroupCodeWithUser | undefined>(undefined)
const [selectedSupplyPic, setSelectedSupplyPic] = React.useState<ProcurementManagerWithUser | undefined>(undefined)
- // 입찰공고 템플릿 관련 상태
- const [noticeTemplate, setNoticeTemplate] = React.useState<string>('')
- 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<HTMLInputElement>) => {
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 </Card>
{/* 입찰공고 내용 */}
- <Card>
+ {/* <Card>
<CardHeader>
<CardTitle>입찰공고 내용</CardTitle>
<p className="text-sm text-muted-foreground">
@@ -1127,14 +1067,14 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp )}
/>
- {/* {isLoadingTemplate && (
+ {isLoadingTemplate && (
<div className="flex items-center justify-center p-4 text-sm text-muted-foreground">
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-gray-900 mr-2"></div>
입찰공고 템플릿을 불러오는 중...
</div>
- )} */}
+ )}
</CardContent>
- </Card>
+ </Card> */}
{/* SHI용 첨부파일 */}
<Card>
@@ -1162,18 +1102,16 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp })
}}
>
- {() => (
- <DropzoneTrigger asChild>
- <DropzoneZone className="flex justify-center h-32">
- <div className="flex items-center gap-6">
- <DropzoneUploadIcon />
- <div className="grid gap-0.5">
- <DropzoneTitle>파일을 드래그하여 업로드</DropzoneTitle>
- </div>
- </div>
- </DropzoneZone>
- </DropzoneTrigger>
- )}
+ <DropzoneZone>
+ <DropzoneUploadIcon className="mx-auto h-12 w-12 text-muted-foreground" />
+ <DropzoneTitle className="text-lg font-medium">
+ 파일을 드래그하거나 클릭하여 업로드
+ </DropzoneTitle>
+ <DropzoneDescription className="text-sm text-muted-foreground">
+ PDF, Word, Excel, 이미지 파일 (최대 600MB)
+ </DropzoneDescription>
+ </DropzoneZone>
+ <DropzoneInput />
</Dropzone>
{shiAttachmentFiles.length > 0 && (
@@ -1236,18 +1174,16 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp })
}}
>
- {() => (
- <DropzoneTrigger asChild>
- <DropzoneZone className="flex justify-center h-32">
- <div className="flex items-center gap-6">
- <DropzoneUploadIcon />
- <div className="grid gap-0.5">
- <DropzoneTitle>파일을 드래그하여 업로드</DropzoneTitle>
- </div>
- </div>
- </DropzoneZone>
- </DropzoneTrigger>
- )}
+ <DropzoneZone>
+ <DropzoneUploadIcon className="mx-auto h-12 w-12 text-muted-foreground" />
+ <DropzoneTitle className="text-lg font-medium">
+ 파일을 드래그하거나 클릭하여 업로드
+ </DropzoneTitle>
+ <DropzoneDescription className="text-sm text-muted-foreground">
+ 협력업체용 문서나 파일을 업로드 하세요. (최대 600MB)
+ </DropzoneDescription>
+ </DropzoneZone>
+ <DropzoneInput />
</Dropzone>
{vendorAttachmentFiles.length > 0 && (
|
