From 1a2241c40e10193c5ff7008a7b7b36cc1d855d96 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Tue, 25 Mar 2025 15:55:45 +0900 Subject: initial commit --- .../document-lists/vendor-doc-list-client.tsx | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 components/document-lists/vendor-doc-list-client.tsx (limited to 'components/document-lists/vendor-doc-list-client.tsx') diff --git a/components/document-lists/vendor-doc-list-client.tsx b/components/document-lists/vendor-doc-list-client.tsx new file mode 100644 index 00000000..17137650 --- /dev/null +++ b/components/document-lists/vendor-doc-list-client.tsx @@ -0,0 +1,81 @@ +"use client" + +import * as React from "react" +import { useRouter, useParams } from "next/navigation" + +import DocumentContainer from "@/components/documents/document-container" +import { ProjectInfo, ProjectSwitcher } from "@/components/documents/project-swicher" + +interface VendorDocumentsClientProps { + projects: ProjectInfo[] + children: React.ReactNode +} + +export default function VendorDocumentListClient({ + projects, + children, +}: VendorDocumentsClientProps) { + const router = useRouter() + const params = useParams() + + // Get the contractId from route parameters + const contractIdFromUrl = React.useMemo(() => { + if (params?.contractId) { + const contractId = Array.isArray(params.contractId) + ? params.contractId[0] + : params.contractId + return Number(contractId) + } + return null + }, [params]) + + // Use the URL contractId as the selected contract + const [selectedContractId, setSelectedContractId] = React.useState( + contractIdFromUrl + ) + + // Update selectedContractId when URL changes + React.useEffect(() => { + if (contractIdFromUrl) { + setSelectedContractId(contractIdFromUrl) + } + }, [contractIdFromUrl]) + + + // Handle contract selection + function handleSelectContract(projectId: number, contractId: number) { + const projectType = projects.find(v=>v.projectId === projectId)?.projectType || "ship" + setSelectedContractId(contractId) + + // Navigate to the contract's documents page + router.push(`/partners/document-list/${contractId}?projectType=${projectType}`) + } + + return ( + <> + {/* 상단 영역: 제목 왼쪽 / ProjectSwitcher 오른쪽 */} +
+ {/* 왼쪽: 타이틀 & 설명 */} +
+

Vendor Document List

+

+ 문서리스트와 이슈스테이지를 생성하고 관리할 수 있으며 삼성중공업으로 전달할 수 있습니다. +

+
+ + {/* 오른쪽: ProjectSwitcher */} + +
+ + {/* 문서 목록/테이블 영역 */} +
+ {children} +
+ + ) +} \ No newline at end of file -- cgit v1.2.3