diff --git a/apps/wr/app/matMng/matDmd/coReg/page.tsx b/apps/wr/app/matMng/matDmd/coReg/page.tsx index 8f1212e44..0c6ceccaa 100644 --- a/apps/wr/app/matMng/matDmd/coReg/page.tsx +++ b/apps/wr/app/matMng/matDmd/coReg/page.tsx @@ -11,9 +11,8 @@ import { } 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"; +import toast, { Toaster } from "react-hot-toast"; +import { ToastFormUi } from "@/components/toastFromUi"; const formSchema = z.object({ ctpv: z.string(), @@ -28,7 +27,6 @@ const formSchema = z.object({ export default function MyForm() { - const router = useRouter(); const form = useForm>({ resolver: zodResolver(formSchema), @@ -42,17 +40,12 @@ export default function MyForm() { function onSubmit(values: z.infer) { try { - console.log(values); - toast( -
-          {JSON.stringify(values, null, 2)}
-        
- ); - router.push('./dmdReg') - // + toast.dismiss(); + ToastFormUi("수요신청 화면으로 이동하시겠습니까?", "수요처 등록 완료", "./dmdReg", "이동") + } catch (error) { console.error("Form submission error", error); - toast.error("Failed to submit the form. Please try again."); + toast.error("수요처 등록이 실패하였습니다."); } } @@ -75,14 +68,15 @@ export default function MyForm() { > {form} - {/* {form} */} -
+
+ +
); diff --git a/apps/wr/app/matMng/matDmd/dmdReg/page.tsx b/apps/wr/app/matMng/matDmd/dmdReg/page.tsx index 83fba4e74..d405d45a6 100644 --- a/apps/wr/app/matMng/matDmd/dmdReg/page.tsx +++ b/apps/wr/app/matMng/matDmd/dmdReg/page.tsx @@ -2,15 +2,14 @@ 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 { 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"; +import toast, { Toaster } from "react-hot-toast"; +import { useRouter } from "next/navigation"; const formSchema = z.object({ - dmdSel: z.string().min(1).min(0), + dmdSel: z.string().min(1), dmdTmng: z.coerce.date(), dmdWq: z.string().min(1).optional(), useUsgCd: z.string(), @@ -27,72 +26,80 @@ const formSchema = z.object({ cdtnv: z.string().min(1).optional(), crmty: z.string().min(1).optional(), rmrk: z.string().min(1).optional(), + sply1: z.string().min(1).optional(), + sply2: z.string().min(1).optional(), + sply3: z.string().min(1).optional(), + password: z.string().min(1), }); export default function MyForm() { const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { + dmdSel:'', dmdTmng: new Date(), - dmdWq: '', - useUsgCd: '', - wntUntprc: '', - grssClfg: '', - tn: '', - combResdch: '', - tp: '', - trbt:'', - ph: '', - bod: '', - clIonQnt: '', - smll: '', - cdtnv: '', - crmty: '', - rmrk: '', + dmdWq: "", + useUsgCd: "", + wntUntprc: "", + grssClfg: "", + tn: "", + combResdch: "", + tp: "", + trbt: "", + ph: "", + bod: "", + clIonQnt: "", + smll: "", + cdtnv: "", + crmty: "", + rmrk: "", + sply1: "", + sply2: "", + sply3: "", + password: "", }, }); - function onSubmit(values: z.infer) { + const router = useRouter(); + + async function onSubmit(values: z.infer) { try { - console.log(values); - - toast( -
-          {JSON.stringify(values, null, 2)}
-        
- ); + + toast.success("✅ 수요신청이 완료되었습니다."); + await new Promise((resolve) => setTimeout(resolve, 3000)); + router.push("../../") } catch (error) { - console.error("Form submission error", error); - // toast.error("Failed to submit the form. Please try again."); + toast.error("수요신청을 다시입력해주시길 바랍니다."); } } return ( <> -
+

- 수요 신청정보입력 -

-
+ 수요 신청정보입력 + +
-
+
-
- + + + {form} - {form} - - -
- + + +
-
+
+ +
); diff --git a/apps/wr/components/toastFromUi.tsx b/apps/wr/components/toastFromUi.tsx new file mode 100644 index 000000000..5270ca5ec --- /dev/null +++ b/apps/wr/components/toastFromUi.tsx @@ -0,0 +1,56 @@ + +import { Button } from "@common/components/ui"; +import Link from "next/link"; +import { useRouter } from "next/router"; +import toast from "react-hot-toast"; + + + +export function ToastFormUi(body:string,title:string,url:string,buttonName:string){ + + //const router = useRouter(); + + return( + + toast.custom((t) => ( + +
+
+
+
+ +
+
+

+ {title} +

+

+ {body} +

+
+
+
+
+ +
+
+ +
+
+ )) + ) +} \ No newline at end of file diff --git a/apps/wr/components/ui/matDmd/dmdRegform/component.tsx b/apps/wr/components/ui/matDmd/dmdRegform/component.tsx index 899b954a1..4e6bf0a38 100644 --- a/apps/wr/components/ui/matDmd/dmdRegform/component.tsx +++ b/apps/wr/components/ui/matDmd/dmdRegform/component.tsx @@ -1,7 +1,7 @@ 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 { Button, Input } from "@common/components"; import { useState } from "react"; export function DmdRegForm(form: any) { @@ -82,8 +82,8 @@ export function DmdRegForm(form: any) { )} /> -
-

+
+

요구수질

@@ -243,34 +243,74 @@ export function DmdRegForm(form: any) { />

- - +
+

+ 공급후보지 선택 +

+
+ +
+
+ +
+ +
-
+
( - + + + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+
+
+

+ 수요신청 비밀번호 +

+ +
+ ( + )} />
- -
- ( - - - - )} - /> -
-
- +
); }