diff options
Diffstat (limited to 'lib/tech-vendors/table/update-vendor-sheet.tsx')
| -rw-r--r-- | lib/tech-vendors/table/update-vendor-sheet.tsx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/tech-vendors/table/update-vendor-sheet.tsx b/lib/tech-vendors/table/update-vendor-sheet.tsx index 774299f1..1d05b0c4 100644 --- a/lib/tech-vendors/table/update-vendor-sheet.tsx +++ b/lib/tech-vendors/table/update-vendor-sheet.tsx @@ -8,9 +8,6 @@ import { Activity, AlertCircle, AlertTriangle, - ClipboardList, - FilePenLine, - XCircle, Circle as CircleIcon, Building, } from "lucide-react" @@ -83,6 +80,12 @@ const getStatusConfig = (status: StatusType): StatusConfig => { className: "text-slate-800", label: "거래 금지" }; + case "PENDING_REVIEW": + return { + Icon: AlertTriangle, + className: "text-slate-800", + label: "비교 견적" + }; default: return { Icon: CircleIcon, @@ -109,7 +112,7 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps) phone: vendor?.phone ?? "", email: vendor?.email ?? "", website: vendor?.website ?? "", - techVendorType: vendor?.techVendorType ? vendor.techVendorType.split(',').filter(Boolean) : [], + techVendorType: vendor?.techVendorType ? vendor.techVendorType.split(',').map(s => s.trim()).filter(Boolean) as ("조선" | "해양TOP" | "해양HULL")[] : [], status: vendor?.status ?? "ACTIVE", }, }) @@ -124,7 +127,7 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps) phone: vendor?.phone ?? "", email: vendor?.email ?? "", website: vendor?.website ?? "", - techVendorType: vendor?.techVendorType ? vendor.techVendorType.split(',').filter(Boolean) : [], + techVendorType: vendor?.techVendorType ? vendor.techVendorType.split(',').map(s => s.trim()).filter(Boolean) as ("조선" | "해양TOP" | "해양HULL")[] : [], status: vendor?.status ?? "ACTIVE", }); @@ -157,7 +160,7 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps) userId: Number(session.user.id), // Add user ID from session comment: statusComment, // Add comment for status changes ...data, // 모든 데이터 전달 - 서비스 함수에서 필요한 필드만 처리 - techVendorType: data.techVendorType ? data.techVendorType.join(',') : undefined, + techVendorType: Array.isArray(data.techVendorType) ? data.techVendorType.join(',') : undefined, }) if (error) throw new Error(error) @@ -165,7 +168,7 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps) toast.success("업체 정보가 업데이트되었습니다!") form.reset() props.onOpenChange?.(false) - } catch (err: any) { + } catch (err: unknown) { toast.error(String(err)) } }) @@ -312,11 +315,11 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps) id={`update-${type}`} checked={field.value?.includes(type as "조선" | "해양TOP" | "해양HULL")} onChange={(e) => { - const currentValue = field.value || []; + const currentValue = Array.isArray(field.value) ? field.value : []; if (e.target.checked) { field.onChange([...currentValue, type]); } else { - field.onChange(currentValue.filter((v) => v !== type)); + field.onChange(currentValue.filter((v: string) => v !== type)); } }} className="w-4 h-4" |
