From cf8dac0c6490469dab88a560004b0c07dbd48612 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 18 Sep 2025 00:23:40 +0000 Subject: (대표님) rfq, 계약, 서명 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/shi-signature/upload-form.tsx | 115 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 lib/shi-signature/upload-form.tsx (limited to 'lib/shi-signature/upload-form.tsx') diff --git a/lib/shi-signature/upload-form.tsx b/lib/shi-signature/upload-form.tsx new file mode 100644 index 00000000..642cd1a5 --- /dev/null +++ b/lib/shi-signature/upload-form.tsx @@ -0,0 +1,115 @@ +'use client'; + +import { useState } from 'react'; +import { uploadBuyerSignature } from './buyer-signature'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { Alert, AlertDescription } from '@/components/ui/alert'; +import { Upload, Loader2, CheckCircle } from 'lucide-react'; +import { toast } from 'sonner'; + +export function BuyerSignatureUploadForm() { + const [isUploading, setIsUploading] = useState(false); + const [preview, setPreview] = useState(null); + + const handleFileChange = (e: React.ChangeEvent) => { + const file = e.target.files?.[0]; + if (file) { + const reader = new FileReader(); + reader.onloadend = () => { + setPreview(reader.result as string); + }; + reader.readAsDataURL(file); + } + }; + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setIsUploading(true); + + const formData = new FormData(e.currentTarget); + + try { + const result = await uploadBuyerSignature(formData); + + if (result.success) { + toast.success('서명이 성공적으로 업로드되었습니다.'); + setPreview(null); + (e.target as HTMLFormElement).reset(); + } else { + toast.error(result.error || '업로드에 실패했습니다.'); + } + } catch (error) { + toast.error('업로드 중 오류가 발생했습니다.'); + } finally { + setIsUploading(false); + } + }; + + return ( + + + 구매자 서명 업로드 + + 삼성중공업 서명 이미지를 업로드하세요. 이 서명은 계약서에 자동으로 적용됩니다. + + + +
+
+ + +

+ PNG, JPG, JPEG 형식 (최대 5MB) +

+
+ + {preview && ( +
+ + 서명 미리보기 +
+ )} + + + + 업로드한 서명은 즉시 활성화되며, 새로운 계약서에 자동으로 적용됩니다. + + + + +
+
+
+ ); +} \ No newline at end of file -- cgit v1.2.3