Browse Source

mukup fixes

amenpunk 3 years ago
parent
commit
d0d042c366
3 changed files with 44 additions and 6 deletions
  1. 7 1
      src/App.css
  2. 31 3
      src/Components/Register/PersonalInfo.js
  3. 6 2
      src/Pages/Register.jsx

+ 7 - 1
src/App.css

183
     align-content: stretch;
183
     align-content: stretch;
184
     padding : 35px; 
184
     padding : 35px; 
185
 }
185
 }
186
-
186
+.register_content{
187
+    display: flex;
188
+    flex-wrap: wrap;
189
+    flex-direction: row;
190
+    justify-content: space-evenly;
191
+    align-items :stretch;
192
+}

+ 31 - 3
src/Components/Register/PersonalInfo.js

1
+import  { useState } from 'react'
1
 import { useFormik, Form, FormikProvider } from 'formik'; // import { useNavigate } from 'react-router-dom';
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
 import * as Yup from 'yup';
7
 import * as Yup from 'yup';
4
 
8
 
5
 export function PersonalInfo(props) {
9
 export function PersonalInfo(props) {
14
         telefono: Yup.number('Ingresa únicamente números').required('Tu numero de telefono es requerido')
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
     const formik = useFormik({
23
     const formik = useFormik({
18
         initialValues: {
24
         initialValues: {
19
             nit: client.nit,
25
             nit: client.nit,
24
         },
30
         },
25
         validationSchema: RegisterSchema,
31
         validationSchema: RegisterSchema,
26
         onSubmit: (values) => {
32
         onSubmit: (values) => {
27
-            // setOpen(true);
33
+            setOpen(true);
28
             // let url = 'http://204.48.25.93:8081/registro'
34
             // let url = 'http://204.48.25.93:8081/registro'
29
             // let url = 'http://psicoadmin.ditca.org:8081/registro'
35
             // let url = 'http://psicoadmin.ditca.org:8081/registro'
36
+            console.log(client)
30
             setClient({
37
             setClient({
31
                 ...client, ...values
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
                             type="date"
88
                             type="date"
73
                             label="Fecha de nacimiento"
89
                             label="Fecha de nacimiento"
74
                             fullWidth
90
                             fullWidth
75
-                            InputLabelProps={{ shrink: true, required: true }}
91
+                            InputLabelProps={{  required: true }}
76
                             {...getFieldProps('nacimiento')}
92
                             {...getFieldProps('nacimiento')}
77
                             error={Boolean(touched.nacimiento && errors.nacimiento)}
93
                             error={Boolean(touched.nacimiento && errors.nacimiento)}
78
                             helperText={touched.nacimiento && errors.nacimiento}
94
                             helperText={touched.nacimiento && errors.nacimiento}
108
                     </Box>
124
                     </Box>
109
 
125
 
110
                 </Stack>
126
                 </Stack>
127
+
111
             </Form>
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
         </FormikProvider>
140
         </FormikProvider>
113
     )
141
     )
114
 }
142
 }

+ 6 - 2
src/Pages/Register.jsx

27
         }    
27
         }    
28
     }, [auth,navigate])
28
     }, [auth,navigate])
29
 
29
 
30
+
31
+//new Date(year, monthIndex, day)
32
+    const TODAY = new Date()
33
+
30
     const [activeStep, setActiveStep] = React.useState(0);
34
     const [activeStep, setActiveStep] = React.useState(0);
31
     const [client, setClient] = React.useState({
35
     const [client, setClient] = React.useState({
32
         firstName: '',
36
         firstName: '',
37
         nit: "",
41
         nit: "",
38
         cui: "",
42
         cui: "",
39
         direccion: "",
43
         direccion: "",
40
-        fechacumple: "",
44
+        nacimiento : TODAY.getFullYear() +'-10-18',
41
         telefono : "",
45
         telefono : "",
42
     });
46
     });
43
 
47
 
76
 
80
 
77
     return (
81
     return (
78
         <Container>
82
         <Container>
79
-            <Row>
83
+            <Row className="register_content">
80
                 <Col md={4}>
84
                 <Col md={4}>
81
         <Card className="card_register">
85
         <Card className="card_register">
82
 
86