From c8cccaf1198ae48754ac036b579732018f5b448a Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Thu, 23 Oct 2025 03:30:01 +0000
Subject: (최겸) 기술영업 조선 rfq 수정(벤더, 담당자 임시삭제기능 추가)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/detail-table/add-vendor-dialog.tsx       | 213 ++++++++++++---------
 1 file changed, 121 insertions(+), 92 deletions(-)

(limited to 'lib/techsales-rfq/table/detail-table/add-vendor-dialog.tsx')

diff --git a/lib/techsales-rfq/table/detail-table/add-vendor-dialog.tsx b/lib/techsales-rfq/table/detail-table/add-vendor-dialog.tsx
index ea982407..438ee840 100644
--- a/lib/techsales-rfq/table/detail-table/add-vendor-dialog.tsx
+++ b/lib/techsales-rfq/table/detail-table/add-vendor-dialog.tsx
@@ -362,99 +362,128 @@ export function AddVendorDialog({
   )
 
   // 벤더 구분자 설정 UI
-  const renderVendorFlagsStep = () => (
-    <div className="space-y-4">
-      <div className="text-sm text-muted-foreground">
-        선택된 벤더들의 구분자를 설정해주세요. 각 벤더별로 여러 구분자를 선택할 수 있습니다.
-      </div>
-      
-      {selectedVendorData.length > 0 ? (
-        <div className="space-y-4">
-          {selectedVendorData.map((vendor) => (
-            <Card key={vendor.id}>
-              <CardHeader className="pb-3">
-                <CardTitle className="text-base">{vendor.vendorName}</CardTitle>
-                <CardDescription>
-                  {vendor.vendorCode || 'N/A'} {vendor.country && `• ${vendor.country}`}
-                </CardDescription>
-              </CardHeader>
-              <CardContent className="space-y-3">
-                <div className="grid grid-cols-2 gap-3">
-                  <div className="flex items-center space-x-2">
-                                         <Checkbox
-                       id={`customer-preferred-${vendor.id}`}
-                       checked={vendorFlags[vendor.id.toString()]?.isCustomerPreferred || false}
-                       onCheckedChange={(checked) => 
-                         handleVendorFlagChange(vendor.id, 'isCustomerPreferred', checked as boolean)
-                       }
-                     />
-                    <label 
-                      htmlFor={`customer-preferred-${vendor.id}`}
-                      className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
-                    >
-                      고객(선주) 선호 벤더
-                    </label>
-                  </div>
-                  
-                                     <div className="flex items-center space-x-2">
-                     <Checkbox
-                       id={`new-discovery-${vendor.id}`}
-                       checked={vendorFlags[vendor.id.toString()]?.isNewDiscovery || false}
-                       onCheckedChange={(checked) => 
-                         handleVendorFlagChange(vendor.id, 'isNewDiscovery', checked as boolean)
-                       }
-                     />
-                    <label 
-                      htmlFor={`new-discovery-${vendor.id}`}
-                      className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
-                    >
-                      신규 발굴 벤더
-                    </label>
-                  </div>
-                  
-                                     <div className="flex items-center space-x-2">
-                     <Checkbox
-                       id={`project-approved-${vendor.id}`}
-                       checked={vendorFlags[vendor.id.toString()]?.isProjectApproved || false}
-                       onCheckedChange={(checked) => 
-                         handleVendorFlagChange(vendor.id, 'isProjectApproved', checked as boolean)
-                       }
-                     />
-                    <label 
-                      htmlFor={`project-approved-${vendor.id}`}
-                      className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
-                    >
-                      Project Approved Vendor
-                    </label>
-                  </div>
-                  
-                                     <div className="flex items-center space-x-2">
-                     <Checkbox
-                       id={`shi-proposal-${vendor.id}`}
-                       checked={vendorFlags[vendor.id.toString()]?.isShiProposal || false}
-                       onCheckedChange={(checked) => 
-                         handleVendorFlagChange(vendor.id, 'isShiProposal', checked as boolean)
-                       }
-                     />
-                    <label 
-                      htmlFor={`shi-proposal-${vendor.id}`}
-                      className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
-                    >
-                      SHI Proposal Vendor
-                    </label>
-                  </div>
-                </div>
-              </CardContent>
-            </Card>
-          ))}
-        </div>
-      ) : (
-        <div className="text-center py-8 text-muted-foreground border rounded-md">
-          선택된 벤더가 없습니다
+  const renderVendorFlagsStep = () => {
+    const isShipRfq = selectedRfq?.rfqType === 'SHIP'
+
+    return (
+      <div className="space-y-4">
+        <div className="text-sm text-muted-foreground">
+          선택된 벤더들의 구분자를 설정해주세요. 각 벤더별로 여러 구분자를 선택할 수 있습니다.
         </div>
-      )}
-    </div>
-  )
+
+        {selectedVendorData.length > 0 ? (
+          <div className="space-y-4">
+            {selectedVendorData.map((vendor) => (
+              <Card key={vendor.id}>
+                <CardHeader className="pb-3">
+                  <CardTitle className="text-base">{vendor.vendorName}</CardTitle>
+                  <CardDescription>
+                    {vendor.vendorCode || 'N/A'} {vendor.country && `• ${vendor.country}`}
+                  </CardDescription>
+                </CardHeader>
+                <CardContent className="space-y-3">
+                  <div className="grid grid-cols-2 gap-3">
+                    {/* 조선 RFQ인 경우: 고객 선호벤더, 신규발굴벤더, SHI Proposal Vendor 표시 */}
+                    {isShipRfq && (
+                      <>
+                        <div className="flex items-center space-x-2">
+                          <Checkbox
+                            id={`customer-preferred-${vendor.id}`}
+                            checked={vendorFlags[vendor.id.toString()]?.isCustomerPreferred || false}
+                            onCheckedChange={(checked) =>
+                              handleVendorFlagChange(vendor.id, 'isCustomerPreferred', checked as boolean)
+                            }
+                          />
+                          <label
+                            htmlFor={`customer-preferred-${vendor.id}`}
+                            className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+                          >
+                            고객(선주) 선호 벤더
+                          </label>
+                        </div>
+
+                        <div className="flex items-center space-x-2">
+                          <Checkbox
+                            id={`new-discovery-${vendor.id}`}
+                            checked={vendorFlags[vendor.id.toString()]?.isNewDiscovery || false}
+                            onCheckedChange={(checked) =>
+                              handleVendorFlagChange(vendor.id, 'isNewDiscovery', checked as boolean)
+                            }
+                          />
+                          <label
+                            htmlFor={`new-discovery-${vendor.id}`}
+                            className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+                          >
+                            신규 발굴 벤더
+                          </label>
+                        </div>
+                        <div className="flex items-center space-x-2">
+                          <Checkbox
+                            id={`shi-proposal-${vendor.id}`}
+                            checked={vendorFlags[vendor.id.toString()]?.isShiProposal || false}
+                            onCheckedChange={(checked) =>
+                              handleVendorFlagChange(vendor.id, 'isShiProposal', checked as boolean)
+                            }
+                          />
+                          <label
+                            htmlFor={`shi-proposal-${vendor.id}`}
+                            className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+                          >
+                            SHI Proposal Vendor
+                          </label>
+                        </div>
+                      </>
+                    )}
+
+                    {/* 조선 RFQ가 아닌 경우: Project Approved Vendor, SHI Proposal Vendor 표시 */}
+                    {!isShipRfq && (
+                      <>
+                        <div className="flex items-center space-x-2">
+                          <Checkbox
+                            id={`project-approved-${vendor.id}`}
+                            checked={vendorFlags[vendor.id.toString()]?.isProjectApproved || false}
+                            onCheckedChange={(checked) =>
+                              handleVendorFlagChange(vendor.id, 'isProjectApproved', checked as boolean)
+                            }
+                          />
+                          <label
+                            htmlFor={`project-approved-${vendor.id}`}
+                            className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+                          >
+                            Project Approved Vendor
+                          </label>
+                        </div>
+
+                        <div className="flex items-center space-x-2">
+                          <Checkbox
+                            id={`shi-proposal-${vendor.id}`}
+                            checked={vendorFlags[vendor.id.toString()]?.isShiProposal || false}
+                            onCheckedChange={(checked) =>
+                              handleVendorFlagChange(vendor.id, 'isShiProposal', checked as boolean)
+                            }
+                          />
+                          <label
+                            htmlFor={`shi-proposal-${vendor.id}`}
+                            className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+                          >
+                            SHI Proposal Vendor
+                          </label>
+                        </div>
+                      </>
+                    )}
+                  </div>
+                </CardContent>
+              </Card>
+            ))}
+          </div>
+        ) : (
+          <div className="text-center py-8 text-muted-foreground border rounded-md">
+            선택된 벤더가 없습니다
+          </div>
+        )}
+      </div>
+    )
+  }
 
   return (
     <Dialog open={open} onOpenChange={onOpenChange}>
-- 
cgit v1.2.3

