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/add-vendor-dialog.tsx | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

(limited to 'lib/tech-vendors/table/add-vendor-dialog.tsx')

diff --git a/lib/tech-vendors/table/add-vendor-dialog.tsx b/lib/tech-vendors/table/add-vendor-dialog.tsx
index e89f5d6b..f696b30a 100644
--- a/lib/tech-vendors/table/add-vendor-dialog.tsx
+++ b/lib/tech-vendors/table/add-vendor-dialog.tsx
@@ -30,6 +30,7 @@ import { Textarea } from "@/components/ui/textarea"
 import { Plus, Loader2 } from "lucide-react"
 
 import { addTechVendor } from "../service"
+import { normalizeEmailFields } from "../utils"
 
 // 폼 스키마 정의
 const addVendorSchema = z.object({
@@ -92,6 +93,13 @@ export function AddVendorDialog({ onSuccess }: AddVendorDialogProps) {
   const onSubmit = async (data: AddVendorFormData) => {
     setIsLoading(true)
     try {
+      // 이메일 필드들을 소문자로 변환
+      const normalizedEmails = normalizeEmailFields({
+        email: data.email,
+        agentEmail: data.agentEmail,
+        representativeEmail: data.representativeEmail,
+      })
+
       const result = await addTechVendor({
         ...data,
         vendorCode: data.vendorCode || null,
@@ -100,13 +108,14 @@ export function AddVendorDialog({ onSuccess }: AddVendorDialogProps) {
         countryFab: data.countryFab || null,
         agentName: data.agentName || null,
         agentPhone: data.agentPhone || null,
-        agentEmail: data.agentEmail || null,
+        agentEmail: normalizedEmails.agentEmail,
         address: data.address || null,
         phone: data.phone || null,
         website: data.website || null,
+        email: normalizedEmails.email,
         techVendorType: data.techVendorType.join(','),
         representativeName: data.representativeName || null,
-        representativeEmail: data.representativeEmail || null,
+        representativeEmail: normalizedEmails.representativeEmail,
         representativePhone: data.representativePhone || null,
         representativeBirth: data.representativeBirth || null,
         taxId: data.taxId || "",
-- 
cgit v1.2.3

