'use client' import { useState, useEffect } from 'react' import { useParams } from 'next/navigation' import Link from 'next/link' import { getContractById } from '../service' import { GeneralContractInfoHeader } from './general-contract-info-header' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { AlertCircle, ArrowLeft } from 'lucide-react' import { Skeleton } from '@/components/ui/skeleton' import { ContractItemsTable } from './general-contract-items-table' import { SubcontractChecklist } from './subcontract-checklist' import { ContractBasicInfo } from './general-contract-basic-info' import { CommunicationChannel } from './general-contract-communication-channel' import { Location } from './general-contract-location' import { FieldServiceRate } from './general-contract-field-service-rate' import { OffsetDetails } from './general-contract-offset-details' export default function ContractDetailPage() { const params = useParams() const contractId = params?.id ? parseInt(params.id as string) : null const [contract, setContract] = useState | null>(null) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) useEffect(() => { const fetchContract = async () => { try { setLoading(true) setError(null) const contractData = await getContractById(contractId!) setContract(contractData) } catch (err) { console.error('Error fetching contract:', err) setError('계약 정보를 불러오는 중 오류가 발생했습니다.') } finally { setLoading(false) } } if (contractId && !isNaN(contractId)) { fetchContract() } else { setError('유효하지 않은 계약 ID입니다.') setLoading(false) } }, [contractId]) if (loading) { return (
) } if (error) { return (
{error}
) } return (

계약 상세

계약번호: {contract?.contractNumber as string} (Rev.{contract?.revision as number})

{/* 계약목록으로 돌아가기 버튼 */}
{/* 계약 정보 헤더 */} {contract && } {/* 계약 상세 폼 */} {contract && (
{/* ContractBasicInfo */} {/* 품목정보 */} {/* {!(contract?.contractScope === '단가' || contract?.contractScope === '물량(실적)') && (

품목정보 입력 안내:
단가/물량 확정 계약의 경우 수량 및 총 계약금액은 별도로 관리됩니다.

)} */} {}} onTotalAmountChange={() => {}} currency="USD" availableBudget={0} readOnly={contract?.contractScope === '단가' || contract?.contractScope === '물량(실적)'} /> {/* 하도급법 자율점검 체크리스트 */} {}} readOnly={false} initialData={undefined} /> {/* Communication Channel */} {/* Location */} {/* Field Service Rate */} {/* Offset Details */}
)}
) }