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,4 +183,10 @@
183 183
     align-content: stretch;
184 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,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
 }

+ 6 - 2
src/Pages/Register.jsx

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