From ba8cd44a0ed2c613a5f2cee06bfc9bd0f61f21c7 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
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             | 81 ++++++++++++++++------
 1 file changed, 58 insertions(+), 23 deletions(-)

(limited to 'lib/general-contracts/detail/general-contract-detail.tsx')

diff --git a/lib/general-contracts/detail/general-contract-detail.tsx b/lib/general-contracts/detail/general-contract-detail.tsx
index 8e7a7aff..f2a916f8 100644
--- a/lib/general-contracts/detail/general-contract-detail.tsx
+++ b/lib/general-contracts/detail/general-contract-detail.tsx
@@ -12,11 +12,11 @@ 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'
+import { ContractStorageInfo } from './general-contract-storage-info'
+import { ContractYardEntryInfo } from './general-contract-yard-entry-info'
+import { ContractReviewComments } from './general-contract-review-comments'
+import { ContractReviewRequestDialog } from './general-contract-review-request-dialog'
 
 export default function ContractDetailPage() {
   const params = useParams()
@@ -26,7 +26,8 @@ export default function ContractDetailPage() {
   const [loading, setLoading] = useState(true)
   const [error, setError] = useState<string | null>(null)
   const [showApprovalDialog, setShowApprovalDialog] = useState(false)
-  const [subcontractChecklistData, setSubcontractChecklistData] = useState<any>(null)
+  const [subcontractChecklistData, setSubcontractChecklistData] = useState<Record<string, unknown> | null>(null)
+  const [showReviewDialog, setShowReviewDialog] = useState(false)
 
   useEffect(() => {
     const fetchContract = async () => {
@@ -110,13 +111,24 @@ export default function ContractDetailPage() {
           </p>
         </div>
         <div className="flex gap-2">
+          {/* 조건검토요청 버튼 - Draft 상태일 때만 표시 */}
+          {contract?.status === 'Draft' && (
+            <Button 
+              onClick={() => setShowReviewDialog(true)}
+              className="bg-green-600 hover:bg-green-700"
+            >
+              조건검토요청
+            </Button>
+          )}
           {/* 계약승인요청 버튼 */}
-          <Button 
-            onClick={() => setShowApprovalDialog(true)}
-            className="bg-blue-600 hover:bg-blue-700"
-          >
-            계약승인요청
-          </Button>
+          <>
+            <Button 
+              onClick={() => setShowApprovalDialog(true)}
+              className="bg-blue-600 hover:bg-blue-700"
+            >
+              계약승인요청
+            </Button>
+            </>
           {/* 계약목록으로 돌아가기 버튼 */}
           <Button asChild variant="outline" size="sm">
             <Link href="/evcp/general-contracts">
@@ -150,7 +162,8 @@ export default function ContractDetailPage() {
             onItemsChange={() => {}}
             onTotalAmountChange={() => {}}
             availableBudget={0}
-            readOnly={contract?.contractScope === '단가' || contract?.contractScope === '물량(실적)'}
+            readOnly={false}
+            contractScope={contract?.contractScope as string || ''}
           />
           {/* 하도급법 자율점검 체크리스트 */}
           <SubcontractChecklist
@@ -158,18 +171,31 @@ export default function ContractDetailPage() {
             onDataChange={(data) => setSubcontractChecklistData(data)}
             readOnly={false}
             initialData={subcontractChecklistData}
+            contractType={contract?.type as string || ''}
+            vendorCountry={(contract as any)?.vendorCountry || 'KR'}
+          />
+          
+          {/* 임치(물품보관)계약 상세 정보 - SG 계약종류일 때만 표시 */}
+          {contract?.type === 'SG' && (
+            <ContractStorageInfo
+              contractId={contract.id as number}
+              readOnly={false}
+            />
+          )}
+          
+          {/* 사외업체 야드투입 정보 - externalYardEntry가 'Y'일 때만 표시 */}
+          {contract?.externalYardEntry === 'Y' && (
+            <ContractYardEntryInfo
+              contractId={contract.id as number}
+              readOnly={false}
+            />
+          )}
+          
+          {/* 계약 조건 검토 의견 섹션 */}
+          <ContractReviewComments
+            contractId={contract.id as number}
+            contractStatus={contract.status as string}
           />
-          {/* Communication Channel */}
-          <CommunicationChannel contractId={Number(contract.id)} />
-
-          {/* Location */}
-          <Location contractId={Number(contract.id)} />
-
-          {/* Field Service Rate */}
-          <FieldServiceRate contractId={Number(contract.id)} />
-
-          {/* Offset Details */}
-          <OffsetDetails contractId={Number(contract.id)} />
         </div>
       )}
 
@@ -181,6 +207,15 @@ export default function ContractDetailPage() {
           onOpenChange={setShowApprovalDialog}
         />
       )}
+
+      {/* 조건검토요청 다이얼로그 */}
+      {contract && (
+        <ContractReviewRequestDialog
+          contract={contract}
+          open={showReviewDialog}
+          onOpenChange={setShowReviewDialog}
+        />
+      )}
     </div>
   )
 }
-- 
cgit v1.2.3

