From ba8cd44a0ed2c613a5f2cee06bfc9bd0f61f21c7 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 7 Nov 2025 08:39:04 +0000 Subject: (최겸) 입찰/견적 수정사항 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/general-contract-detail.tsx | 186 +++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 lib/general-contracts_old/detail/general-contract-detail.tsx (limited to 'lib/general-contracts_old/detail/general-contract-detail.tsx') diff --git a/lib/general-contracts_old/detail/general-contract-detail.tsx b/lib/general-contracts_old/detail/general-contract-detail.tsx new file mode 100644 index 00000000..8e7a7aff --- /dev/null +++ b/lib/general-contracts_old/detail/general-contract-detail.tsx @@ -0,0 +1,186 @@ +'use client' + +import { useState, useEffect } from 'react' +import { useParams } from 'next/navigation' +import Link from 'next/link' +import { getContractById, getSubcontractChecklist } 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 './general-contract-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' +import { ContractApprovalRequestDialog } from './general-contract-approval-request-dialog' + +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) + const [showApprovalDialog, setShowApprovalDialog] = useState(false) + const [subcontractChecklistData, setSubcontractChecklistData] = useState(null) + + useEffect(() => { + const fetchContract = async () => { + try { + setLoading(true) + setError(null) + + // 계약 기본 정보 로드 + const contractData = await getContractById(contractId!) + setContract(contractData) + + // 하도급법 체크리스트 데이터 로드 + try { + const checklistData = await getSubcontractChecklist(contractId!) + if (checklistData.success && checklistData.data) { + setSubcontractChecklistData(checklistData.data) + } + } catch (checklistError) { + console.log('하도급법 체크리스트 데이터 로드 실패:', checklistError) + // 체크리스트 로드 실패는 전체 로드를 실패시키지 않음 + } + + } 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={() => {}} + availableBudget={0} + readOnly={contract?.contractScope === '단가' || contract?.contractScope === '물량(실적)'} + /> + {/* 하도급법 자율점검 체크리스트 */} + setSubcontractChecklistData(data)} + readOnly={false} + initialData={subcontractChecklistData} + /> + {/* Communication Channel */} + + + {/* Location */} + + + {/* Field Service Rate */} + + + {/* Offset Details */} + +
+ )} + + {/* 계약승인요청 다이얼로그 */} + {contract && ( + + )} +
+ ) +} -- cgit v1.2.3