diff options
Diffstat (limited to 'lib/items-tech/table/update-items-sheet.tsx')
| -rw-r--r-- | lib/items-tech/table/update-items-sheet.tsx | 58 |
1 files changed, 9 insertions, 49 deletions
diff --git a/lib/items-tech/table/update-items-sheet.tsx b/lib/items-tech/table/update-items-sheet.tsx index efab4b1a..16dfcb71 100644 --- a/lib/items-tech/table/update-items-sheet.tsx +++ b/lib/items-tech/table/update-items-sheet.tsx @@ -61,29 +61,26 @@ const offshoreHullWorkTypes = [ { value: "NC", label: "NC" },
] as const
-interface CommonItemFields {
+
+type ShipbuildingItem = {
id: number
- itemId: number
itemCode: string
- itemName: string
- description: string | null
- createdAt: Date
- updatedAt: Date
-}
-
-type ShipbuildingItem = CommonItemFields & {
workType: "기장" | "전장" | "선실" | "배관" | "철의"
shipTypes: string
itemList: string | null
}
-type OffshoreTopItem = CommonItemFields & {
+type OffshoreTopItem = {
+ id: number
+ itemCode: string
workType: "TM" | "TS" | "TE" | "TP"
itemList: string | null
subItemList: string | null
}
-type OffshoreHullItem = CommonItemFields & {
+type OffshoreHullItem = {
+ id: number
+ itemCode: string
workType: "HA" | "HE" | "HH" | "HM" | "NC"
itemList: string | null
subItemList: string | null
@@ -91,12 +88,9 @@ type OffshoreHullItem = CommonItemFields & { type UpdateItemSchema = {
itemCode?: string
- itemName?: string
- description?: string
workType?: string
shipTypes?: string
itemList?: string
- subItemList?: string
}
interface UpdateItemSheetProps {
@@ -112,8 +106,6 @@ export function UpdateItemSheet({ item, itemType, open, onOpenChange }: UpdateIt // 초기값 설정
const form = useForm<UpdateItemSchema>({
defaultValues: {
- itemName: item.itemName,
- description: item.description || "",
workType: item.workType,
...getItemTypeSpecificDefaults(item, itemType),
},
@@ -127,7 +119,7 @@ export function UpdateItemSheet({ item, itemType, open, onOpenChange }: UpdateIt case 'shipbuilding':
return {
shipTypes: (item as ShipbuildingItem).shipTypes,
- itemList: (item as ShipbuildingItem).itemList || ""
+ itemList: (item as ShipbuildingItem).itemList || "",
};
case 'offshoreTop':
case 'offshoreHull':
@@ -279,25 +271,8 @@ export function UpdateItemSheet({ item, itemType, open, onOpenChange }: UpdateIt </FormItem>
)}
/>
- <FormField
- control={form.control}
- name="itemList"
- render={({ field }) => (
- <FormItem>
- <FormLabel>아이템 리스트</FormLabel>
- <FormControl>
- <Input placeholder="아이템 리스트를 입력하세요" {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
</>
)}
-
- {/* 해양 TOP 또는 HULL 아이템 전용 필드 */}
- {(itemType === 'offshoreTop' || itemType === 'offshoreHull') && (
- <>
<FormField
control={form.control}
name="itemList"
@@ -311,21 +286,6 @@ export function UpdateItemSheet({ item, itemType, open, onOpenChange }: UpdateIt </FormItem>
)}
/>
- <FormField
- control={form.control}
- name="subItemList"
- render={({ field }) => (
- <FormItem>
- <FormLabel>서브 아이템 리스트</FormLabel>
- <FormControl>
- <Input placeholder="서브 아이템 리스트를 입력하세요" {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </>
- )}
<SheetFooter>
<SheetClose asChild>
<Button variant="outline">취소</Button>
|
