import { useWrStore } from "@/app/store"; import { sttnHeadListType } from "@/app/store/ruseFcltMng/fcltSttn/rainSttn/headList"; import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@common/business_components/ui"; import { Button, Checkbox } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; export default function HeadChModal({headList, type }:{headList : z.infer ,type:string }) { const { rainChSttnHead , rswtChSttnHead} = useWrStore((state) => state); let items = headList.map(item => ({id:item.id, title:item.title, val:item.visible })); const form = useForm>({ resolver: zodResolver(sttnHeadListType), defaultValues: [], }) useEffect(() =>{ form.reset(headList) },[headList]) const onSubmit = (valueList : z.infer ) =>{ if(type==='RNB'){ rainChSttnHead(valueList) }else if(type=== 'RST'){ rswtChSttnHead(valueList) } } return ( <>

조회항목 설정

{items.map((item,index) => ( { return ( { field.onChange(checked); return; } } /> {item.title} ); }} /> ))}
); }