From 44b74ff4170090673b6eeacd8c528e0abf47b7aa Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 1 Dec 2025 19:52:06 +0900 Subject: (김준회) deprecated code 정리 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tbe/table/file-dialog.tsx | 141 ------------------------------------------ 1 file changed, 141 deletions(-) delete mode 100644 lib/tbe/table/file-dialog.tsx (limited to 'lib/tbe/table/file-dialog.tsx') diff --git a/lib/tbe/table/file-dialog.tsx b/lib/tbe/table/file-dialog.tsx deleted file mode 100644 index d22671da..00000000 --- a/lib/tbe/table/file-dialog.tsx +++ /dev/null @@ -1,141 +0,0 @@ -"use client" - -import * as React from "react" -import { Download, X } from "lucide-react" -import { toast } from "sonner" - -import { getErrorMessage } from "@/lib/handle-error" -import { formatDateTime } from "@/lib/utils" -import { Button } from "@/components/ui/button" -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog" - -import { - FileList, - FileListItem, - FileListIcon, - FileListInfo, - FileListName, - FileListDescription, - FileListAction, -} from "@/components/ui/file-list" -import { getTbeFilesForVendor } from "@/lib/rfqs/service" - -interface TBEFileDialogProps { - isOpen: boolean - onOpenChange: (open: boolean) => void - tbeId: number - vendorId: number - rfqId: number - onRefresh?: () => void -} - -export function TBEFileDialog({ - isOpen, - onOpenChange, - vendorId, - rfqId, - onRefresh, -}: TBEFileDialogProps) { - const [submittedFiles, setSubmittedFiles] = React.useState([]) - const [isFetchingFiles, setIsFetchingFiles] = React.useState(false) - - - // Fetch submitted files when dialog opens - React.useEffect(() => { - if (isOpen && rfqId && vendorId) { - fetchSubmittedFiles() - } - }, [isOpen, rfqId, vendorId]) - - // Fetch submitted files using the service function - const fetchSubmittedFiles = async () => { - if (!rfqId || !vendorId) return - - setIsFetchingFiles(true) - try { - const { files, error } = await getTbeFilesForVendor(rfqId, vendorId) - - if (error) { - throw new Error(error) - } - - setSubmittedFiles(files) - } catch (error) { - toast.error("Failed to load files: " + getErrorMessage(error)) - } finally { - setIsFetchingFiles(false) - } - } - - // Download submitted file - const downloadSubmittedFile = async (file: any) => { - try { - const response = await fetch(`/api/file/${file.id}/download`) - if (!response.ok) { - throw new Error("Failed to download file") - } - - const blob = await response.blob() - const url = window.URL.createObjectURL(blob) - const a = document.createElement("a") - a.href = url - a.download = file.fileName - document.body.appendChild(a) - a.click() - window.URL.revokeObjectURL(url) - document.body.removeChild(a) - } catch (error) { - toast.error("Failed to download file: " + getErrorMessage(error)) - } - } - - return ( - - - - TBE 응답 파일 - 제출된 파일 목록을 확인하고 다운로드하세요. - - - {/* 제출된 파일 목록 */} - {isFetchingFiles ? ( -
-
-
- ) : submittedFiles.length > 0 ? ( -
- - {submittedFiles.map((file) => ( - -
- - - {file.fileName} - - {file.uploadedAt ? formatDateTime(file.uploadedAt, "KR") : ""} - - -
- - - -
- ))} -
-
- ) : ( -
제출된 파일이 없습니다.
- )} -
-
- ) -} \ No newline at end of file -- cgit v1.2.3