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

---
 lib/tech-vendors/table/import-button.tsx | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

(limited to 'lib/tech-vendors/table/import-button.tsx')

diff --git a/lib/tech-vendors/table/import-button.tsx b/lib/tech-vendors/table/import-button.tsx
index 85b16bc7..e0f95195 100644
--- a/lib/tech-vendors/table/import-button.tsx
+++ b/lib/tech-vendors/table/import-button.tsx
@@ -17,6 +17,7 @@ import {
 import { Progress } from "@/components/ui/progress"
 import { importTechVendorsFromExcel } from "../service"
 import { decryptWithServerAction } from "@/components/drm/drmUtils"
+import { normalizeEmail } from "../utils"
 
 interface ImportTechVendorButtonProps {
   onSuccess?: () => void;
@@ -192,13 +193,17 @@ export function ImportTechVendorButton({ onSuccess }: ImportTechVendorButtonProp
       
       // 벤더 데이터 처리
       const vendors = dataRows.map(row => {
-        const vendorEmail = row["이메일"] || row["email"] || "";
+        // 이메일들을 소문자로 변환
+        const vendorEmail = normalizeEmail(row["이메일"] || row["email"]) || null;
+        const contactEmail = normalizeEmail(row["담당자이메일"] || row["contactEmail"]);
+        const agentEmail = normalizeEmail(row["에이전트이메일"] || row["agentEmail"]);
+        const representativeEmail = normalizeEmail(row["대표자이메일"] || row["representativeEmail"]);
+
         const contactName = row["담당자명"] || row["contactName"] || "";
-        const contactEmail = row["담당자이메일"] || row["contactEmail"] || "";
-        
+
         // 담당자 정보 처리: 담당자가 없으면 벤더 이메일을 기본 담당자로 사용
         const contacts = [];
-        
+
         if (contactName && contactEmail) {
           // 명시적인 담당자가 있는 경우
           contacts.push({
@@ -221,7 +226,7 @@ export function ImportTechVendorButton({ onSuccess }: ImportTechVendorButtonProp
             isPrimary: true
           });
         }
-        
+
         return {
           vendorName: row["업체명"] || row["vendorName"] || "",
           vendorCode: row["업체코드"] || row["vendorCode"] || null,
@@ -232,13 +237,13 @@ export function ImportTechVendorButton({ onSuccess }: ImportTechVendorButtonProp
           countryFab: row["제조국"] || row["countryFab"] || null,
           agentName: row["에이전트명"] || row["agentName"] || null,
           agentPhone: row["에이전트연락처"] || row["agentPhone"] || null,
-          agentEmail: row["에이전트이메일"] || row["agentEmail"] || null,
+          agentEmail: agentEmail,
           address: row["주소"] || row["address"] || null,
           phone: row["전화번호"] || row["phone"] || null,
           website: row["웹사이트"] || row["website"] || null,
           techVendorType: row["벤더타입"] || row["techVendorType"] || "",
           representativeName: row["대표자명"] || row["representativeName"] || null,
-          representativeEmail: row["대표자이메일"] || row["representativeEmail"] || null,
+          representativeEmail: representativeEmail,
           representativePhone: row["대표자연락처"] || row["representativePhone"] || null,
           representativeBirth: row["대표자생년월일"] || row["representativeBirth"] || null,
           items: row["아이템"] || row["items"] || "",
-- 
cgit v1.2.3

