"use client" import { date, z } from "zod" import { useForm, useFieldArray } from "react-hook-form" import { zodResolver } from "@hookform/resolvers/zod" import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, Button, DatePicker } from "@common/components/ui" import { UiTable } from "@common/business_components/ui" import React, { useState } from "react" import BaseLayout from "@/ii/BaseLayout" import FormSection from "@/components/ui/formSection" // TODO: 컴포넌트 호출 ~ 필요 코드 수정해야댐 // zod 스키마 정의 const formSchema = z.object({ region: z.string(), rdiiArea: z.string(), rtkSource: z.string(), unitFactors: z.array(z.object({ response: z.string(), R: z.string(), T: z.string(), K: z.string(), })), initialDepths: z.array(z.object({ response: z.string(), Dmax: z.string(), Drec: z.string(), Do: z.string(), })), suyeonga: z.string(), rate: z.string(), date: z.coerce.date(), rain: z.string(), }) export default function RTKForm() { const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { region: "", rdiiArea: "", rtkSource: "", unitFactors: [ { response: "Short-Term", R: "", T: "", K: "" }, { response: "Medium-Term", R: "", T: "", K: "" }, { response: "Long-Term", R: "", T: "", K: "" }, ], initialDepths: [ { response: "Short-Term", Dmax: "", Drec: "", Do: "" }, { response: "Medium-Term", Dmax: "", Drec: "", Do: "" }, { response: "Long-Term", Dmax: "", Drec: "", Do: "" }, ], } }) const { fields: unitFactorFields } = useFieldArray({ control: form.control, name: "unitFactors" }) const { fields: initialDepthFields } = useFieldArray({ control: form.control, name: "initialDepths" }) const onSubmit = (data: z.infer) => { console.log("✅ 제출 데이터:", data) } // 단위도 계수 테이블 설정 const unitFactorHeadlist = [ { id: 'response', title: 'Response' }, { id: 'R', title: 'R' }, { id: 'T', title: 'T' }, { id: 'K', title: 'K' } ] // 초기 차단 깊이 테이블 설정 const initialDepthHeadlist = [ { id: 'response', title: 'Response' }, { id: 'Dmax', title: 'Dmax' }, { id: 'Drec', title: 'Drec' }, { id: 'Do', title: 'Do' } ] // 테이블 페이지 변경 핸들러 const handlePageChange = (page: number) => { console.log('Page changed:', page) } const [selectedDate, setSelectedDate] = useState(new Date()) return ( { }} graphBtn={false}> {[
○ 단위도 계수
{null}
○ 초기 차단 깊이
{null}
{ if (date) setSelectedDate(date) }} mode={"single"} />
]}
) }