diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-10-23 03:30:01 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-10-23 03:30:01 +0000 |
| commit | c8cccaf1198ae48754ac036b579732018f5b448a (patch) | |
| tree | 9c64024818c2be1c7b6699b4e141729432719d86 /lib/tech-vendors/utils.ts | |
| parent | 835010104c25c370c1def1f2de52f518058f8b46 (diff) | |
(최겸) 기술영업 조선 rfq 수정(벤더, 담당자 임시삭제기능 추가)
Diffstat (limited to 'lib/tech-vendors/utils.ts')
| -rw-r--r-- | lib/tech-vendors/utils.ts | 84 |
1 files changed, 56 insertions, 28 deletions
diff --git a/lib/tech-vendors/utils.ts b/lib/tech-vendors/utils.ts index ac91cd8d..ea8cdbd3 100644 --- a/lib/tech-vendors/utils.ts +++ b/lib/tech-vendors/utils.ts @@ -1,28 +1,56 @@ -import { LucideIcon, CheckCircle2, CircleAlert, Clock, ShieldAlert, Mail, BarChart2 } from "lucide-react";
-import type { TechVendor } from "@/db/schema/techVendors";
-
-type StatusType = TechVendor["status"];
-
-/**
- * 기술벤더 상태에 대한 아이콘을 반환합니다.
- */
-export function getVendorStatusIcon(status: StatusType): LucideIcon {
- switch (status) {
- case "PENDING_INVITE":
- return Clock;
- case "INVITED":
- return Mail;
- case "QUOTE_COMPARISON":
- return BarChart2;
- case "ACTIVE":
- return CheckCircle2;
- case "INACTIVE":
- return CircleAlert;
- case "BLACKLISTED":
- return ShieldAlert;
- default:
- return CircleAlert;
- }
-}
-
-
+import { LucideIcon, CheckCircle2, CircleAlert, Clock, ShieldAlert, Mail, BarChart2 } from "lucide-react"; +import type { TechVendor } from "@/db/schema/techVendors"; + +type StatusType = TechVendor["status"]; + +/** + * 기술벤더 상태에 대한 아이콘을 반환합니다. + */ +export function getVendorStatusIcon(status: StatusType): LucideIcon { + switch (status) { + case "PENDING_INVITE": + return Clock; + case "INVITED": + return Mail; + case "QUOTE_COMPARISON": + return BarChart2; + case "ACTIVE": + return CheckCircle2; + case "INACTIVE": + return CircleAlert; + case "BLACKLISTED": + return ShieldAlert; + default: + return CircleAlert; + } +} + +/** + * 이메일을 소문자로 변환합니다. + * null, undefined, 또는 빈 문자열인 경우 null을 반환합니다. + */ +export function normalizeEmail(email: string | null | undefined): string | null { + if (!email || typeof email !== 'string' || email.trim() === '') { + return null; + } + return email.toLowerCase().trim(); +} + +/** + * 여러 이메일 필드들을 소문자로 변환합니다. + */ +export function normalizeEmailFields(data: { + email?: string | null; + agentEmail?: string | null; + representativeEmail?: string | null; + contactEmail?: string | null; +}) { + return { + email: normalizeEmail(data.email), + agentEmail: normalizeEmail(data.agentEmail), + representativeEmail: normalizeEmail(data.representativeEmail), + contactEmail: normalizeEmail(data.contactEmail), + }; +} + + |
