From f56eb799ecdcd2baae1db26460cd1deff0a69eee Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 17 Nov 2025 10:00:28 +0000 Subject: (임수민) gtc 기본계약 코멘트 수정_v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-contract/vendor-gtc/[id]/page.tsx | 158 ++++++++++----------- 1 file changed, 78 insertions(+), 80 deletions(-) diff --git a/app/[lng]/evcp/(evcp)/(procurement)/basic-contract/vendor-gtc/[id]/page.tsx b/app/[lng]/evcp/(evcp)/(procurement)/basic-contract/vendor-gtc/[id]/page.tsx index a2746dfa..a2b3449c 100644 --- a/app/[lng]/evcp/(evcp)/(procurement)/basic-contract/vendor-gtc/[id]/page.tsx +++ b/app/[lng]/evcp/(evcp)/(procurement)/basic-contract/vendor-gtc/[id]/page.tsx @@ -2,9 +2,6 @@ import * as React from "react" import { notFound } from "next/navigation" import { type SearchParams } from "@/types/table" -import { getValidFilters } from "@/lib/data-table" -import { Skeleton } from "@/components/ui/skeleton" -import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton" import { Shell } from "@/components/shell" import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" @@ -13,17 +10,10 @@ import { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbS import { formatDateTime } from "@/lib/utils" import { Button } from "@/components/ui/button" import Link from "next/link" - -import { - getGtcClauses, - getUsersForFilter, - getVendorClausesForDocument -} from "@/lib/gtc-contract/gtc-clauses/service" import { getGtcDocumentById } from "@/lib/gtc-contract/service" -import { searchParamsCache } from "@/lib/gtc-contract/gtc-clauses/validations" -import { GtcClausesVendorTable } from "@/lib/basic-contract/gtc-vendor/clause-table" import { UpdateVendorDocumentStatusButton } from "@/lib/basic-contract/vendor-table/update-vendor-document-status-button" import { getVendorById } from "@/lib/vendors/repository" +import { AgreementCommentList } from "@/lib/basic-contract/agreement-comments/agreement-comment-list" interface GtcClausesPageProps { params: Promise<{ id: string }> @@ -48,31 +38,44 @@ export default async function GtcClausesPage(props: GtcClausesPageProps) { const contractId = searchParams.contractId ? parseInt(searchParams.contractId as string) : undefined const templateId = searchParams.templateId ? parseInt(searchParams.templateId as string) : undefined - // 문서 정보 조회 - const document = await getGtcDocumentById(documentId) - if (!document) { - notFound() + // 🔥 새로운 코멘트 시스템: gtc_documents 불필요, basic_contract_templates만 사용 + // templateId는 basic_contract_templates.id를 의미 + + console.log(`📋 계약서 템플릿 조회: templateId=${templateId}, documentId=${documentId}`); + + // templateId로 basic_contract_template 조회 + const { getBasicContractTemplateByIdService } = await import("@/lib/basic-contract/service"); + const template = templateId + ? await getBasicContractTemplateByIdService(templateId.toString()) + : null; + + if (!template) { + console.error(`❌ 기본계약서 템플릿을 찾을 수 없음. templateId: ${templateId}`); + notFound(); } + + console.log(`✅ 템플릿 찾음: ${template.templateName} (ID: ${template.id})`); + + // document 객체 생성 (페이지에서 필요한 최소한의 정보) + const document = { + id: template.id, + title: template.templateName, + type: 'standard' as const, + revision: template.revision || 1, + projectId: null, + projectCode: null, + projectName: null, + fileName: template.fileName, + filePath: template.filePath, + isActive: template.status === 'ACTIVE', + createdAt: template.createdAt, + updatedAt: template.updatedAt, + }; console.log(document, "document") - const search = searchParamsCache.parse(searchParams) - const validFilters = getValidFilters(search.filters) - - // 병렬로 데이터 조회 - const promises = Promise.all([ - getGtcClauses({ - ...search, - filters: validFilters, - documentId, - }), - getUsersForFilter(), - getVendorClausesForDocument({ documentId, vendorId }), // vendorId 전달 - vendorId ? getVendorById(vendorId) : Promise.resolve(null), // vendor 데이터 추가 - - ]) - - const [_, __, vendorData] = await promises.then(values => values) + // 벤더 정보 조회 (vendorId가 있을 때만) + const vendorData = vendorId ? await getVendorById(vendorId) : null const vendorDocument = vendorData?.vendorDocument || null return ( @@ -90,7 +93,7 @@ export default async function GtcClausesPage(props: GtcClausesPageProps) { - {vendorName ? `${vendorName} GTC 협의` : 'GTC 조항 관리'} + {vendorName ? `${vendorName} GTC 협의` : 'GTC 협의 관리'} @@ -116,7 +119,7 @@ export default async function GtcClausesPage(props: GtcClausesPageProps) {
벤더 협의 정보 - {vendorName}과(와)의 GTC 조항 협의를 진행합니다 + {vendorName}과(와)의 GTC 협의를 진행합니다
@@ -141,55 +144,50 @@ export default async function GtcClausesPage(props: GtcClausesPageProps) { - {vendorData && contractId && ( + {vendorDocument && contractId && ( -
-
- 총 {vendorData.totalModified || 0}개 조항 협의됨, {vendorData.totalExcluded || 0}개 조항 제외됨 -
- +
{/* 협의 완료 업데이트 버튼 */} - {vendorDocument && ( - - )} +
)} )} - {/* 템플릿 정보 섹션 */} - }> - - + {/* 템플릿 정보 섹션 */} + }> + +
- {/* 조항 테이블 */} - - } - > - - + {/* 기본계약서 협의 코멘트 섹션 - contractId가 있을 때만 표시 */} + {contractId ? ( + + +
+
+ 협의 코멘트 + + {vendorName ? `${vendorName}과(와)의 ` : ''}계약서 협의 내용을 작성하고 공유합니다 + +
+
+
+ + + +
+ ) : null} ) } @@ -203,7 +201,7 @@ export async function generateMetadata(props: GtcClausesPageProps) { if (isNaN(documentId)) { return { - title: "GTC 조항 관리", + title: "GTC 협의 관리", } } @@ -212,18 +210,18 @@ export async function generateMetadata(props: GtcClausesPageProps) { if (!document) { return { - title: "GTC 조항 관리", + title: "GTC 협의 관리", } } - const baseTitle = `GTC 조항 관리 - ${document.type === "standard" ? "표준" : "프로젝트"} v${document.revision}` + const baseTitle = `GTC 협의 관리 - ${document.type === "standard" ? "표준" : "프로젝트"} v${document.revision}` const title = vendorName ? `${vendorName} ${baseTitle}` : baseTitle const description = vendorName - ? `${vendorName}과(와)의 GTC 조항 협의를 관리합니다.` + ? `${vendorName}과(와)의 GTC 협의를 관리합니다.` : document.project - ? `${document.project.name} (${document.project.code}) 프로젝트의 GTC 조항을 관리합니다.` - : "표준 GTC 조항을 관리합니다." + ? `${document.project.name} (${document.project.code}) 프로젝트의 GTC 협의를 관리합니다.` + : "표준 GTC 협의를 관리합니다." return { title, @@ -231,7 +229,7 @@ export async function generateMetadata(props: GtcClausesPageProps) { } } catch (error) { return { - title: "GTC 조항 관리", + title: "GTC 협의 관리", } } } -- cgit v1.2.3