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

---
 .../general-contract-subcontract-checklist.tsx     | 47 +++++++++++++++++++---
 1 file changed, 41 insertions(+), 6 deletions(-)

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

diff --git a/lib/general-contracts/detail/general-contract-subcontract-checklist.tsx b/lib/general-contracts/detail/general-contract-subcontract-checklist.tsx
index ce7c8baf..86c4485b 100644
--- a/lib/general-contracts/detail/general-contract-subcontract-checklist.tsx
+++ b/lib/general-contracts/detail/general-contract-subcontract-checklist.tsx
@@ -50,9 +50,21 @@ interface SubcontractChecklistProps {
   onDataChange: (data: SubcontractChecklistData) => void
   readOnly?: boolean
   initialData?: SubcontractChecklistData
+  contractType?: string // 계약종류 (AD, AW, SG 등)
+  vendorCountry?: string // 협력업체 국가 (해외업체 여부 판단)
 }
 
-export function SubcontractChecklist({ contractId, onDataChange, readOnly = false, initialData }: SubcontractChecklistProps) {
+export function SubcontractChecklist({ 
+  contractId, 
+  onDataChange, 
+  readOnly = false, 
+  initialData,
+  contractType = '',
+  vendorCountry = ''
+}: SubcontractChecklistProps) {
+  // AD, AW, SG 계약 또는 해외업체인 경우 체크리스트 비활성화
+  const isChecklistDisabled = contractType === 'AD' || contractType === 'AW' || contractType === 'SG' || vendorCountry !== 'KR'
+  
   // 기본 데이터 구조
   const defaultData: SubcontractChecklistData = {
     contractDocumentIssuance: {
@@ -96,9 +108,16 @@ export function SubcontractChecklist({ contractId, onDataChange, readOnly = fals
     }
   }, [initialData])
 
-  const [isEnabled, setIsEnabled] = useState(true)
+  const [isEnabled, setIsEnabled] = useState(!isChecklistDisabled)
   const [data, setData] = useState<SubcontractChecklistData>(mergedInitialData)
 
+  // 체크리스트가 비활성화된 경우 경고 메시지 표시
+  React.useEffect(() => {
+    if (isChecklistDisabled) {
+      setIsEnabled(false)
+    }
+  }, [isChecklistDisabled])
+
   // 점검결과 자동 계산 함수
   const calculateInspectionResult = (
     contractDocumentIssuance: SubcontractChecklistData['contractDocumentIssuance'],
@@ -249,20 +268,36 @@ export function SubcontractChecklist({ contractId, onDataChange, readOnly = fals
           <div className="flex items-center gap-3 w-full">
             <HelpCircle className="h-5 w-5" />
             <span className="font-medium">하도급법 자율점검 체크리스트</span>
-            <Badge className={resultInfo.color}>
-              {resultInfo.label}
-            </Badge>
+            {isChecklistDisabled ? (
+              <Badge className="bg-gray-100 text-gray-800">비활성화</Badge>
+            ) : (
+              <Badge className={resultInfo.color}>
+                {resultInfo.label}
+              </Badge>
+            )}
           </div>
         </AccordionTrigger>
         <AccordionContent>
           <Card>
             <CardContent className="space-y-6 pt-6">
+        {/* 체크리스트 비활성화 안내 */}
+        {isChecklistDisabled && (
+          <Alert>
+            <AlertTriangle className="h-4 w-4" />
+            <AlertDescription>
+              {contractType === 'AD' || contractType === 'AW' || contractType === 'SG' 
+                ? `본 계약은 ${contractType === 'AD' ? '사전납품합의' : contractType === 'AW' ? '사전작업합의' : '임치(물품보관)계약'} 계약으로 하도급법 체크리스트가 적용되지 않습니다.`
+                : '해외업체 계약으로 하도급법 체크리스트가 적용되지 않습니다.'}
+            </AlertDescription>
+          </Alert>
+        )}
+        
         {/* 체크박스 */}
         <div className="flex items-center gap-2">
           <Checkbox 
             checked={isEnabled}
             onCheckedChange={(checked) => setIsEnabled(checked as boolean)}
-            disabled={readOnly}
+            disabled={readOnly || isChecklistDisabled}
           />
           <span className="text-sm font-medium">하도급법 자율점검 체크리스트 활성화</span>
         </div>
-- 
cgit v1.2.3

