From d0d2eaa2de58a0c33e9a21604b126961403cd69e Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 14 May 2025 06:12:13 +0000 Subject: (최겸) 기술영업 조선, 해양Top, 해양 Hull 아이템 리스트 개발(CRUD, excel import/export/template) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/items-ship/table/update-items-sheet.tsx | 202 ---------------------------- 1 file changed, 202 deletions(-) delete mode 100644 lib/items-ship/table/update-items-sheet.tsx (limited to 'lib/items-ship/table/update-items-sheet.tsx') diff --git a/lib/items-ship/table/update-items-sheet.tsx b/lib/items-ship/table/update-items-sheet.tsx deleted file mode 100644 index e021e145..00000000 --- a/lib/items-ship/table/update-items-sheet.tsx +++ /dev/null @@ -1,202 +0,0 @@ -"use client" - -import * as React from "react" -import { zodResolver } from "@hookform/resolvers/zod" -import { useForm } from "react-hook-form" - -import { Button } from "@/components/ui/button" -import { - Sheet, - SheetClose, - SheetContent, - SheetDescription, - SheetFooter, - SheetHeader, - SheetTitle, -} from "@/components/ui/sheet" -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select" -import { Textarea } from "@/components/ui/textarea" -import { toast } from "sonner" - -import { modifyShipbuildingItem } from "../service" -import { updateShipbuildingItemSchema, type UpdateShipbuildingItemSchema } from "../validations" - -const workTypes = [ - { value: "기장", label: "기장" }, - { value: "전장", label: "전장" }, - { value: "선실", label: "선실" }, - { value: "배관", label: "배관" }, - { value: "철의", label: "철의" }, -] as const - -interface UpdateItemSheetProps { - item: { - id: number; - itemId: number; - workType: "기장" | "전장" | "선실" | "배관" | "철의"; - shipTypes: string; - itemCode: string; - itemName: string; - description: string | null; - createdAt: Date; - updatedAt: Date; - } - open: boolean - onOpenChange: (open: boolean) => void -} - -export function UpdateItemSheet({ item, open, onOpenChange }: UpdateItemSheetProps) { - const [isSubmitting, setIsSubmitting] = React.useState(false) - // 초기값 설정 - const form = useForm({ - resolver: zodResolver(updateShipbuildingItemSchema), - defaultValues: { - itemCode: item.itemCode, - itemName: item.itemName, - description: item.description || "", - workType: item.workType, - shipTypes: item.shipTypes, - }, - }) - - async function onSubmit(data: UpdateShipbuildingItemSchema) { - try { - setIsSubmitting(true) - const result = await modifyShipbuildingItem({ ...data, id: item.id }) - - if (result.data) { - toast.success("아이템이 수정되었습니다.") - onOpenChange(false) - } else { - toast.error(result.error || "아이템 수정 중 오류가 발생했습니다. 다시 시도해주세요.") - } - } catch (error) { - toast.error("오류가 발생했습니다.") - console.error(error) - } finally { - setIsSubmitting(false) - } - } - - return ( - - - - 조선 아이템 수정 - - 조선 아이템 정보를 수정합니다. 수정할 필드를 입력해주세요. - - -
- - ( - - Material Group - - - - - - )} - /> - ( - - Description - - - - - - )} - /> - ( - - 기능(공종) - - - - )} - /> - ( - - 선종 - - - - - - )} - /> - ( - - Size/Dimension - -