diff options
Diffstat (limited to 'lib/rfq-last/table/rfq-attachments-dialog.tsx')
| -rw-r--r-- | lib/rfq-last/table/rfq-attachments-dialog.tsx | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/lib/rfq-last/table/rfq-attachments-dialog.tsx b/lib/rfq-last/table/rfq-attachments-dialog.tsx index 103617b3..4afb4200 100644 --- a/lib/rfq-last/table/rfq-attachments-dialog.tsx +++ b/lib/rfq-last/table/rfq-attachments-dialog.tsx @@ -2,7 +2,7 @@ import * as React from "react" import { format } from "date-fns" -import { Download, FileText, Eye, ExternalLink, Loader2, RefreshCw } from "lucide-react" +import { Download, FileText, Eye, Loader2 } from "lucide-react" import { Dialog, DialogContent, @@ -25,7 +25,7 @@ import { Skeleton } from "@/components/ui/skeleton" import { toast } from "sonner" import { RfqsLastView } from "@/db/schema" import { getRfqAttachmentsAction } from "../service" -import { downloadFile, quickPreview, smartFileAction, formatFileSize, getFileInfo } from "@/lib/file-download" +import { downloadFile, quickPreview, formatFileSize, getFileInfo } from "@/lib/file-download" // import { syncRfqPosFiles } from "@/lib/pos" // 주석 처리: ECC 매핑 시 자동 처리로 변경 // import { useSession } from "next-auth/react" // 주석 처리: 동기화 UI 제거로 불필요 @@ -94,8 +94,8 @@ export function RfqAttachmentsDialog({ isOpen, onClose, rfqData }: RfqAttachment setDownloadingFiles(prev => new Set([...prev, attachmentId])) try { - // POS 파일(설계 문서)은 별도 API 사용 - if (attachment.attachmentType === '설계') { + // POS 파일은 filePath가 uploads/pos/로 시작하는 파일들 + if (attachment.filePath.startsWith('uploads/pos/')) { const downloadUrl = `/api/pos/download?revisionId=${attachment.attachmentId}` const link = document.createElement('a') link.href = downloadUrl @@ -142,10 +142,11 @@ export function RfqAttachmentsDialog({ isOpen, onClose, rfqData }: RfqAttachment // 파일 미리보기 핸들러 const handlePreview = async (attachment: RfqAttachment) => { const fileInfo = getFileInfo(attachment.originalFileName) + const isPosFile = attachment.filePath.startsWith('uploads/pos/') - // POS 파일(설계 문서)은 미리보기를 지원하지 않음 - if (attachment.attachmentType === '설계' || !fileInfo.canPreview) { - const message = attachment.attachmentType === '설계' + // POS 파일은 미리보기를 지원하지 않음 + if (isPosFile || !fileInfo.canPreview) { + const message = isPosFile ? "POS 파일은 미리보기를 지원하지 않습니다. 다운로드를 진행합니다." : "이 파일 형식은 미리보기를 지원하지 않습니다. 다운로드를 진행합니다." toast.info(message) @@ -165,21 +166,22 @@ export function RfqAttachmentsDialog({ isOpen, onClose, rfqData }: RfqAttachment } // 스마트 파일 액션 (미리보기 가능하면 미리보기, 아니면 다운로드) - const handleSmartAction = async (attachment: RfqAttachment) => { - const attachmentId = attachment.attachmentId - const fileInfo = getFileInfo(attachment.originalFileName) - - // POS 파일(설계 문서)은 미리보기를 지원하지 않으므로 바로 다운로드 - if (attachment.attachmentType === '설계') { - return handleDownload(attachment) - } - - if (fileInfo.canPreview) { - return handlePreview(attachment) - } else { - return handleDownload(attachment) - } - } + // const handleSmartAction = async (attachment: RfqAttachment) => { + // const attachmentId = attachment.attachmentId + // const fileInfo = getFileInfo(attachment.originalFileName) + // const isPosFile = attachment.filePath.startsWith('uploads/pos/') + // + // // POS 파일은 미리보기를 지원하지 않으므로 바로 다운로드 + // if (isPosFile) { + // return handleDownload(attachment) + // } + // + // if (fileInfo.canPreview) { + // return handlePreview(attachment) + // } else { + // return handleDownload(attachment) + // } + // } // POS 파일 동기화 핸들러 - 주석 처리: ECC 매핑 시 자동 처리로 변경 // const handlePosSync = async () => { |
