From c72d0897f7b37843109c86f61d97eba05ba3ca0d Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 13 Jun 2025 07:08:01 +0000 Subject: (대표님) 20250613 16시 08분 b-rfq, document 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/b-rfq/attachment/revision-dialog.tsx | 196 +++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 lib/b-rfq/attachment/revision-dialog.tsx (limited to 'lib/b-rfq/attachment/revision-dialog.tsx') diff --git a/lib/b-rfq/attachment/revision-dialog.tsx b/lib/b-rfq/attachment/revision-dialog.tsx new file mode 100644 index 00000000..b1fe1576 --- /dev/null +++ b/lib/b-rfq/attachment/revision-dialog.tsx @@ -0,0 +1,196 @@ +"use client" + +import * as React from "react" +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { History, Download, Upload } from "lucide-react" +import { formatDate, formatBytes } from "@/lib/utils" +import { getAttachmentRevisions } from "../service" +import { AddRevisionDialog } from "./add-revision-dialog" + +interface RevisionDialogProps { + attachmentId: number + currentRevision: string + originalFileName: string +} + +export function RevisionDialog({ + attachmentId, + currentRevision, + originalFileName +}: RevisionDialogProps) { + const [open, setOpen] = React.useState(false) + const [revisions, setRevisions] = React.useState([]) + const [isLoading, setIsLoading] = React.useState(false) + const [isAddRevisionOpen, setIsAddRevisionOpen] = React.useState(false) + + // 리비전 목록 로드 + const loadRevisions = async () => { + setIsLoading(true) + try { + const result = await getAttachmentRevisions(attachmentId) + + if (result.success) { + setRevisions(result.revisions) + } else { + console.error("Failed to load revisions:", result.message) + } + } catch (error) { + console.error("Failed to load revisions:", error) + } finally { + setIsLoading(false) + } + } + + React.useEffect(() => { + if (open) { + loadRevisions() + } + }, [open, attachmentId]) + + return ( + <> + + + + + + + + + + 리비전 히스토리: {originalFileName} + + + 이 문서의 모든 버전을 확인하고 관리할 수 있습니다. + + + +
+ {/* 새 리비전 추가 버튼 */} +
+ +
+ + {/* 리비전 목록 */} + {isLoading ? ( +
리비전을 불러오는 중...
+ ) : ( +
+ + + + 리비전 + 파일명 + 크기 + 업로드 일시 + 업로드자 + 코멘트 + 액션 + + + + {revisions.map((revision) => ( + + +
+ + {revision.revisionNo} + + {revision.isLatest && ( + + 최신 + + )} +
+
+ + +
+
{revision.originalFileName}
+
+
+ + + {formatBytes(revision.fileSize)} + + + + {formatDate(revision.createdAt)} + + + + {revision.createdByName || "-"} + + + +
+ {revision.revisionComment || "-"} +
+
+ + + + +
+ ))} +
+
+
+ )} +
+
+
+ + {/* 새 리비전 추가 다이얼로그 */} + { + loadRevisions() // 리비전 목록 새로고침 + }} + /> + + ) + } \ No newline at end of file -- cgit v1.2.3