blob: ea8cdbd33fa61eda5d027588fb734b3884ab7074 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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;
}
}
/**
* 이메일을 소문자로 변환합니다.
* 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),
};
}
|