summaryrefslogtreecommitdiff
path: root/lib/tech-vendors/table/update-vendor-sheet.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tech-vendors/table/update-vendor-sheet.tsx')
-rw-r--r--lib/tech-vendors/table/update-vendor-sheet.tsx58
1 files changed, 39 insertions, 19 deletions
diff --git a/lib/tech-vendors/table/update-vendor-sheet.tsx b/lib/tech-vendors/table/update-vendor-sheet.tsx
index cc6b4003..774299f1 100644
--- a/lib/tech-vendors/table/update-vendor-sheet.tsx
+++ b/lib/tech-vendors/table/update-vendor-sheet.tsx
@@ -65,24 +65,6 @@ type StatusConfig = {
// 상태 표시 유틸리티 함수
const getStatusConfig = (status: StatusType): StatusConfig => {
switch(status) {
- case "PENDING_REVIEW":
- return {
- Icon: ClipboardList,
- className: "text-yellow-600",
- label: "가입 신청 중"
- };
- case "IN_REVIEW":
- return {
- Icon: FilePenLine,
- className: "text-blue-600",
- label: "심사 중"
- };
- case "REJECTED":
- return {
- Icon: XCircle,
- className: "text-red-600",
- label: "심사 거부됨"
- };
case "ACTIVE":
return {
Icon: Activity,
@@ -127,6 +109,7 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps)
phone: vendor?.phone ?? "",
email: vendor?.email ?? "",
website: vendor?.website ?? "",
+ techVendorType: vendor?.techVendorType ? vendor.techVendorType.split(',').filter(Boolean) : [],
status: vendor?.status ?? "ACTIVE",
},
})
@@ -141,6 +124,7 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps)
phone: vendor?.phone ?? "",
email: vendor?.email ?? "",
website: vendor?.website ?? "",
+ techVendorType: vendor?.techVendorType ? vendor.techVendorType.split(',').filter(Boolean) : [],
status: vendor?.status ?? "ACTIVE",
});
@@ -172,7 +156,8 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps)
id: String(vendor.id),
userId: Number(session.user.id), // Add user ID from session
comment: statusComment, // Add comment for status changes
- ...data // 모든 데이터 전달 - 서비스 함수에서 필요한 필드만 처리
+ ...data, // 모든 데이터 전달 - 서비스 함수에서 필요한 필드만 처리
+ techVendorType: data.techVendorType ? data.techVendorType.join(',') : undefined,
})
if (error) throw new Error(error)
@@ -312,6 +297,41 @@ export function UpdateVendorSheet({ vendor, ...props }: UpdateVendorSheetProps)
)}
/>
+ {/* techVendorType */}
+ <FormField
+ control={form.control}
+ name="techVendorType"
+ render={({ field }) => (
+ <FormItem className="md:col-span-2">
+ <FormLabel>벤더 타입 *</FormLabel>
+ <div className="space-y-2">
+ {["조선", "해양TOP", "해양HULL"].map((type) => (
+ <div key={type} className="flex items-center space-x-2">
+ <input
+ type="checkbox"
+ id={`update-${type}`}
+ checked={field.value?.includes(type as "조선" | "해양TOP" | "해양HULL")}
+ onChange={(e) => {
+ const currentValue = field.value || [];
+ if (e.target.checked) {
+ field.onChange([...currentValue, type]);
+ } else {
+ field.onChange(currentValue.filter((v) => v !== type));
+ }
+ }}
+ className="w-4 h-4"
+ />
+ <label htmlFor={`update-${type}`} className="text-sm font-medium cursor-pointer">
+ {type}
+ </label>
+ </div>
+ ))}
+ </div>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
{/* status with icons */}
<FormField
control={form.control}