하수재이용 시설 등록 메시지 표출
This commit is contained in:
@@ -15,42 +15,42 @@ import {
|
||||
} from "@common/components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm";
|
||||
import {
|
||||
type FieldErrors,
|
||||
type UseFormReturn,
|
||||
} from "react-hook-form";
|
||||
import { type FieldErrors, type UseFormReturn } from "react-hook-form";
|
||||
import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
|
||||
import type { z } from "zod";
|
||||
import { confirmToast } from "@/components/lib/func/commom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export function PbnstRegModal({
|
||||
form,
|
||||
setPbnstInsert,
|
||||
onInvalid
|
||||
onInvalid,
|
||||
}: {
|
||||
form: UseFormReturn<{ items: PbnstRegArrrayType }>;
|
||||
setPbnstInsert: (data: customPbnst) => void;
|
||||
onInvalid:(errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>) => void
|
||||
onInvalid: (
|
||||
errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>
|
||||
) => void;
|
||||
}) {
|
||||
|
||||
// const [pbnstBdstForm, setPbnstBdstForm] = useState<customPbnst>(
|
||||
// {} as customPbnst
|
||||
// );
|
||||
const { t } = useTranslation("base");
|
||||
|
||||
//TODO: 유즈 스테이트에 set만해도 되나?
|
||||
const [, setCurrentTab] = useState<string>("mng");
|
||||
//const setCurrentTab = "mng"
|
||||
const [indexMng, setIndexMng] = useState<number>(0);
|
||||
const [indexBiz, setIndexBiz] = useState<number>(0);
|
||||
|
||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||
const item = valuse.items[indexMng];
|
||||
const data = item ? writeRgtrAndMdfr([item]) : [];
|
||||
//
|
||||
const handleConfirm = () => {
|
||||
if (data && data[0]) {
|
||||
setPbnstInsert(data[0]);
|
||||
}
|
||||
};
|
||||
confirmToast(t("isInsertMsg"), handleConfirm);
|
||||
};
|
||||
|
||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||
const item = valuse.items[indexMng];
|
||||
const data = item ? writeRgtrAndMdfr([item]) : [];
|
||||
if (data && data[0]) {
|
||||
setPbnstInsert(data[0]);
|
||||
}
|
||||
};
|
||||
|
||||
const handleTabChange = (value: string) => {
|
||||
setCurrentTab(value);
|
||||
};
|
||||
@@ -60,7 +60,6 @@ export function PbnstRegModal({
|
||||
}, [form.formState.errors]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
const firstForm = form.getValues("items");
|
||||
if (firstForm) {
|
||||
setIndexMng(firstForm.length - 1);
|
||||
@@ -94,7 +93,6 @@ export function PbnstRegModal({
|
||||
<PbnstMngForm
|
||||
form={form}
|
||||
formType={"reg"}
|
||||
// firstFcltData={pbnstBdstForm}
|
||||
indexMng={indexMng}
|
||||
setIndexMng={setIndexMng}
|
||||
/>
|
||||
@@ -106,7 +104,6 @@ export function PbnstRegModal({
|
||||
indexBiz={indexBiz}
|
||||
setIndexBiz={setIndexBiz}
|
||||
formType={"reg"}
|
||||
// firstBizData={pbnstBdstForm.fcBizs}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
Reference in New Issue
Block a user