organization created successfully
This commit is contained in:
parent
a48fc1d989
commit
28b0541894
@ -6,14 +6,17 @@ import {
|
|||||||
organizationSchema,
|
organizationSchema,
|
||||||
} from "./OrganizationSchema";
|
} from "./OrganizationSchema";
|
||||||
import Modal from "../common/Modal";
|
import Modal from "../common/Modal";
|
||||||
import { useCreateOrganization, useOrganizationModal } from "../../hooks/useOrganization";
|
import {
|
||||||
|
useCreateOrganization,
|
||||||
|
useOrganizationModal,
|
||||||
|
} from "../../hooks/useOrganization";
|
||||||
import Label from "../common/Label";
|
import Label from "../common/Label";
|
||||||
import SelectMultiple from "../common/SelectMultiple";
|
import SelectMultiple from "../common/SelectMultiple";
|
||||||
import { useServices } from "../../hooks/masterHook/useMaster";
|
import { useServices } from "../../hooks/masterHook/useMaster";
|
||||||
|
|
||||||
const ManageOrganization = () => {
|
const ManageOrganization = () => {
|
||||||
const orgModal = useOrganizationModal();
|
const orgModal = useOrganizationModal();
|
||||||
const { data: services,isLoading } = useServices();
|
const { data: services, isLoading } = useServices();
|
||||||
|
|
||||||
const method = useForm({
|
const method = useForm({
|
||||||
resolver: zodResolver(organizationSchema),
|
resolver: zodResolver(organizationSchema),
|
||||||
@ -23,15 +26,20 @@ const ManageOrganization = () => {
|
|||||||
const {
|
const {
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
register,
|
register,
|
||||||
|
reset,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = method;
|
} = method;
|
||||||
|
|
||||||
const {mutate:CreateOrganization,isPending} = useCreateOrganization(()=>{})
|
const { mutate: CreateOrganization, isPending } = useCreateOrganization(
|
||||||
|
() => {
|
||||||
|
reset(defaultOrganizationValues);
|
||||||
|
orgModal.onClose();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const onSubmit = (OrgPayload) => {
|
const onSubmit = (OrgPayload) => {
|
||||||
CreateOrganization()
|
CreateOrganization(OrgPayload);
|
||||||
};
|
};
|
||||||
console.log(services)
|
|
||||||
const contentBody = (
|
const contentBody = (
|
||||||
<FormProvider {...method}>
|
<FormProvider {...method}>
|
||||||
<form className="form" onSubmit={handleSubmit(onSubmit)}>
|
<form className="form" onSubmit={handleSubmit(onSubmit)}>
|
||||||
@ -118,12 +126,17 @@ const ManageOrganization = () => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-sm btn-secondary"
|
className="btn btn-sm btn-secondary"
|
||||||
onClick={orgModal.onClose} disabled={isPending || isLoading}
|
onClick={orgModal.onClose}
|
||||||
|
disabled={isPending || isLoading}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" className="btn btn-sm btn-primary" disabled={isPending || isLoading}>
|
<button
|
||||||
{isPending ? "Please Wait...":"Submit"}
|
type="submit"
|
||||||
|
className="btn btn-sm btn-primary"
|
||||||
|
disabled={isPending || isLoading}
|
||||||
|
>
|
||||||
|
{isPending ? "Please Wait..." : "Submit"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user