From 10f90dc68dec42e9a64e081cc0dce6a484447290 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 29 Jul 2025 11:48:59 +0000 Subject: (대표님, 박서영, 최겸) document-list-only, gtc, vendorDocu, docu-list-rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../document-list-only/[contractId]/page.tsx | 175 +++++++++++++++++++++ .../(partners)/document-list-only/layout.tsx | 48 ++++++ .../(partners)/document-list-only/page.tsx | 21 +++ 3 files changed, 244 insertions(+) create mode 100644 app/[lng]/partners/(partners)/document-list-only/[contractId]/page.tsx create mode 100644 app/[lng]/partners/(partners)/document-list-only/layout.tsx create mode 100644 app/[lng]/partners/(partners)/document-list-only/page.tsx (limited to 'app') diff --git a/app/[lng]/partners/(partners)/document-list-only/[contractId]/page.tsx b/app/[lng]/partners/(partners)/document-list-only/[contractId]/page.tsx new file mode 100644 index 00000000..e3cda9b4 --- /dev/null +++ b/app/[lng]/partners/(partners)/document-list-only/[contractId]/page.tsx @@ -0,0 +1,175 @@ +// document-stages-management-page.tsx +import { Suspense } from "react" +import { Separator } from "@/components/ui/separator" +import { Skeleton } from "@/components/ui/skeleton" +import { type SearchParams } from "@/types/table" +import { getValidFilters } from "@/lib/data-table" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Progress } from "@/components/ui/progress" +import { + TrendingUp, + AlertTriangle, + Clock, + Target, + FileText, + Settings, + Download +} from "lucide-react" +import { Button } from "@/components/ui/button" +import { DocumentStagesTable } from "@/lib/vendor-document-list/plant/document-stages-table" +import { documentStageSearchParamsCache } from "@/lib/vendor-document-list/plant/document-stage-validations" +import { getDocumentProgressStats, getDocumentStagesOnly } from "@/lib/vendor-document-list/plant/document-stages-service" + +interface DocumentStagesManagementPageProps { + params: { + contractId: string + } + searchParams: Promise +} + + +// 전체 진행률 카드 컴포넌트 +async function ProgressCard({ contractId }: { contractId: number }) { + const stats = await getDocumentProgressStats(contractId) + + return ( + + +
+ 전체 진행률 +
+
+
+
+ +
+
+ 평균 진행률 + {stats.avgProgress}% +
+ + +
+
+
{stats.totalDocuments}
+
전체
+
+
+
{stats.completedDocuments}
+
완료
+
+
+
{stats.inProgressDocuments}
+
진행중
+
+
+
{stats.overdueDocuments}
+
지연
+
+
+
+
+
+ ) +} + +// 문서 테이블 래퍼 컴포넌트 +async function DocumentTableWrapper({ + contractId, + searchParams, + projectType +}: { + contractId: number + searchParams: any + projectType: "ship" | "plant" +}) { + const search = documentStageSearchParamsCache.parse(searchParams) + const validFilters = getValidFilters(search.filters) + + const documentsPromise = getDocumentStagesOnly({ + ...search, + filters: validFilters, + }, contractId) + + return ( + + ) +} + + + +function TableLoadingSkeleton() { + return ( +
+
+ +
+ + +
+
+
+
+
+ {Array.from({ length: 5 }).map((_, i) => ( +
+ + + + + + +
+ ))} +
+
+
+
+ ) +} + +// 메인 페이지 컴포넌트 +export default async function DocumentStagesManagementPage({ + params, + searchParams +}: DocumentStagesManagementPageProps) { + const resolvedParams = await params + const contractId = Number(resolvedParams.contractId) + const resolvedSearchParams = await searchParams + + // 프로젝트 타입 결정 (실제로는 계약 정보에서 가져와야 함) + const projectType = resolvedSearchParams.projectType === "plant" ? "plant" : "ship" + + if (isNaN(contractId)) { + throw new Error("유효하지 않은 계약 ID입니다") + } + + return ( +
+ + {/* 문서 테이블 */} + {/*
*/} + {/*
+

문서 목록

+
+ 스테이지 상태별로 문서를 관리하고 진행 상황을 추적할 수 있습니다 +
+
*/} + + }> + + + {/*
*/} + +
+ ) +} \ No newline at end of file diff --git a/app/[lng]/partners/(partners)/document-list-only/layout.tsx b/app/[lng]/partners/(partners)/document-list-only/layout.tsx new file mode 100644 index 00000000..8d486113 --- /dev/null +++ b/app/[lng]/partners/(partners)/document-list-only/layout.tsx @@ -0,0 +1,48 @@ + +import { cookies } from "next/headers" +import { Shell } from "@/components/shell" +import DocumentContainer from "@/components/documents/document-container" +import { getVendorProjectsAndContracts } from "@/lib/vendor-data/services" +import { getVendorDocumentLists } from "@/lib/vendor-document/service" +import VendorDocumentsClient from "@/components/documents/vendor-docs.client" +import VendorDocumentListClient from "@/components/document-lists/vendor-doc-list-client" +import { authOptions } from "@/app/api/auth/[...nextauth]/route"; +import { getServerSession } from "next-auth"; + + + +// Layout 컴포넌트는 서버 컴포넌트입니다 +export default async function VendorDocuments({ + children, +}: { + children: React.ReactNode +}) { + const session = await getServerSession(authOptions) + const vendorId = session?.user.companyId + // const vendorId = "17" + const idAsNumber = Number(vendorId) + + const projects = await getVendorProjectsAndContracts(idAsNumber); + const filteredProjects = projects.filter(v=>v.projectType === "plant") + + + // 레이아웃 설정 쿠키 가져오기 + // Next.js 15에서는 cookies()가 Promise를 반환하므로 await 사용 + const cookieStore = await cookies() + + // 이제 cookieStore.get() 메서드 사용 가능 + const layout = cookieStore.get("react-resizable-panels:layout:mail") + const collapsed = cookieStore.get("react-resizable-panels:collapsed") + + const defaultLayout = layout ? JSON.parse(layout.value) : undefined + const defaultCollapsed = collapsed ? JSON.parse(collapsed.value) : undefined + + + return ( + + + {children} + + + ) +} \ No newline at end of file diff --git a/app/[lng]/partners/(partners)/document-list-only/page.tsx b/app/[lng]/partners/(partners)/document-list-only/page.tsx new file mode 100644 index 00000000..721eb408 --- /dev/null +++ b/app/[lng]/partners/(partners)/document-list-only/page.tsx @@ -0,0 +1,21 @@ +// app/vendor-data/page.tsx +import * as React from "react" +import { Separator } from "@/components/ui/separator" + +export default async function IndexPage() { + return ( +
+ +
+
+

시작하는 방법

+

+ 오른쪽 상단에서 프로젝트/계약을 선택하세요.
+ + +

+
+
+
+ ) +} \ No newline at end of file -- cgit v1.2.3