From 1eb7cf92d1d7711e5d62a750e7611dc6fd1a241d Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 28 Nov 2025 07:45:32 +0000 Subject: (최겸) 구매 피드백 반영(입찰SAP 취소 개발 잔재) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bidding/selection/selection-result-form.tsx | 98 +++++++++++++++++-------- 1 file changed, 67 insertions(+), 31 deletions(-) (limited to 'lib/bidding/selection/selection-result-form.tsx') diff --git a/lib/bidding/selection/selection-result-form.tsx b/lib/bidding/selection/selection-result-form.tsx index 7f1229a2..54687cc9 100644 --- a/lib/bidding/selection/selection-result-form.tsx +++ b/lib/bidding/selection/selection-result-form.tsx @@ -8,14 +8,13 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Textarea } from '@/components/ui/textarea' import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form' -import { FileUpload } from '@/components/ui/file-upload' import { useToast } from '@/hooks/use-toast' import { saveSelectionResult } from './actions' -import { Loader2, Save } from 'lucide-react' +import { Loader2, Save, FileText } from 'lucide-react' +import { Dropzone, DropzoneZone, DropzoneUploadIcon, DropzoneTitle, DropzoneDescription, DropzoneInput } from '@/components/ui/dropzone' const selectionResultSchema = z.object({ summary: z.string().min(1, '결과요약을 입력해주세요'), - attachments: z.array(z.any()).optional(), }) type SelectionResultFormData = z.infer @@ -28,22 +27,26 @@ interface SelectionResultFormProps { export function SelectionResultForm({ biddingId, onSuccess }: SelectionResultFormProps) { const { toast } = useToast() const [isSubmitting, setIsSubmitting] = React.useState(false) + const [attachmentFiles, setAttachmentFiles] = React.useState([]) const form = useForm({ resolver: zodResolver(selectionResultSchema), defaultValues: { summary: '', - attachments: [], }, }) + const removeAttachmentFile = (index: number) => { + setAttachmentFiles(prev => prev.filter((_, i) => i !== index)) + } + const onSubmit = async (data: SelectionResultFormData) => { setIsSubmitting(true) try { const result = await saveSelectionResult({ biddingId, summary: data.summary, - attachments: data.attachments + attachments: attachmentFiles }) if (result.success) { @@ -99,33 +102,66 @@ export function SelectionResultForm({ biddingId, onSuccess }: SelectionResultFor /> {/* 첨부파일 */} - ( - - 첨부파일 - - - - - +
+ 첨부파일 + { + const newFiles = Array.from(files) + setAttachmentFiles(prev => [...prev, ...newFiles]) + }} + onDropRejected={() => { + toast({ + title: "파일 업로드 거부", + description: "파일 크기 및 형식을 확인해주세요.", + variant: "destructive", + }) + }} + > + + + + 파일을 드래그하거나 클릭하여 업로드 + + + PDF, Word, Excel, 이미지 파일 (최대 10MB) + + + + + + {attachmentFiles.length > 0 && ( +
+

업로드된 파일

+
+ {attachmentFiles.map((file, index) => ( +
+
+ +
+

{file.name}

+

+ {(file.size / 1024 / 1024).toFixed(2)} MB +

+
+
+ +
+ ))} +
+
)} - /> +
{/* 저장 버튼 */}
-- cgit v1.2.3