From 2650b7c0bb0ea12b68a58c0439f72d61df04b2f1 Mon Sep 17 00:00:00 2001
From: dujinkim
Date: Fri, 25 Jul 2025 07:51:15 +0000
Subject: (대표님) 정기평가 대상, 미들웨어 수정, nextauth 토큰 처리 개선, GTC
등 (최겸) 기술영업
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../quotation-contacts-view-dialog.tsx | 6 +
.../detail-table/quotation-history-dialog.tsx | 163 +++++++++++++--------
.../table/detail-table/rfq-detail-column.tsx | 18 +++
.../table/detail-table/rfq-detail-table.tsx | 4 +-
.../detail-table/vendor-communication-drawer.tsx | 6 +-
.../vendor-contact-selection-dialog.tsx | 6 +
6 files changed, 136 insertions(+), 67 deletions(-)
(limited to 'lib/techsales-rfq/table/detail-table')
diff --git a/lib/techsales-rfq/table/detail-table/quotation-contacts-view-dialog.tsx b/lib/techsales-rfq/table/detail-table/quotation-contacts-view-dialog.tsx
index 3e793b62..61c97b1b 100644
--- a/lib/techsales-rfq/table/detail-table/quotation-contacts-view-dialog.tsx
+++ b/lib/techsales-rfq/table/detail-table/quotation-contacts-view-dialog.tsx
@@ -20,6 +20,7 @@ interface QuotationContact {
contactId: number
contactName: string
contactPosition: string | null
+ contactTitle: string | null
contactEmail: string
contactPhone: string | null
contactCountry: string | null
@@ -129,6 +130,11 @@ export function QuotationContactsViewDialog({
{contact.contactPosition}
)}
+ {contact.contactTitle && (
+
+ {contact.contactTitle}
+
+ )}
{contact.contactCountry && (
{contact.contactCountry}
diff --git a/lib/techsales-rfq/table/detail-table/quotation-history-dialog.tsx b/lib/techsales-rfq/table/detail-table/quotation-history-dialog.tsx
index 0f5158d9..7d972b91 100644
--- a/lib/techsales-rfq/table/detail-table/quotation-history-dialog.tsx
+++ b/lib/techsales-rfq/table/detail-table/quotation-history-dialog.tsx
@@ -1,5 +1,4 @@
"use client"
-
import * as React from "react"
import { useState, useEffect } from "react"
import {
@@ -16,6 +15,8 @@ import { Skeleton } from "@/components/ui/skeleton"
import { Clock, User, AlertCircle, Paperclip } from "lucide-react"
import { formatDate } from "@/lib/utils"
import { toast } from "sonner"
+import { Button } from "@/components/ui/button"
+import { updateSHIComment } from "@/lib/techsales-rfq/service";
interface QuotationAttachment {
id: number
@@ -37,7 +38,7 @@ interface QuotationSnapshot {
totalPrice: string | null
validUntil: Date | null
remark: string | null
- status: string | null
+ status: string
quotationVersion: number | null
submittedAt: Date | null
acceptedAt: Date | null
@@ -93,7 +94,9 @@ function QuotationCard({
isCurrent = false,
revisedBy,
revisedAt,
- attachments
+ attachments,
+ revisionId,
+ revisionNote,
}: {
data: QuotationSnapshot | QuotationHistoryData["current"]
version: number
@@ -101,9 +104,36 @@ function QuotationCard({
revisedBy?: string | null
revisedAt?: Date
attachments?: QuotationAttachment[]
+ revisionId?: number
+ revisionNote?: string | null
}) {
const statusInfo = statusConfig[data.status as keyof typeof statusConfig] ||
{ label: data.status || "알 수 없음", color: "bg-gray-100 text-gray-800" }
+
+ const [editValue, setEditValue] = React.useState(revisionNote || "");
+ const [isSaving, setIsSaving] = React.useState(false);
+
+ React.useEffect(() => {
+ setEditValue(revisionNote || "");
+ }, [revisionNote]);
+
+ const handleSave = async () => {
+ if (!revisionId) return;
+
+ setIsSaving(true);
+ try {
+ const result = await updateSHIComment(revisionId, editValue);
+ if (result.error) {
+ toast.error(result.error);
+ } else {
+ toast.success("저장 완료");
+ }
+ } catch (error) {
+ toast.error("저장 중 오류가 발생했습니다");
+ } finally {
+ setIsSaving(false);
+ }
+ };
return (
@@ -117,12 +147,6 @@ function QuotationCard({
{statusInfo.label}
- {/* {changeReason && (
-
-
- {changeReason}
-
- )} */}
@@ -147,6 +171,21 @@ function QuotationCard({
)}
+ {revisionId && (
+
+)}
+
{/* 첨부파일 섹션 */}
{attachments && attachments.length > 0 && (
@@ -209,16 +248,15 @@ export function QuotationHistoryDialog({
}: QuotationHistoryDialogProps) {
const [data, setData] = useState
(null)
const [isLoading, setIsLoading] = useState(false)
-
+
useEffect(() => {
if (open && quotationId) {
loadQuotationHistory()
}
}, [open, quotationId])
-
+
const loadQuotationHistory = async () => {
if (!quotationId) return
-
try {
setIsLoading(true)
const { getTechSalesVendorQuotationWithRevisions } = await import("@/lib/techsales-rfq/service")
@@ -238,14 +276,14 @@ export function QuotationHistoryDialog({
setIsLoading(false)
}
}
-
+
const handleOpenChange = (newOpen: boolean) => {
onOpenChange(newOpen)
if (!newOpen) {
setData(null) // 다이얼로그 닫을 때 데이터 초기화
}
}
-
+
return (
)
-}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/lib/techsales-rfq/table/detail-table/rfq-detail-column.tsx b/lib/techsales-rfq/table/detail-table/rfq-detail-column.tsx
index e4141520..7ece2406 100644
--- a/lib/techsales-rfq/table/detail-table/rfq-detail-column.tsx
+++ b/lib/techsales-rfq/table/detail-table/rfq-detail-column.tsx
@@ -46,6 +46,7 @@ export interface RfqDetailView {
createdByName: string | null
quotationCode?: string | null
rfqCode?: string | null
+ quotationVersion?: number | null
quotationAttachments?: Array<{
id: number
revisionId: number
@@ -185,6 +186,22 @@ export function getRfqDetailColumns({
enableResizing: true,
size: 160,
},
+ // [Rev 컬럼 추가]
+ {
+ id: "rev",
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => {
+ const version = row.original.quotationVersion ?? 0;
+ return {version}
;
+ },
+ meta: {
+ excelHeader: "Rev"
+ },
+ enableResizing: false,
+ size: 60,
+ },
{
accessorKey: "totalPrice",
header: ({ column }) => (
@@ -227,6 +244,7 @@ export function getRfqDetailColumns({
enableResizing: true,
size: 140,
},
+
{
accessorKey: "quotationAttachments",
header: ({ column }) => (
diff --git a/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx b/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx
index acf67497..8bfb8299 100644
--- a/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx
+++ b/lib/techsales-rfq/table/detail-table/rfq-detail-table.tsx
@@ -730,8 +730,8 @@ export function RfqDetailTables({ selectedRfq, maxHeight }: RfqDetailTablesProps
onSuccess={handleRefreshData}
/>
- {/* 다중 벤더 삭제 확인 다이얼로그
- {
- const { downloadFile } = await import("@/lib/file-download");
- await downloadFile(attachment.filePath, attachment.originalFileName);
+ const handleAttachmentDownload = (attachment: Attachment) => {
+ // TODO: 실제 다운로드 구현
+ window.open(attachment.filePath, '_blank');
};
// 파일 아이콘 선택
diff --git a/lib/techsales-rfq/table/detail-table/vendor-contact-selection-dialog.tsx b/lib/techsales-rfq/table/detail-table/vendor-contact-selection-dialog.tsx
index aa6f6c2f..031f4aa2 100644
--- a/lib/techsales-rfq/table/detail-table/vendor-contact-selection-dialog.tsx
+++ b/lib/techsales-rfq/table/detail-table/vendor-contact-selection-dialog.tsx
@@ -21,6 +21,7 @@ interface VendorContact {
id: number
contactName: string
contactPosition: string | null
+ contactTitle: string | null
contactEmail: string
contactPhone: string | null
isPrimary: boolean
@@ -283,6 +284,11 @@ export function VendorContactSelectionDialog({
{contact.contactPosition}
)}
+ {contact.contactTitle && (
+
+ {contact.contactTitle}
+
+ )}
--
cgit v1.2.3