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 --- .../detail-table/quotation-history-dialog.tsx | 163 +++++++++++++-------- 1 file changed, 101 insertions(+), 62 deletions(-) (limited to 'lib/techsales-rfq/table/detail-table/quotation-history-dialog.tsx') 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 && ( +
+

SHI Comment

+