diff --git a/src/components/master/ManagePaymentMode.jsx b/src/components/master/ManagePaymentMode.jsx new file mode 100644 index 00000000..6cfcdc42 --- /dev/null +++ b/src/components/master/ManagePaymentMode.jsx @@ -0,0 +1,80 @@ +import React, { useEffect } from "react"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useCreatePaymentMode } from "../../hooks/masterHook/useMaster"; + +const ExpnseSchema = z.object({ + name: z.string().min(1, { message: "Name is required" }), + description: z.string().min(1, { message: "Description is required" }), +}); + +const ManagePaymentMode = ({ data = null, onClose }) => { + const { + register, + handleSubmit, + reset, + formState: { errors }, + } = useForm({ + resolver: zodResolver(ExpnseSchema), + defaultValues: { name: "", noOfPersonsRequired: false, description: "" }, + }); + + const { mutate: CreatePaymentMode, isPending } = useCreatePaymentMode(() => + onClose?.() + ); + + const onSubmit = (payload) => { + CreatePaymentMode(payload); + }; + + + return ( +
+ ); +}; + +export default ManagePaymentMode; diff --git a/src/components/master/MasterModal.jsx b/src/components/master/MasterModal.jsx index 774f9046..1a990269 100644 --- a/src/components/master/MasterModal.jsx +++ b/src/components/master/MasterModal.jsx @@ -18,6 +18,7 @@ import EditContactCategory from "./EditContactCategory"; import EditContactTag from "./EditContactTag"; import { useDeleteMasterItem } from "../../hooks/masterHook/useMaster"; import ManageExpenseType from "./ManageExpenseType"; +import ManagePaymentMode from "./ManagePaymentMode"; const MasterModal = ({ modaldata, closeModal }) => { @@ -90,7 +91,8 @@ const MasterModal = ({ modaldata, closeModal }) => { "Contact Tag":