From 1197e176493c88e301f9bb02321d815ffc717d10 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Mon, 10 Nov 2025 15:30:13 +0900
Subject: (김준회) ITB: 계약선택시 로직변경(이진용 프로 요청): ITB인 경우
 내자는 계약서 강제선택, 외자는 강제비선택
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/rfq-last/vendor/add-vendor-dialog.tsx | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

(limited to 'lib/rfq-last/vendor/add-vendor-dialog.tsx')

diff --git a/lib/rfq-last/vendor/add-vendor-dialog.tsx b/lib/rfq-last/vendor/add-vendor-dialog.tsx
index 6b4efe74..bcf882a1 100644
--- a/lib/rfq-last/vendor/add-vendor-dialog.tsx
+++ b/lib/rfq-last/vendor/add-vendor-dialog.tsx
@@ -51,6 +51,7 @@ interface AddVendorDialogProps {
   open: boolean;
   onOpenChange: (open: boolean) => void;
   rfqId: number;
+  rfqCategory?: "itb" | "rfq" | "general";
   onSuccess: () => void;
 }
 
@@ -58,6 +59,7 @@ export function AddVendorDialog({
   open,
   onOpenChange,
   rfqId,
+  rfqCategory = "general",
   onSuccess,
 }: AddVendorDialogProps) {
   const [isLoading, setIsLoading] = React.useState(false);
@@ -194,8 +196,17 @@ export function AddVendorDialog({
 
       // 해당 벤더의 기본계약 설정 추가
       const isInternational = isInternationalVendor(vendor);
-      // 외자업체이거나 MRC Type이 "P"가 아닌 경우 false로 설정
-      const shouldCheckAgreement = hasMrcTypeP && !isInternational;
+      
+      let shouldCheckAgreement = false;
+      
+      // ITB인 경우: 국내기업만 체크
+      if (rfqCategory === "itb") {
+        shouldCheckAgreement = !isInternational;
+      } else {
+        // 기존 로직: 외자업체이거나 MRC Type이 "P"가 아닌 경우 false로 설정
+        shouldCheckAgreement = hasMrcTypeP && !isInternational;
+      }
+      
       setVendorContracts([
         ...vendorContracts,
         {
@@ -569,7 +580,11 @@ export function AddVendorDialog({
                                 <div className="flex items-center space-x-2">
                                   <Checkbox
                                     checked={contract?.agreementYn || false}
-                                    disabled={!hasMrcTypeP || isInternational}
+                                    disabled={
+                                      rfqCategory === "itb" 
+                                        ? true  // ITB는 항상 비활성화
+                                        : (!hasMrcTypeP || isInternational)  // 기존 로직
+                                    }
                                     onCheckedChange={(checked) =>
                                       updateVendorContract(vendor.id, "agreementYn", !!checked)
                                     }
@@ -579,7 +594,11 @@ export function AddVendorDialog({
                                 <div className="flex items-center space-x-2">
                                   <Checkbox
                                     checked={contract?.ndaYn || false}
-                                    disabled={!hasMrcTypeP || isInternational}
+                                    disabled={
+                                      rfqCategory === "itb" 
+                                        ? true  // ITB는 항상 비활성화
+                                        : (!hasMrcTypeP || isInternational)  // 기존 로직
+                                    }
                                     onCheckedChange={(checked) =>
                                       updateVendorContract(vendor.id, "ndaYn", !!checked)
                                     }
-- 
cgit v1.2.3

