diff --git a/apps/wr/app/matMng/matDmd/coReg/page.tsx b/apps/wr/app/matMng/matDmd/coReg/page.tsx new file mode 100644 index 000000000..8f1212e44 --- /dev/null +++ b/apps/wr/app/matMng/matDmd/coReg/page.tsx @@ -0,0 +1,90 @@ +"use client"; +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import * as z from "zod"; +import { + Form, + FormField, + FormUi, + ScrollArea, + SelectBox, +} from "@common/business_components/ui"; +import { Button } from "@common/components/ui"; +import { CoRegForm } from "@/components/ui/matDmd/coRegForm/component"; +import toast from "react-hot-toast"; +import Link from "next/link"; +import { useRouter } from "next/navigation"; + +const formSchema = z.object({ + ctpv: z.string(), + sgg: z.string(), + coNm: z.string().min(1).max(20), + bznmNo: z.string().min(1).min(9).max(12), + addr: z.string().min(1).min(6).max(20), + telNo: z.string().min(8).max(12), + +}); + +export default function MyForm() { + + + const router = useRouter(); + + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + coNm:'', + bznmNo:'', + addr:'', + telNo:'', + }, + }); + + function onSubmit(values: z.infer) { + try { + console.log(values); + toast( +
+          {JSON.stringify(values, null, 2)}
+        
+ ); + router.push('./dmdReg') + // + } catch (error) { + console.error("Form submission error", error); + toast.error("Failed to submit the form. Please try again."); + } + } + + return ( + <> +
+

+ 수요처 정보입력 +

+
+ +
+
+
+
+
+ + {form} + + {/* {form} */} + + +
+ +
+
+
+
+ + ); +} + diff --git a/apps/wr/app/matMng/matDmd/dmdReg/page.tsx b/apps/wr/app/matMng/matDmd/dmdReg/page.tsx new file mode 100644 index 000000000..83fba4e74 --- /dev/null +++ b/apps/wr/app/matMng/matDmd/dmdReg/page.tsx @@ -0,0 +1,99 @@ +"use client"; +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import * as z from "zod"; +import { + Form, +} from "@common/business_components/ui"; +import { Button } from "@common/components/ui"; +import { DmdRegForm } from "@/components/ui/matDmd/dmdRegform/component"; +import toast from "react-hot-toast"; + +const formSchema = z.object({ + dmdSel: z.string().min(1).min(0), + dmdTmng: z.coerce.date(), + dmdWq: z.string().min(1).optional(), + useUsgCd: z.string(), + wntUntprc: z.string().min(1), + grssClfg: z.string().min(1), + tn: z.string().min(1).optional(), + combResdch: z.string().min(1).optional(), + tp: z.string().min(1).optional(), + trbt: z.string().min(1).optional(), + ph: z.string().min(1).optional(), + bod: z.string().min(1).optional(), + clIonQnt: z.string().min(1).optional(), + smll: z.string().min(1).optional(), + cdtnv: z.string().min(1).optional(), + crmty: z.string().min(1).optional(), + rmrk: z.string().min(1).optional(), +}); + +export default function MyForm() { + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + dmdTmng: new Date(), + dmdWq: '', + useUsgCd: '', + wntUntprc: '', + grssClfg: '', + tn: '', + combResdch: '', + tp: '', + trbt:'', + ph: '', + bod: '', + clIonQnt: '', + smll: '', + cdtnv: '', + crmty: '', + rmrk: '', + }, + }); + + function onSubmit(values: z.infer) { + try { + console.log(values); + + toast( +
+          {JSON.stringify(values, null, 2)}
+        
+ ); + } catch (error) { + console.error("Form submission error", error); + // toast.error("Failed to submit the form. Please try again."); + } + } + + return ( + <> +
+

+ 수요 신청정보입력 +

+
+ +
+
+
+
+
+ + + {form} + + +
+ +
+
+
+
+ + ); +} diff --git a/apps/wr/app/matMng/matDmd/page.tsx b/apps/wr/app/matMng/matDmd/page.tsx deleted file mode 100644 index 6487b3e6f..000000000 --- a/apps/wr/app/matMng/matDmd/page.tsx +++ /dev/null @@ -1,96 +0,0 @@ -"use client" - - -import { - useForm -} from "react-hook-form" -import { - zodResolver -} from "@hookform/resolvers/zod" -import * as z from "zod" - -import { - Calendar as CalendarIcon -} from "lucide-react" -import { Form, FormField, FormUi, ScrollArea, SelectBox } from "@common/business_components/ui" -import { Button, Input } from "@common/components/ui" -import { BaseForm } from "@/components/ui/matDmd/baseForm/component" -import { WqForm } from "@/components/ui/matDmd/wqForm/component" - -const formSchema = z.object({ - ctpv: z.string(), - sgg: z.string(), - coNm: z.string().min(1).min(0).max(20), - bznmNo: z.string().min(1).min(9).max(12), - name_5973331634: z.string().min(1).min(6).max(20), - telNo: z.string().min(8).max(12), - dmdSel: z.string().min(1).min(0), - dmdTmng: z.coerce.date(), - dmdWq: z.string().min(1).optional(), - useUsgCd: z.string(), - wntUntprc: z.string().min(1), - grssClfg: z.string().min(1), - tn: z.string().min(1).optional(), - combResdch: z.string().min(1), - tp: z.string().min(1), - trbt: z.string().min(1).optional(), - ph: z.string().min(1), - bod: z.string().min(1).optional(), - clIonQnt: z.string().min(1), - smll: z.string().min(1).optional(), - cdtnv: z.string().min(1).optional(), - crmty: z.string().min(1).optional(), - rmrk: z.string().min(1) -}); - -export default function MyForm() { - - const form = useForm < z.infer < typeof formSchema >> ({ - resolver: zodResolver(formSchema), - defaultValues: { - "dmdTmng": new Date() - }, - }) - - function onSubmit(values: z.infer < typeof formSchema > ) { - try { - console.log(values); - /* - toast( -
-          {JSON.stringify(values, null, 2)}
-        
- );*/ - } catch (error) { - console.error("Form submission error", error); - // toast.error("Failed to submit the form. Please try again."); - } - } - - return ( - <> -
-

수요처 정보 등록

-
- -
-
-

정보입력

-
-
- - - - {form} - - - {form} - - - -
- -
- - ) -} \ No newline at end of file diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index 8ba60d197..356cfe8c3 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -18,7 +18,7 @@ export default function Home() {
diff --git a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert/page.tsx b/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert/page.tsx index cb76d0c36..71dffacbb 100644 --- a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert/page.tsx +++ b/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert/page.tsx @@ -10,7 +10,6 @@ import { useWrStore } from '../../../store'; export default function PublicReuseFaciltyInsert() { const {pubFac} = useWrStore((state) => state); const { pubFacHeadList, publicReuseFacilityData, selectLabel} = pubFac; - console.log(pubFacHeadList) const searchDiv = '하수재이용시설 ' const selectBox = [{ text: '서울하수처리시설', val: "1" }, { text: '서울1하수처리시설', val: "2" }, { text: '서울2하수처리시설', val: "3" }] const headName = () => { diff --git a/apps/wr/app/store/matDmd/index.tsx b/apps/wr/app/store/matDmd/index.tsx index b1a27df1d..2ed933348 100644 --- a/apps/wr/app/store/matDmd/index.tsx +++ b/apps/wr/app/store/matDmd/index.tsx @@ -5,12 +5,12 @@ import type { selectArray } from "../rainReuseFacilityInsert"; const selectSido = [ { text: '서울', val: "1" }, { text: "인천", val: "2" }, - { text: "부산", val: "2" }, + { text: "부산", val: "3" }, ]; const selectSgg = [ { text: '종로구', val: "1" }, { text: "성북구", val: "2" }, - { text: "강남구", val: "2" }, + { text: "강남구", val: "3" }, ]; const selectUsg = [ { text: '민간', val: "1" }, diff --git a/apps/wr/app/store/rainReuseFacilityInsert/index.tsx b/apps/wr/app/store/rainReuseFacilityInsert/index.tsx index 94b86aa74..0fd5194f9 100644 --- a/apps/wr/app/store/rainReuseFacilityInsert/index.tsx +++ b/apps/wr/app/store/rainReuseFacilityInsert/index.tsx @@ -85,6 +85,8 @@ export type selectArray ={ val:string } + +export const selectClass ="w-full h-full text-2xl"; const selectHomeWater = [ { text: '집수면', val: "1" }, { text: "종류", val: "2" }, diff --git a/apps/wr/components/ui/matDmd/baseForm/component.tsx b/apps/wr/components/ui/matDmd/baseForm/component.tsx deleted file mode 100644 index 9c04603e1..000000000 --- a/apps/wr/components/ui/matDmd/baseForm/component.tsx +++ /dev/null @@ -1,162 +0,0 @@ -import { useWrStore } from "@/app/store"; -import { DatePicker, FormField, FormItem, FormLabel, FormUi, SelectBox } from "@common/business_components"; -import { Input } from "@common/components"; -import { useState } from "react"; - -export function BaseForm(form:any){ - - const { dmd } = useWrStore((state) => state); - - const [dmdDate, setDmdDate] = useState(new Date()) - - - const onChangeDate=(val:Date|undefined)=>{ - if(val)setDmdDate(val); - } - return( - - <> - ( - - - - - )} - /> - - ( - - - - - )} - /> - - ( - - - - )} - /> - - ( - - - - )} - /> - - ( - - - - )} - /> - - ( - - - - - )} - /> - - - ( - - - - )} - /> - - ( - - 요구시기 - - - )} - /> - - ( - - - - - )} - /> - - ( - - - - - )} - /> - - ( - - - - - )} - /> - - - ) -} \ No newline at end of file diff --git a/apps/wr/components/ui/matDmd/coRegForm/component.tsx b/apps/wr/components/ui/matDmd/coRegForm/component.tsx new file mode 100644 index 000000000..f27639251 --- /dev/null +++ b/apps/wr/components/ui/matDmd/coRegForm/component.tsx @@ -0,0 +1,91 @@ +import { useWrStore } from "@/app/store"; +import { selectClass } from "@/app/store/rainReuseFacilityInsert"; +import { DatePicker, FormField, FormItem, FormLabel, FormUi, SelectBox } from "@common/business_components"; +import { Button, Input } from "@common/components"; +import { useState } from "react"; + +export function CoRegForm(form:any){ + + const { dmd } = useWrStore((state) => state); + + return( + + <> + ( + + + + + )} + /> + + ( + + + + + )} + /> + + ( + + + + )} + /> + + ( + + + + )} + /> + + ( + + + + )} + /> + + ( + + + + + )} + /> + + + + ) +} \ No newline at end of file diff --git a/apps/wr/components/ui/matDmd/wqForm/component.tsx b/apps/wr/components/ui/matDmd/dmdRegform/component.tsx similarity index 58% rename from apps/wr/components/ui/matDmd/wqForm/component.tsx rename to apps/wr/components/ui/matDmd/dmdRegform/component.tsx index e246071b9..899b954a1 100644 --- a/apps/wr/components/ui/matDmd/wqForm/component.tsx +++ b/apps/wr/components/ui/matDmd/dmdRegform/component.tsx @@ -1,10 +1,94 @@ -import { FormField, FormUi } from "@common/business_components"; -import { Input } from "@common/components"; +import { useWrStore } from "@/app/store"; +import { selectClass } from "@/app/store/rainReuseFacilityInsert"; +import { DatePicker, FormField, FormItem, FormLabel, FormUi, SelectBox } from "@common/business_components"; +import { Input } from "@common/components"; +import { useState } from "react"; -export function WqForm(form: any) { +export function DmdRegForm(form: any) { + const { dmd } = useWrStore((state) => state); + + const [dmdDate, setDmdDate] = useState(new Date()) + + + const onChangeDate = (val: Date|undefined) => { + if(val)setDmdDate(val) + } + return ( <> + ( + + + + )} + /> + + ( + + 요구시기 + + + )} + /> + + ( + + + + + )} + /> + + ( + + + + + )} + /> + + ( + + + + + )} + /> + +
+

+ 요구수질 +

+
+
+ + +
+
+ ( + + + + )} + /> +
+ +
+ ( + + + + )} + /> +
+
+ ); } diff --git a/apps/wr/components/ui/rainReuseInsertForm.tsx b/apps/wr/components/ui/rainReuseInsertForm.tsx index 062c8e183..57e30c551 100644 --- a/apps/wr/components/ui/rainReuseInsertForm.tsx +++ b/apps/wr/components/ui/rainReuseInsertForm.tsx @@ -11,6 +11,7 @@ import { useForm } from "react-hook-form"; import { z } from "zod"; import { FormUi } from "@common/business_components"; import { useWrStore } from "@/app/store"; +import { selectClass } from "@/app/store/rainReuseFacilityInsert"; const formSchema = z.object({ username: z.string().min(2).max(50), @@ -39,7 +40,6 @@ export function RainReuseFaciltyInsertForm() { console.log(val) } - const selectClass ="w-full h-full text-2xl"; return (
diff --git a/apps/wr/components/ui/rswtrReuseInsetForm.tsx b/apps/wr/components/ui/rswtrReuseInsetForm.tsx index 4e923a8fa..e4a540f20 100644 --- a/apps/wr/components/ui/rswtrReuseInsetForm.tsx +++ b/apps/wr/components/ui/rswtrReuseInsetForm.tsx @@ -16,6 +16,7 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { useWrStore } from "@/app/store"; +import { selectClass } from "@/app/store/rainReuseFacilityInsert"; const formSchema = z.object({ username: z.string().min(2).max(50), @@ -44,7 +45,6 @@ export function RswtrReuseFaciltyInsertForm() { console.log(val) } - const selectClass ="w-full h-full text-2xl"; return (