|
@@ -1,5 +1,9 @@
|
|
1
|
+import { useState } from 'react'
|
1
|
2
|
import { useFormik, Form, FormikProvider } from 'formik'; // import { useNavigate } from 'react-router-dom';
|
2
|
|
-import { Stack, TextField,Box, Button } from '@mui/material';
|
|
3
|
+import { Stack, TextField,Box, Button,
|
|
4
|
+ Backdrop, CircularProgress,
|
|
5
|
+} from '@mui/material';
|
|
6
|
+import toast, { Toaster } from 'react-hot-toast';
|
3
|
7
|
import * as Yup from 'yup';
|
4
|
8
|
|
5
|
9
|
export function PersonalInfo(props) {
|
|
@@ -14,6 +18,8 @@ export function PersonalInfo(props) {
|
14
|
18
|
telefono: Yup.number('Ingresa únicamente números').required('Tu numero de telefono es requerido')
|
15
|
19
|
});
|
16
|
20
|
|
|
21
|
+ let [open, setOpen] = useState(false);
|
|
22
|
+
|
17
|
23
|
const formik = useFormik({
|
18
|
24
|
initialValues: {
|
19
|
25
|
nit: client.nit,
|
|
@@ -24,12 +30,22 @@ export function PersonalInfo(props) {
|
24
|
30
|
},
|
25
|
31
|
validationSchema: RegisterSchema,
|
26
|
32
|
onSubmit: (values) => {
|
27
|
|
- // setOpen(true);
|
|
33
|
+ setOpen(true);
|
28
|
34
|
// let url = 'http://204.48.25.93:8081/registro'
|
29
|
35
|
// let url = 'http://psicoadmin.ditca.org:8081/registro'
|
|
36
|
+ console.log(client)
|
30
|
37
|
setClient({
|
31
|
38
|
...client, ...values
|
32
|
39
|
})
|
|
40
|
+
|
|
41
|
+ setTimeout(() => {
|
|
42
|
+ let nombre = client.firstName + " " + client.lastName
|
|
43
|
+ toast.success(`Bienvenido ${nombre} !!`)
|
|
44
|
+ setOpen(false);
|
|
45
|
+ }, 5000)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
33
|
49
|
}
|
34
|
50
|
});
|
35
|
51
|
|
|
@@ -72,7 +88,7 @@ export function PersonalInfo(props) {
|
72
|
88
|
type="date"
|
73
|
89
|
label="Fecha de nacimiento"
|
74
|
90
|
fullWidth
|
75
|
|
- InputLabelProps={{ shrink: true, required: true }}
|
|
91
|
+ InputLabelProps={{ required: true }}
|
76
|
92
|
{...getFieldProps('nacimiento')}
|
77
|
93
|
error={Boolean(touched.nacimiento && errors.nacimiento)}
|
78
|
94
|
helperText={touched.nacimiento && errors.nacimiento}
|
|
@@ -108,7 +124,19 @@ export function PersonalInfo(props) {
|
108
|
124
|
</Box>
|
109
|
125
|
|
110
|
126
|
</Stack>
|
|
127
|
+
|
111
|
128
|
</Form>
|
|
129
|
+ <Toaster
|
|
130
|
+ position="top-center"
|
|
131
|
+ reverseOrder={false}
|
|
132
|
+ />
|
|
133
|
+ <Backdrop
|
|
134
|
+ sx={{ color: '#fd4b4b', zIndex: (theme) => theme.zIndex.drawer + 1 }}
|
|
135
|
+ open={open}
|
|
136
|
+ onClick={() => setOpen(false)}
|
|
137
|
+ >
|
|
138
|
+ <CircularProgress color="inherit" />
|
|
139
|
+ </Backdrop>
|
112
|
140
|
</FormikProvider>
|
113
|
141
|
)
|
114
|
142
|
}
|