diff options
Diffstat (limited to 'lib/tbe-last')
| -rw-r--r-- | lib/tbe-last/service.ts | 21 | ||||
| -rw-r--r-- | lib/tbe-last/vendor/tbe-table.tsx | 8 |
2 files changed, 25 insertions, 4 deletions
diff --git a/lib/tbe-last/service.ts b/lib/tbe-last/service.ts index da0a5a4c..346576e5 100644 --- a/lib/tbe-last/service.ts +++ b/lib/tbe-last/service.ts @@ -1,11 +1,11 @@ // lib/tbe-last/service.ts 'use server' -import { revalidatePath, unstable_cache } from "next/cache"; +import { revalidatePath, revalidateTag, unstable_cache } from "next/cache"; import db from "@/db/db"; import { and, desc, asc, eq, sql, or, isNull, isNotNull, ne, inArray } from "drizzle-orm"; import { tbeLastView, tbeDocumentsView } from "@/db/schema"; -import { rfqPrItems } from "@/db/schema/rfqLast"; +import { rfqPrItems, rfqsLast } from "@/db/schema/rfqLast"; import {rfqLastDetails, rfqLastTbeDocumentReviews, rfqLastTbePdftronComments, rfqLastTbeVendorDocuments,rfqLastTbeSessions } from "@/db/schema"; import { filterColumns } from "@/lib/filter-columns"; import { GetTBELastSchema } from "./validations"; @@ -320,10 +320,22 @@ export async function updateTbeEvaluation( // 상태 업데이트 if (data.status !== undefined) { updateData.status = data.status - + // 완료 상태로 변경 시 종료일 설정 if (data.status === "완료") { updateData.actualEndDate = new Date() + + // TBE 완료 시 연결된 RFQ 상태를 "TBE 완료"로 업데이트 + if (currentTbeSession.rfqsLastId) { + await db + .update(rfqsLast) + .set({ + status: "TBE 완료", + updatedBy: userId, + updatedAt: new Date() + }) + .where(eq(rfqsLast.id, currentTbeSession.rfqsLastId)) + } } } @@ -337,10 +349,11 @@ export async function updateTbeEvaluation( // 캐시 초기화 revalidateTag(`tbe-session-${tbeSessionId}`) revalidateTag(`tbe-sessions`) - + // RFQ 관련 캐시도 초기화 if (currentTbeSession.rfqsLastId) { revalidateTag(`rfq-${currentTbeSession.rfqsLastId}`) + revalidateTag(`rfqs`) } return { diff --git a/lib/tbe-last/vendor/tbe-table.tsx b/lib/tbe-last/vendor/tbe-table.tsx index d7ee0a06..48242088 100644 --- a/lib/tbe-last/vendor/tbe-table.tsx +++ b/lib/tbe-last/vendor/tbe-table.tsx @@ -21,6 +21,7 @@ import { VendorQADialog } from "./vendor-comment-dialog" import { VendorDocumentsSheet } from "./vendor-documents-sheet" import { VendorPrItemsDialog } from "./vendor-pr-items-dialog" import { getTBEforVendor } from "../vendor-tbe-service" +import { VendorEvaluationViewDialog } from "./vendor-evaluation-view-dialog" interface TbeVendorTableProps { promises: Promise<[ @@ -217,6 +218,13 @@ export function TbeVendorTable({ promises }: TbeVendorTableProps) { onOpenChange={setPrItemsOpen} rfqId={selectedRfqId} /> + {/* Evaluation View Dialog */} + <VendorEvaluationViewDialog + open={evaluationViewOpen} + onOpenChange={setEvaluationViewOpen} + selectedSession={selectedSession} + sessionDetail={sessionDetail} + /> </> ) }
\ No newline at end of file |
