|
|
@@ -1,5 +1,9 @@
|
|
|
+import { useState } from 'react'
|
|
|
import { useFormik, Form, FormikProvider } from 'formik'; // import { useNavigate } from 'react-router-dom';
|
|
|
-import { Stack, TextField,Box, Button } from '@mui/material';
|
|
|
+import { Stack, TextField,Box, Button,
|
|
|
+ Backdrop, CircularProgress,
|
|
|
+} from '@mui/material';
|
|
|
+import toast, { Toaster } from 'react-hot-toast';
|
|
|
import * as Yup from 'yup';
|
|
|
|
|
|
export function PersonalInfo(props) {
|
|
|
@@ -14,6 +18,8 @@ export function PersonalInfo(props) {
|
|
|
telefono: Yup.number('Ingresa únicamente números').required('Tu numero de telefono es requerido')
|
|
|
});
|
|
|
|
|
|
+ let [open, setOpen] = useState(false);
|
|
|
+
|
|
|
const formik = useFormik({
|
|
|
initialValues: {
|
|
|
nit: client.nit,
|
|
|
@@ -24,12 +30,22 @@ export function PersonalInfo(props) {
|
|
|
},
|
|
|
validationSchema: RegisterSchema,
|
|
|
onSubmit: (values) => {
|
|
|
- // setOpen(true);
|
|
|
+ setOpen(true);
|
|
|
// let url = 'http://204.48.25.93:8081/registro'
|
|
|
// let url = 'http://psicoadmin.ditca.org:8081/registro'
|
|
|
+ console.log(client)
|
|
|
setClient({
|
|
|
...client, ...values
|
|
|
})
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ let nombre = client.firstName + " " + client.lastName
|
|
|
+ toast.success(`Bienvenido ${nombre} !!`)
|
|
|
+ setOpen(false);
|
|
|
+ }, 5000)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -72,7 +88,7 @@ export function PersonalInfo(props) {
|
|
|
type="date"
|
|
|
label="Fecha de nacimiento"
|
|
|
fullWidth
|
|
|
- InputLabelProps={{ shrink: true, required: true }}
|
|
|
+ InputLabelProps={{ required: true }}
|
|
|
{...getFieldProps('nacimiento')}
|
|
|
error={Boolean(touched.nacimiento && errors.nacimiento)}
|
|
|
helperText={touched.nacimiento && errors.nacimiento}
|
|
|
@@ -108,7 +124,19 @@ export function PersonalInfo(props) {
|
|
|
</Box>
|
|
|
|
|
|
</Stack>
|
|
|
+
|
|
|
</Form>
|
|
|
+ <Toaster
|
|
|
+ position="top-center"
|
|
|
+ reverseOrder={false}
|
|
|
+ />
|
|
|
+ <Backdrop
|
|
|
+ sx={{ color: '#fd4b4b', zIndex: (theme) => theme.zIndex.drawer + 1 }}
|
|
|
+ open={open}
|
|
|
+ onClick={() => setOpen(false)}
|
|
|
+ >
|
|
|
+ <CircularProgress color="inherit" />
|
|
|
+ </Backdrop>
|
|
|
</FormikProvider>
|
|
|
)
|
|
|
}
|