import { z } from "zod"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { IconMailPlus, IconSend } from "@tabler/icons-react"; import { toast } from "@/hooks/use-toast"; import { Button } from "@/components/ui/button"; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; import { SelectDropdown } from "@/components/select-dropdown"; import { userTypes } from "../data/data"; const formSchema = z.object({ email: z .string() .min(1, { message: "Email is required." }) .email({ message: "Email is invalid." }), role: z.string().min(1, { message: "Role is required." }), desc: z.string().optional() }); type UserInviteForm = z.infer; interface Props { open: boolean; onOpenChange: (open: boolean) => void; } export function UsersInviteDialog({ open, onOpenChange }: Props) { const form = useForm({ resolver: zodResolver(formSchema), defaultValues: { email: "", role: "", desc: "" } }); const onSubmit = (values: UserInviteForm) => { form.reset(); toast({ title: "You submitted the following values:", description: (
					{JSON.stringify(values, null, 2)}
				
) }); onOpenChange(false); }; return ( { form.reset(); onOpenChange(state); }}> Invite User Invite new user to join your team by sending them an email invitation. Assign a role to define their access level.
( Email )} /> ( Role ({ label, value }))} /> )} /> ( Description (optional)