summaryrefslogtreecommitdiff
path: root/lib/techsales-rfq/table/detail-table/vendor-communication-drawer.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/techsales-rfq/table/detail-table/vendor-communication-drawer.tsx')
-rw-r--r--lib/techsales-rfq/table/detail-table/vendor-communication-drawer.tsx22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/techsales-rfq/table/detail-table/vendor-communication-drawer.tsx b/lib/techsales-rfq/table/detail-table/vendor-communication-drawer.tsx
index 51ef7b38..958cc8d1 100644
--- a/lib/techsales-rfq/table/detail-table/vendor-communication-drawer.tsx
+++ b/lib/techsales-rfq/table/detail-table/vendor-communication-drawer.tsx
@@ -37,7 +37,7 @@ import {
} from "@/components/ui/dialog"
import { formatDateTime } from "@/lib/utils"
import { formatFileSize } from "@/lib/utils" // formatFileSize 유틸리티 임포트
-import { fetchVendorComments, markMessagesAsRead } from "@/lib/procurement-rfqs/services"
+import { fetchTechSalesVendorComments, markTechSalesMessagesAsRead } from "@/lib/techsales-rfq/service"
// 타입 정의
interface Comment {
@@ -59,7 +59,7 @@ interface Attachment {
id: number;
fileName: string;
fileSize: number;
- fileType: string;
+ fileType: string | null;
filePath: string;
uploadedAt: Date;
}
@@ -99,8 +99,8 @@ async function sendComment(params: {
});
}
- // API 엔드포인트 구성
- const url = `/api/procurement-rfqs/${params.rfqId}/vendors/${params.vendorId}/comments`;
+ // API 엔드포인트 구성 - techSales용으로 변경
+ const url = `/api/tech-sales-rfqs/${params.rfqId}/vendors/${params.vendorId}/comments`;
// API 호출
const response = await fetch(url, {
@@ -169,11 +169,11 @@ export function VendorCommunicationDrawer({
setIsLoading(true);
// Server Action을 사용하여 코멘트 데이터 가져오기
- const commentsData = await fetchVendorComments(selectedRfq.id, selectedVendor.vendorId || 0);
+ const commentsData = await fetchTechSalesVendorComments(selectedRfq.id, selectedVendor.vendorId || 0);
setComments(commentsData as Comment[]); // 구체적인 타입으로 캐스팅
// Server Action을 사용하여 읽지 않은 메시지를 읽음 상태로 변경
- await markMessagesAsRead(selectedRfq.id, selectedVendor.vendorId || 0);
+ await markTechSalesMessagesAsRead(selectedRfq.id, selectedVendor.vendorId || 0);
} catch (error) {
console.error("코멘트 로드 오류:", error);
toast.error("메시지를 불러오는 중 오류가 발생했습니다");
@@ -269,15 +269,15 @@ export function VendorCommunicationDrawer({
const renderAttachmentPreviewDialog = () => {
if (!selectedAttachment) return null;
- const isImage = selectedAttachment.fileType.startsWith("image/");
- const isPdf = selectedAttachment.fileType.includes("pdf");
+ const isImage = selectedAttachment.fileType?.startsWith("image/");
+ const isPdf = selectedAttachment.fileType?.includes("pdf");
return (
<Dialog open={previewDialogOpen} onOpenChange={setPreviewDialogOpen}>
<DialogContent className="max-w-3xl">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
- {getFileIcon(selectedAttachment.fileType)}
+ {getFileIcon(selectedAttachment.fileType || '')}
{selectedAttachment.fileName}
</DialogTitle>
<DialogDescription>
@@ -300,7 +300,7 @@ export function VendorCommunicationDrawer({
/>
) : (
<div className="flex flex-col items-center gap-4 p-8">
- {getFileIcon(selectedAttachment.fileType)}
+ {getFileIcon(selectedAttachment.fileType || '')}
<p className="text-muted-foreground text-sm">미리보기를 지원하지 않는 파일 형식입니다.</p>
<Button
variant="outline"
@@ -398,7 +398,7 @@ export function VendorCommunicationDrawer({
className="flex items-center text-xs gap-2 mb-1 p-1 rounded hover:bg-black/5 cursor-pointer"
onClick={() => handleAttachmentPreview(attachment)}
>
- {getFileIcon(attachment.fileType)}
+ {getFileIcon(attachment.fileType || '')}
<span className="flex-1 truncate">{attachment.fileName}</span>
<span className="text-xs opacity-70">
{formatFileSize(attachment.fileSize)}