// ** React Imports import { ChangeEvent, useState } from 'react' // ** Next Import import Link from 'next/link' // ** MUI Imports import Card from '@mui/material/Card' import Grid from '@mui/material/Grid' import Button from '@mui/material/Button' import TextField from '@mui/material/TextField' import CardHeader from '@mui/material/CardHeader' import CardContent from '@mui/material/CardContent' import FormControl from "@mui/material/FormControl"; import FormHelperText from "@mui/material/FormHelperText"; // ** Icon Imports import Icon from 'src/@core/components/icon' import * as yup from "yup"; import { useForm, Controller } from "react-hook-form"; import { yupResolver } from "@hookform/resolvers/yup"; import InputLabel from "@mui/material/InputLabel"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import MenuItem from "@mui/material/MenuItem"; interface State { alert: string code: string } const schema = yup.object().shape({ alert: yup.string().required(), code: yup.string().required(), }); const AlertCreate = () => { // ** States const defaultValues = { alert : '', code: '', } const [userType, setUserType] = useState(""); const handleUserType = (e: SelectChangeEvent) => { setUserType(e.target.value); }; const { reset, control, setValue, setError, handleSubmit, formState: { errors } } = useForm({ defaultValues, mode: 'onChange', resolver: yupResolver(schema), }) const onSubmit = (data: State) => { const {alert, code} = data } return (
( )} /> {errors.alert && ( {errors.alert.message} )} ( )} /> {errors.code && ( {errors.code.message} )}
) } AlertCreate.acl = { action: 'manage', subject: 'admin' } export default AlertCreate