From 45f4c426c98d86a251644a4858740bec989edf83 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 20 May 2025 09:01:22 +0000 Subject: (최겸) 기술영업 아이템리스트 수정 및 개발 0520 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/items-tech/table/add-items-dialog.tsx | 125 +++++++++--------------------- 1 file changed, 36 insertions(+), 89 deletions(-) (limited to 'lib/items-tech/table/add-items-dialog.tsx') diff --git a/lib/items-tech/table/add-items-dialog.tsx b/lib/items-tech/table/add-items-dialog.tsx index 86333189..a3af0a8c 100644 --- a/lib/items-tech/table/add-items-dialog.tsx +++ b/lib/items-tech/table/add-items-dialog.tsx @@ -32,7 +32,6 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select" -import { Textarea } from "@/components/ui/textarea" import { toast } from "sonner" import { createShipbuildingItem, createOffshoreTopItem, createOffshoreHullItem } from "../service" @@ -47,14 +46,15 @@ const shipbuildingWorkTypes = [ { label: "철의", value: "철의" }, ] as const -// 선종 유형 정의 -const shipTypes = [ - { label: "A-MAX", value: "A-MAX" }, - { label: "S-MAX", value: "S-MAX" }, - { label: "LNGC", value: "LNGC" }, - { label: "VLCC", value: "VLCC" }, - { label: "CONT", value: "CONT" }, -] as const +// // 선종 유형 정의 +// const shipTypes = [ +// { label: "A-MAX", value: "A-MAX" }, +// { label: "S-MAX", value: "S-MAX" }, +// { label: "LNGC", value: "LNGC" }, +// { label: "VLCC", value: "VLCC" }, +// { label: "CONT", value: "CONT" }, +// { label: "OPTION", value: "OPTION" }, +// ] as const // 해양 TOP 공종 유형 정의 const offshoreTopWorkTypes = [ @@ -79,13 +79,12 @@ const itemFormSchema = z.object({ itemName: z.string().min(1, "아이템 명은 필수입니다"), description: z.string().optional(), workType: z.string().min(1, "공종은 필수입니다"), + // 조선 및 해양 아이템 공통 필드 + itemList: z.string().optional(), // 조선 아이템 전용 필드 shipTypes: z.string().optional(), // 해양 아이템 전용 필드 - itemList1: z.string().optional(), - itemList2: z.string().optional(), - itemList3: z.string().optional(), - itemList4: z.string().optional(), + subItemList: z.string().optional(), }) type ItemFormValues = z.infer @@ -102,18 +101,17 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { const getDefaultValues = () => { const defaults: ItemFormValues = { itemCode: "", - itemName: "", + itemName: "기술영업", description: "", workType: getDefaultWorkType(), } if (itemType === 'shipbuilding') { - defaults.shipTypes = "A-MAX" + defaults.shipTypes = "OPTION" + defaults.itemList = "" } else { - defaults.itemList1 = "" - defaults.itemList2 = "" - defaults.itemList3 = "" - defaults.itemList4 = "" + defaults.itemList = "" + defaults.subItemList = "" } return defaults @@ -151,7 +149,8 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { itemName: data.itemName, workType: data.workType, shipTypes: data.shipTypes, - description: data.description || null + description: data.description || null, + itemList: data.itemList || null }); break; @@ -161,10 +160,8 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { itemName: data.itemName, workType: data.workType as "TM" | "TS" | "TE" | "TP", description: data.description || null, - itemList1: data.itemList1 || null, - itemList2: data.itemList2 || null, - itemList3: data.itemList3 || null, - itemList4: data.itemList4 || null + itemList: data.itemList || null, + subItemList: data.subItemList || null }); break; @@ -174,10 +171,8 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { itemName: data.itemName, workType: data.workType as "HA" | "HE" | "HH" | "HM" | "NC", description: data.description || null, - itemList1: data.itemList1 || null, - itemList2: data.itemList2 || null, - itemList3: data.itemList3 || null, - itemList4: data.itemList4 || null + itemList: data.itemList || null, + subItemList: data.subItemList || null }); break; @@ -254,19 +249,6 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { )} /> - ( - - 아이템 명 - - - - - - )} - /> {itemType === 'shipbuilding' && ( - ( - - 선종 - - - - )} - /> - )} - {(itemType === 'offshoreTop' || itemType === 'offshoreHull') && ( <> ( - 아이템 리스트 1 + 선종 - + @@ -334,10 +290,10 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { /> ( - 아이템 리스트 2 + 아이템 리스트 @@ -345,12 +301,16 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { )} /> + + )} + {(itemType === 'offshoreTop' || itemType === 'offshoreHull') && ( + <> ( - 아이템 리스트 3 + 아이템 리스트 @@ -360,10 +320,10 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { /> ( - 아이템 리스트 4 + 서브 아이템 리스트 @@ -373,19 +333,6 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { /> )} - ( - - 설명 - -