"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" import { InformationButton } from "@/components/information/information-button" 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 ) // projectType 상태 추가 const [projectType, setProjectType] = React.useState("plant") // Update selectedContractId when URL changes React.useEffect(() => { if (contractIdFromUrl) { setSelectedContractId(contractIdFromUrl) } }, [contractIdFromUrl]) // Handle contract selection function handleSelectContract(projectId: number, contractId: number) { const foundProjectType = projects.find(v => v.projectId === projectId)?.projectType || "ship" setSelectedContractId(contractId) setProjectType("plant") // Navigate to the contract's documents page router.push(`/partners/document-list-only/${contractId}?projectType=plant`) } return ( <> {/* 상단 영역: 제목 왼쪽 / ProjectSwitcher 오른쪽 */}
{/* 왼쪽: 타이틀 & 설명 */}

협력업체 문서 리스트 관리

{/*

{projectType === "ship" ? "삼성중공업 문서시스템으로부터 목록을 가져오고 문서 파일을 등록하여 삼성중공업으로 전달할 수 있습니다." : "문서리스트와 이슈스테이지를 생성하고 관리할 수 있으며 문서 파일을 등록하여 삼성중공업으로 전달할 수 있습니다." }

*/}
{/* 오른쪽: ProjectSwitcher */}
{/* 문서 목록/테이블 영역 */}
{children}
) }