summaryrefslogtreecommitdiff
path: root/lib/rfq-last/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rfq-last/vendor')
-rw-r--r--lib/rfq-last/vendor/vendor-detail-dialog.tsx120
1 files changed, 71 insertions, 49 deletions
diff --git a/lib/rfq-last/vendor/vendor-detail-dialog.tsx b/lib/rfq-last/vendor/vendor-detail-dialog.tsx
index 9c112efa..cbe4f919 100644
--- a/lib/rfq-last/vendor/vendor-detail-dialog.tsx
+++ b/lib/rfq-last/vendor/vendor-detail-dialog.tsx
@@ -55,6 +55,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
+import { formatFileSize, quickDownload, smartFileAction } from "@/lib/file-download";
// Props 타입 정의
interface VendorResponseDetailDialogProps {
@@ -183,10 +184,13 @@ export function VendorResponseDetailDialog({
<div className="flex-1 overflow-y-auto px-6 ">
<Tabs defaultValue="overview" className="mb-2">
- <TabsList className="grid w-full grid-cols-3">
+ <TabsList className="grid w-full grid-cols-4">
<TabsTrigger value="overview">개요</TabsTrigger>
<TabsTrigger value="quotation">견적정보</TabsTrigger>
<TabsTrigger value="items">품목상세</TabsTrigger>
+ <TabsTrigger value="documents">
+ 제출 문서
+ </TabsTrigger>
</TabsList>
{/* 개요 탭 */}
@@ -773,60 +777,78 @@ export function VendorResponseDetailDialog({
)}
</TabsContent>
- {/* 첨부파일 탭 */}
- {/* <TabsContent value="attachments" className="space-y-4">
- {attachments.length > 0 ? (
- <Card>
- <CardHeader>
- <CardTitle className="text-base">첨부파일</CardTitle>
- <CardDescription>
- 총 {attachments.length}개 파일
- </CardDescription>
- </CardHeader>
- <CardContent>
- <div className="space-y-2">
- {attachments.map((file: any) => (
- <div
- key={file.id}
- className="flex items-center justify-between p-3 border rounded-lg hover:bg-accent"
- >
- <div className="flex items-center gap-3">
- <Paperclip className="h-4 w-4 text-muted-foreground" />
- <div>
- <p className="text-sm font-medium">{file.originalFileName}</p>
- <p className="text-xs text-muted-foreground">
- {file.attachmentType} • {file.fileSize ? `${(file.fileSize / 1024).toFixed(2)} KB` : "크기 미상"}
- {file.description && ` • ${file.description}`}
+ {/* 제출 문서 탭 */}
+ <TabsContent value="documents" className="space-y-4">
+ <Card>
+ <CardHeader>
+ <CardTitle className="text-base">제출 문서</CardTitle>
+ <CardDescription>
+ 총 {attachments.length}개 파일
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ {attachments.length > 0 ? (
+ <div className="space-y-2 max-h-[52vh] overflow-y-auto pr-1">
+ {attachments.map((file: any) => {
+ const fileLabel = file.originalFileName || file.fileName || "파일명 없음";
+ const canOpen = !!file.filePath;
+ return (
+ <div
+ key={`${file.id}-${file.filePath}-${file.originalFileName}`}
+ className="flex items-start justify-between gap-4 rounded-lg border p-3 hover:bg-accent/50"
+ >
+ <div className="space-y-1">
+ <div className="flex items-center gap-2 flex-wrap">
+ <Paperclip className="h-4 w-4 text-muted-foreground" />
+ <Badge variant="secondary">{file.attachmentType || "문서"}</Badge>
+ <span className="font-medium break-all">{fileLabel}</span>
+ </div>
+ <p className="text-xs text-muted-foreground space-x-2 flex flex-wrap">
+ {file.documentNo && <span>문서번호: {file.documentNo}</span>}
+ {file.description && <span>{file.description}</span>}
+ <span>{file.fileSize ? formatFileSize(file.fileSize) : "크기 정보 없음"}</span>
+ {file.uploadedAt && (
+ <span>
+ 업로드: {format(new Date(file.uploadedAt), "yyyy-MM-dd HH:mm", { locale: ko })}
+ </span>
+ )}
+ {file.uploadedByName && <span>작성: {file.uploadedByName}</span>}
</p>
</div>
+ <div className="flex items-center gap-2">
+ <Button
+ variant="ghost"
+ size="sm"
+ disabled={!canOpen}
+ onClick={() => smartFileAction(file.filePath, fileLabel)}
+ className="h-8"
+ >
+ <Eye className="h-4 w-4 mr-1" />
+ 열기
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={!canOpen}
+ onClick={() => quickDownload(file.filePath, fileLabel)}
+ className="h-8"
+ >
+ <Download className="h-4 w-4 mr-1" />
+ 다운로드
+ </Button>
+ </div>
</div>
- <div className="flex items-center gap-2">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => {
- // 파일 다운로드 로직
- window.open(file.filePath, "_blank");
- }}
- >
- <Download className="h-4 w-4" />
- </Button>
- </div>
- </div>
- ))}
+ );
+ })}
</div>
- </CardContent>
- </Card>
- ) : (
- <Card>
- <CardContent className="pt-6">
- <div className="text-center text-muted-foreground">
+ ) : (
+ <div className="text-sm text-muted-foreground">
아직 제출된 첨부파일이 없습니다.
</div>
- </CardContent>
- </Card>
- )}
- </TabsContent> */}
+ )}
+ </CardContent>
+ </Card>
+ </TabsContent>
</Tabs>
</div>