diff options
| author | joonhoekim <26rote@gmail.com> | 2025-10-14 15:13:43 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-10-14 15:13:43 +0900 |
| commit | b61931f50ba63f9a91ac8eb01fd91aa6e2fb6119 (patch) | |
| tree | 35aaa7b9d3c509236d94490deb24271133ddbbaa /lib/rfq-last/vendor-response/editor/attachments-upload.tsx | |
| parent | 598a40808b45413b373334092c3b60cab97d09b6 (diff) | |
| parent | dfc898b298e16bf686d2929db0eee50abe87881d (diff) | |
(김준회) AVL, Vendorpool 관련 요구사항 처리
Diffstat (limited to 'lib/rfq-last/vendor-response/editor/attachments-upload.tsx')
| -rw-r--r-- | lib/rfq-last/vendor-response/editor/attachments-upload.tsx | 87 |
1 files changed, 61 insertions, 26 deletions
diff --git a/lib/rfq-last/vendor-response/editor/attachments-upload.tsx b/lib/rfq-last/vendor-response/editor/attachments-upload.tsx index b85407ff..96a88ef7 100644 --- a/lib/rfq-last/vendor-response/editor/attachments-upload.tsx +++ b/lib/rfq-last/vendor-response/editor/attachments-upload.tsx @@ -33,7 +33,8 @@ import { FileCheck, Calculator, Wrench, - X + X, + CheckCircle } from "lucide-react" import { formatBytes } from "@/lib/utils" import { cn } from "@/lib/utils" @@ -52,6 +53,7 @@ interface AttachmentsUploadProps { onExistingAttachmentsChange?: (files: any[]) => void responseId?: number userId?: number + isSubmitted?: boolean } const acceptedFileTypes = { @@ -67,7 +69,8 @@ export default function AttachmentsUpload({ existingAttachments = [], onExistingAttachmentsChange, responseId, - userId + userId, + isSubmitted = false }: AttachmentsUploadProps) { const purchaseInputRef = useRef<HTMLInputElement>(null) const designInputRef = useRef<HTMLInputElement>(null) @@ -271,6 +274,16 @@ export default function AttachmentsUpload({ return ( <div className="space-y-4"> + {/* 제출완료 상태 알림 */} + {isSubmitted && ( + <Alert> + <CheckCircle className="h-4 w-4" /> + <AlertDescription> + <strong>제출완료:</strong> 견적서가 이미 제출되어 추가 파일 업로드가 제한됩니다. + </AlertDescription> + </Alert> + )} + {/* 필수 파일 안내 */} <Alert> <AlertCircle className="h-4 w-4" /> @@ -312,13 +325,14 @@ export default function AttachmentsUpload({ <div className={cn( "border-2 border-dashed rounded-lg p-6 text-center transition-colors", - purchaseDragActive ? "border-blue-500 bg-blue-50" : "border-gray-300", - "hover:border-blue-400 hover:bg-blue-50/50" + purchaseDragActive && !isSubmitted ? "border-blue-500 bg-blue-50" : "border-gray-300", + !isSubmitted && "hover:border-blue-400 hover:bg-blue-50/50", + isSubmitted && "opacity-50 cursor-not-allowed bg-gray-50" )} - onDragEnter={handlePurchaseDrag} - onDragLeave={handlePurchaseDrag} - onDragOver={handlePurchaseDrag} - onDrop={handlePurchaseDrop} + onDragEnter={!isSubmitted ? handlePurchaseDrag : undefined} + onDragLeave={!isSubmitted ? handlePurchaseDrag : undefined} + onDragOver={!isSubmitted ? handlePurchaseDrag : undefined} + onDrop={!isSubmitted ? handlePurchaseDrop : undefined} > <Calculator className="mx-auto h-10 w-10 text-blue-500 mb-3" /> <p className="text-sm text-gray-600 mb-2"> @@ -328,11 +342,15 @@ export default function AttachmentsUpload({ type="button" variant="outline" size="sm" - onClick={() => purchaseInputRef.current?.click()} - className="border-blue-500 text-blue-600 hover:bg-blue-50" + onClick={() => !isSubmitted && purchaseInputRef.current?.click()} + className={cn( + "border-blue-500 text-blue-600 hover:bg-blue-50", + isSubmitted && "opacity-50 cursor-not-allowed" + )} + disabled={isSubmitted} > <Paperclip className="h-4 w-4 mr-2" /> - 구매 문서 선택 + {isSubmitted ? "제출완료" : "구매 문서 선택"} </Button> <input ref={purchaseInputRef} @@ -366,13 +384,14 @@ export default function AttachmentsUpload({ <div className={cn( "border-2 border-dashed rounded-lg p-6 text-center transition-colors", - designDragActive ? "border-green-500 bg-green-50" : "border-gray-300", - "hover:border-green-400 hover:bg-green-50/50" + designDragActive && !isSubmitted ? "border-green-500 bg-green-50" : "border-gray-300", + !isSubmitted && "hover:border-green-400 hover:bg-green-50/50", + isSubmitted && "opacity-50 cursor-not-allowed bg-gray-50" )} - onDragEnter={handleDesignDrag} - onDragLeave={handleDesignDrag} - onDragOver={handleDesignDrag} - onDrop={handleDesignDrop} + onDragEnter={!isSubmitted ? handleDesignDrag : undefined} + onDragLeave={!isSubmitted ? handleDesignDrag : undefined} + onDragOver={!isSubmitted ? handleDesignDrag : undefined} + onDrop={!isSubmitted ? handleDesignDrop : undefined} > <Wrench className="mx-auto h-10 w-10 text-green-500 mb-3" /> <p className="text-sm text-gray-600 mb-2"> @@ -382,11 +401,15 @@ export default function AttachmentsUpload({ type="button" variant="outline" size="sm" - onClick={() => designInputRef.current?.click()} - className="border-green-500 text-green-600 hover:bg-green-50" + onClick={() => !isSubmitted && designInputRef.current?.click()} + className={cn( + "border-green-500 text-green-600 hover:bg-green-50", + isSubmitted && "opacity-50 cursor-not-allowed" + )} + disabled={isSubmitted} > <Paperclip className="h-4 w-4 mr-2" /> - 설계 문서 선택 + {isSubmitted ? "제출완료" : "설계 문서 선택"} </Button> <input ref={designInputRef} @@ -494,7 +517,9 @@ export default function AttachmentsUpload({ type="button" variant="ghost" size="sm" - onClick={() => handleDeleteClick(file, true, index)} + onClick={() => !isSubmitted && handleDeleteClick(file, true, index)} + className={isSubmitted ? "opacity-50 cursor-not-allowed" : ""} + disabled={isSubmitted} > <Trash2 className="h-4 w-4 text-red-500" /> </Button> @@ -523,8 +548,12 @@ export default function AttachmentsUpload({ type="button" variant={file.attachmentType === "구매" ? "default" : "ghost"} size="sm" - className="h-7 px-2 text-xs" - onClick={() => handleTypeChange(index, "구매")} + className={cn( + "h-7 px-2 text-xs", + isSubmitted && "opacity-50 cursor-not-allowed" + )} + onClick={() => !isSubmitted && handleTypeChange(index, "구매")} + disabled={isSubmitted} > <Calculator className="h-3 w-3 mr-1" /> 구매 @@ -533,8 +562,12 @@ export default function AttachmentsUpload({ type="button" variant={file.attachmentType === "설계" ? "default" : "ghost"} size="sm" - className="h-7 px-2 text-xs" - onClick={() => handleTypeChange(index, "설계")} + className={cn( + "h-7 px-2 text-xs", + isSubmitted && "opacity-50 cursor-not-allowed" + )} + onClick={() => !isSubmitted && handleTypeChange(index, "설계")} + disabled={isSubmitted} > <Wrench className="h-3 w-3 mr-1" /> 설계 @@ -552,7 +585,9 @@ export default function AttachmentsUpload({ type="button" variant="ghost" size="sm" - onClick={() => handleDeleteClick(file, false, index)} + onClick={() => !isSubmitted && handleDeleteClick(file, false, index)} + className={isSubmitted ? "opacity-50 cursor-not-allowed" : ""} + disabled={isSubmitted} > <Trash2 className="h-4 w-4 text-red-500" /> </Button> |
