Browse Source

[ref] style in register and step complete

amenpunk 3 years ago
parent
commit
7a750daa03

+ 11 - 0
src/App.css

173
     color: #fd4b4b !important;
173
     color: #fd4b4b !important;
174
 }
174
 }
175
 
175
 
176
+.card_register{
177
+    min-height: 90vh;
178
+    display: flex;
179
+    flex-direction: column;
180
+    flex-wrap: nowrap;
181
+    justify-content: space-evenly;
182
+    align-items: stretch;
183
+    align-content: stretch;
184
+    padding : 35px; 
185
+}
186
+

+ 14 - 14
src/Components/Register/AuthLayout.js

9
 // ----------------------------------------------------------------------
9
 // ----------------------------------------------------------------------
10
 
10
 
11
 const HeaderStyle = styled('header')(({ theme }) => ({
11
 const HeaderStyle = styled('header')(({ theme }) => ({
12
-    top: 0,
13
-    zIndex: 9,
14
-    lineHeight: 0,
15
-    width: '100%',
16
-    display: 'flex',
17
-    alignItems: 'center',
18
-    position: 'absolute',
19
-    padding: theme.spacing(3),
20
-    justifyContent: 'space-between',
21
-    [theme.breakpoints.up('md')]: {
22
-        alignItems: 'flex-start',
23
-        padding: theme.spacing(7, 5, 0, 7)
24
-    }
12
+    // top: 0,
13
+    // zIndex: 9,
14
+    // lineHeight: 0,
15
+    // width: '100%',
16
+    // display: 'flex',
17
+    // alignItems: 'center',
18
+    // position: 'absolute',
19
+    // padding: theme.spacing(3),
20
+    // justifyContent: 'space-between',
21
+    // [theme.breakpoints.up('md')]: {
22
+        // alignItems: 'flex-start',
23
+        // padding: theme.spacing(7, 5, 0, 7)
24
+    // }
25
 }));
25
 }));
26
 
26
 
27
 // ----------------------------------------------------------------------
27
 // ----------------------------------------------------------------------
34
     return (
34
     return (
35
         <HeaderStyle>
35
         <HeaderStyle>
36
             <RouterLink to="/">
36
             <RouterLink to="/">
37
-                <Image style={{ width : '30%'}} fluid={true} alt="register logo" src={Logo}/>
37
+                <Image style={{ width : '70%'}} fluid={true} alt="register logo" src={Logo}/>
38
             </RouterLink>
38
             </RouterLink>
39
 
39
 
40
             <div>
40
             <div>

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

1
 import { useFormik, Form, FormikProvider } from 'formik'; // import { useNavigate } from 'react-router-dom';
1
 import { useFormik, Form, FormikProvider } from 'formik'; // import { useNavigate } from 'react-router-dom';
2
+import { Stack, TextField,Box, Button } from '@mui/material';
2
 import * as Yup from 'yup';
3
 import * as Yup from 'yup';
3
 
4
 
4
-import { 
5
-    Stack, TextField,Box, Button
6
-} from '@mui/material';
7
-
8
 export function PersonalInfo(props) {
5
 export function PersonalInfo(props) {
9
 
6
 
10
-    // let navigate = useNavigate()
7
+    let { handleBack, setClient, client } = props
11
 
8
 
12
-    const steplen = 2
13
     const RegisterSchema = Yup.object().shape({
9
     const RegisterSchema = Yup.object().shape({
14
         nit: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado largo!').required('El nit es requerido'),
10
         nit: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado largo!').required('El nit es requerido'),
15
         cui: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!').required('Tu CUI/DPI es requerido'),
11
         cui: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!').required('Tu CUI/DPI es requerido'),
16
         direccion: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!').required('La direccion es requerida'),
12
         direccion: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!').required('La direccion es requerida'),
17
         nacimiento: Yup.date().required('Tu fecha  nacimiento es requerida'),
13
         nacimiento: Yup.date().required('Tu fecha  nacimiento es requerida'),
18
-        telefono: Yup.number().required('Tu numero de telefono es requerido').oneOf([Yup.ref('password'), null], 'Las contraseñas no coincidien')
14
+        telefono: Yup.number('Ingresa únicamente números').required('Tu numero de telefono es requerido')
19
     });
15
     });
20
 
16
 
21
     const formik = useFormik({
17
     const formik = useFormik({
22
-
23
         initialValues: {
18
         initialValues: {
24
-            nit: '',
25
-            cui: '',
26
-            direccion: '',
27
-            nacimiento: new Date(),
28
-            telefono: ''
19
+            nit: client.nit,
20
+            cui: client.cui,
21
+            direccion: client.direccion,
22
+            nacimiento: client.nacimiento,
23
+            telefono: client.telefono
29
         },
24
         },
30
         validationSchema: RegisterSchema,
25
         validationSchema: RegisterSchema,
31
-        onSubmit: async (values) => {
26
+        onSubmit: (values) => {
32
             // setOpen(true);
27
             // setOpen(true);
33
-            let body = {
34
-                "nit": "5345435",
35
-                "cui": "555555",
36
-                "direccion": "4 calle zona 1",
37
-                "fechacumple": "2021-01-01",
38
-                "telefono" : "45435345",
39
-            }
40
-            console.log(values,body)
41
-
42
             // let url = 'http://204.48.25.93:8081/registro'
28
             // let url = 'http://204.48.25.93:8081/registro'
43
             // let url = 'http://psicoadmin.ditca.org:8081/registro'
29
             // let url = 'http://psicoadmin.ditca.org:8081/registro'
30
+            setClient({
31
+                ...client, ...values
32
+            })
44
         }
33
         }
45
-
46
     });
34
     });
47
 
35
 
48
 
36
 
99
                         />
87
                         />
100
                     </Stack>
88
                     </Stack>
101
 
89
 
102
-                  <Box sx={{ mb: 2 }}>
103
-                    <div style={{ paddingTop  : 15}}>
104
-                      <Button
105
-                        type="submit"
106
-                        className="registerBtn" 
107
-                        variant="contained"
108
-                        // onClick={handleNext}
109
-                        sx={{ mt: 1, mr: 1 }}
110
-                      >
111
-                        {props.index === steplen - 1 ? 'Registrarme' : 'Siguiente'}
112
-                      </Button>
113
-                      <Button
114
-                        onClick={props.handleBack}
115
-                        sx={{ mt: 1, mr: 1 }}
116
-                      >
117
-                        Regresar
118
-                      </Button>
119
-                    </div>
120
-                  </Box>
121
-
122
-
123
-
90
+                    <Box sx={{ mb: 2 }}>
91
+                        <div style={{ paddingTop: 15 }}>
92
+                            <Button
93
+                                type="submit"
94
+                                className="registerBtn"
95
+                                variant="contained"
96
+                                // onClick={handleNext}
97
+                                sx={{ mt: 1, mr: 1 }}
98
+                            >
99
+                                {'Registrarme'}
100
+                            </Button>
101
+                            <Button
102
+                                onClick={handleBack}
103
+                                sx={{ mt: 1, mr: 1 }}
104
+                            >
105
+                                Regresar
106
+                            </Button>
107
+                        </div>
108
+                    </Box>
124
 
109
 
125
                 </Stack>
110
                 </Stack>
126
             </Form>
111
             </Form>

+ 10 - 6
src/Components/Register/RegisterForm.jsx

16
 export function RegisterForm(props) {
16
 export function RegisterForm(props) {
17
 
17
 
18
     const steplen = 2;
18
     const steplen = 2;
19
+    const index = 0;
19
 
20
 
20
     const [showPassword, setShowPassword] = useState(false);
21
     const [showPassword, setShowPassword] = useState(false);
21
     const [showPasswordTwo, setShowPasswordTwo] = useState(false);
22
     const [showPasswordTwo, setShowPasswordTwo] = useState(false);
28
         password_confirm: Yup.string().required('Las contraseñas no coincidien').oneOf([Yup.ref('password'), null], 'Las contraseñas no coincidien')
29
         password_confirm: Yup.string().required('Las contraseñas no coincidien').oneOf([Yup.ref('password'), null], 'Las contraseñas no coincidien')
29
     });
30
     });
30
 
31
 
31
-    let {client, setClient } = props
32
+    let {client, setClient, handleNext, handleBack } = props
32
 
33
 
33
     const formik = useFormik({
34
     const formik = useFormik({
34
         initialValues: {
35
         initialValues: {
39
             password_confirm: client.password_confirm
40
             password_confirm: client.password_confirm
40
         },
41
         },
41
         onSubmit: (fields) => {
42
         onSubmit: (fields) => {
42
-            setClient({ ...fields })
43
-            props.handleNext()
43
+            setClient({ 
44
+                ...client,
45
+                ...fields 
46
+            })
47
+            handleNext()
44
         },
48
         },
45
         validationSchema: RegisterSchema,
49
         validationSchema: RegisterSchema,
46
     });
50
     });
123
                         type="submit"
127
                         type="submit"
124
                         className="registerBtn" 
128
                         className="registerBtn" 
125
                         variant="contained"
129
                         variant="contained"
126
-                        // onClick={handleNext}
127
                         sx={{ mt: 1, mr: 1 }}
130
                         sx={{ mt: 1, mr: 1 }}
128
                       >
131
                       >
129
-                        {props.index === steplen - 1 ? 'Registrarme' : 'Siguiente'}
132
+                        {index === steplen - 1 ? 'Registrarme' : 'Siguiente'}
130
                       </Button>
133
                       </Button>
131
                       <Button
134
                       <Button
132
-                        onClick={props.handleBack}
135
+                        disabled={true}
136
+                        onClick={handleBack}
133
                         sx={{ mt: 1, mr: 1 }}
137
                         sx={{ mt: 1, mr: 1 }}
134
                       >
138
                       >
135
                         Regresar
139
                         Regresar

+ 107 - 0
src/Components/Register/temp.js

1
+const SectionStyle = styled(Card)(({ theme }) => ({
2
+    width: '100%',
3
+    maxWidth: 464,
4
+    display: 'flex',
5
+    flexDirection: 'column',
6
+    justifyContent: 'center',
7
+    margin: theme.spacing(2, 0, 2, 2)
8
+}));
9
+
10
+const ContentStyle = styled('div')(({ theme }) => ({
11
+    maxWidth: 480,
12
+    margin: 'auto',
13
+    display: 'flex',
14
+    minHeight: '100vh',
15
+    flexDirection: 'column',
16
+    justifyContent: 'center',
17
+    padding: theme.spacing(12, 0)
18
+}));
19
+
20
+const RootStyle = styled(Page)(({ theme }) => ({
21
+    [theme.breakpoints.up('md')]: {
22
+        display: 'flex'
23
+    }
24
+}));
25
+
26
+function temp () {
27
+    return(
28
+        <RootStyle title="Register | Minimal-UI">
29
+
30
+            <AuthLayout>
31
+                Ya tiene una cuenta?&nbsp;
32
+                <Link to="/login" component={RouterLink}>
33
+                    Ingresa
34
+                </Link>
35
+            </AuthLayout>
36
+
37
+            <SectionStyle>
38
+                <Typography variant="h3" sx={{ px: 5, mt: 10, mb: 5 }}>
39
+                    Efectividad para tus procesos de reclutamiento
40
+                </Typography>
41
+                <img alt="register" src={Mock} />
42
+            </SectionStyle>
43
+
44
+            <Container>
45
+                <ContentStyle>
46
+                    <Box sx={{ mb: 5 }}>
47
+                        <Typography variant="h4" gutterBottom>
48
+                            Empieza de forma gratuita.
49
+                        </Typography>
50
+                        <Typography sx={{ color: 'text.secondary' }}>
51
+                            Gratis para siempre. No se necesita tarjeta de crédito.
52
+                        </Typography>
53
+                    </Box>
54
+
55
+                    <Stepper activeStep={activeStep} orientation="vertical">
56
+                        {steps.map((step, index) => (
57
+                            <Step key={step.label}>
58
+                                <StepLabel
59
+                                    optional={
60
+                                        index === 2 ? (
61
+                                            <Typography variant="caption">Last step</Typography>
62
+                                        ) : null
63
+                                    }
64
+                                >
65
+                                    {step.label}
66
+                                </StepLabel>
67
+                                <StepContent style={{ padding: 25 }}>
68
+                                    {step.description}
69
+                                </StepContent>
70
+                            </Step>
71
+                        ))}
72
+                    </Stepper>
73
+                    {activeStep === steps.length && (
74
+                        <Paper square elevation={0} sx={{ p: 3 }}>
75
+                            <Typography>All steps completed - you&apos;re finished</Typography>
76
+                            <Button onClick={handleReset} sx={{ mt: 1, mr: 1 }}>
77
+                                Reset
78
+                            </Button>
79
+                        </Paper>
80
+                    )}
81
+
82
+                    <Typography variant="body2" align="center" sx={{ color: 'text.secondary', mt: 3 }}>
83
+                        Estoy de acuerdo con las {" "}
84
+                        <Link underline="always" sx={{ color: "#d32f2f" }}>
85
+                            Condiciones de servicio
86
+                        </Link>
87
+                        {" "}y{" "}
88
+                        <Link underline="always" sx={{ color: "#d32f2f" }}>
89
+                            Política de privacidad
90
+                        </Link>
91
+                        .
92
+                    </Typography>
93
+
94
+                    <div>
95
+                        <Typography variant="subtitle2" sx={{ mt: 3, textAlign: 'center' }}>
96
+                            Ya tiene una cuenta?&nbsp;
97
+                            <Link to="/login" component={RouterLink}>
98
+                                Ingresa
99
+                            </Link>
100
+                        </Typography>
101
+                    </div>
102
+                </ContentStyle>
103
+
104
+            </Container>
105
+        </RootStyle>
106
+    )
107
+}

+ 71 - 93
src/Pages/Register.jsx

1
 import * as React from 'react';
1
 import * as React from 'react';
2
 import { Link as RouterLink } from 'react-router-dom';
2
 import { Link as RouterLink } from 'react-router-dom';
3
 
3
 
4
-import { styled } from '@mui/material/styles';
5
 import { 
4
 import { 
6
-    Box, Card, Link, Container, Typography,
5
+    Box, Link, Container, Typography,Card,
7
     StepLabel,Step,Stepper, Button,Paper, StepContent
6
     StepLabel,Step,Stepper, Button,Paper, StepContent
8
 } from '@mui/material';
7
 } from '@mui/material';
9
 
8
 
10
-import Page from '../Components/Register/Page';
11
 import { RegisterForm } from '../Components/Register/RegisterForm';
9
 import { RegisterForm } from '../Components/Register/RegisterForm';
12
 import { PersonalInfo } from '../Components/Register/PersonalInfo.js';
10
 import { PersonalInfo } from '../Components/Register/PersonalInfo.js';
13
 import AuthLayout from '../Components/Register/AuthLayout';
11
 import AuthLayout from '../Components/Register/AuthLayout';
15
 import Mock from  '../Images/register_mok.png'
13
 import Mock from  '../Images/register_mok.png'
16
 import useAuth from '../Auth/useAuth';
14
 import useAuth from '../Auth/useAuth';
17
 import { useNavigate } from 'react-router-dom'
15
 import { useNavigate } from 'react-router-dom'
18
-
19
-const RootStyle = styled(Page)(({ theme }) => ({
20
-    [theme.breakpoints.up('md')]: {
21
-        display: 'flex'
22
-    }
23
-}));
24
-
25
-const SectionStyle = styled(Card)(({ theme }) => ({
26
-    width: '100%',
27
-    maxWidth: 464,
28
-    display: 'flex',
29
-    flexDirection: 'column',
30
-    justifyContent: 'center',
31
-    margin: theme.spacing(2, 0, 2, 2)
32
-}));
33
-
34
-const ContentStyle = styled('div')(({ theme }) => ({
35
-    maxWidth: 480,
36
-    margin: 'auto',
37
-    display: 'flex',
38
-    minHeight: '100vh',
39
-    flexDirection: 'column',
40
-    justifyContent: 'center',
41
-    padding: theme.spacing(12, 0)
42
-}));
16
+import { Col , Row,} from 'react-bootstrap';
43
 
17
 
44
 
18
 
45
 export function Register() {
19
 export function Register() {
55
 
29
 
56
     const [activeStep, setActiveStep] = React.useState(0);
30
     const [activeStep, setActiveStep] = React.useState(0);
57
     const [client, setClient] = React.useState({
31
     const [client, setClient] = React.useState({
58
-        firstName: 'Ming',
32
+        firstName: '',
59
         lastName: '',
33
         lastName: '',
60
         email: '',
34
         email: '',
61
         password: '',
35
         password: '',
62
         password_confirm: '',
36
         password_confirm: '',
63
-        nit: "5345435",
64
-        cui: "555555",
65
-        direccion: "4 calle zona 1",
66
-        fechacumple: "2021-01-01",
67
-        telefono : "45435345",
37
+        nit: "",
38
+        cui: "",
39
+        direccion: "",
40
+        fechacumple: "",
41
+        telefono : "",
68
     });
42
     });
69
 
43
 
70
     const handleNext = () => {
44
     const handleNext = () => {
94
             label: 'Datos Personales',
68
             label: 'Datos Personales',
95
             description: 
69
             description: 
96
             <PersonalInfo 
70
             <PersonalInfo 
97
-            client={client} 
98
-            setClient={setClient} 
71
+            client={client} setClient={setClient} 
99
             handleBack={handleBack}
72
             handleBack={handleBack}
100
             />
73
             />
101
         },
74
         },
102
     ];
75
     ];
103
 
76
 
104
     return (
77
     return (
105
-        <RootStyle title="Register | Minimal-UI">
106
-
107
-            <AuthLayout>
108
-                Ya tiene una cuenta?&nbsp;
109
-                <Link to="/login" component={RouterLink}>
110
-                    Ingresa
111
-                </Link>
112
-            </AuthLayout>
113
-
114
-            <SectionStyle>
115
-                <Typography variant="h3" sx={{ px: 5, mt: 10, mb: 5 }}>
116
-                    Efectividad para tus procesos de reclutamiento
117
-                </Typography>
118
-                <img alt="register" src={Mock} />
119
-            </SectionStyle>
120
-
121
-            <Container>
122
-                <ContentStyle>
78
+        <Container>
79
+            <Row>
80
+                <Col md={4}>
81
+        <Card className="card_register">
82
+
83
+                    <AuthLayout>
84
+
85
+                        <Link to="/login" component={RouterLink}>
86
+
87
+                        </Link>
88
+                    </AuthLayout>
89
+
90
+                    <h1 variant="h3" sx={{ px: 5, mt: 10, mb: 5 }}>
91
+                        Efectividad para tus procesos de reclutamiento
92
+                    </h1>
93
+                    <img alt="register" src={Mock} />
94
+        </Card>
95
+
96
+                </Col>
97
+
98
+        <Col style={{ "padding" : 45}} md={6}>
99
+
123
                     <Box sx={{ mb: 5 }}>
100
                     <Box sx={{ mb: 5 }}>
124
                         <Typography variant="h4" gutterBottom>
101
                         <Typography variant="h4" gutterBottom>
125
                             Empieza de forma gratuita.
102
                             Empieza de forma gratuita.
129
                         </Typography>
106
                         </Typography>
130
                     </Box>
107
                     </Box>
131
 
108
 
132
-
133
                     <Stepper activeStep={activeStep} orientation="vertical">
109
                     <Stepper activeStep={activeStep} orientation="vertical">
134
-    {steps.map((step, index) => (
135
-          <Step key={step.label}>
136
-            <StepLabel
137
-              optional={
138
-                index === 2 ? (
139
-                  <Typography variant="caption">Last step</Typography>
140
-                ) : null
141
-              }
142
-            >
143
-              {step.label}
144
-            </StepLabel>
145
-            <StepContent style={{ padding : 25}}>
146
-                  {step.description}
147
-                </StepContent>
148
-              </Step>
149
-        ))}                    
110
+                        {steps.map((step, index) => (
111
+                            <Step key={step.label}>
112
+                                <StepLabel
113
+                                    optional={
114
+                                        index === 2 ? (
115
+                                            <Typography variant="caption">Last step</Typography>
116
+                                        ) : null
117
+                                    }
118
+                                >
119
+                                    {step.label}
120
+                                </StepLabel>
121
+                                <StepContent style={{ padding: 25 }}>
122
+                                    {step.description}
123
+                                </StepContent>
124
+                            </Step>
125
+                        ))}
150
                     </Stepper>
126
                     </Stepper>
151
- {activeStep === steps.length && (
152
-        <Paper square elevation={0} sx={{ p: 3 }}>
153
-          <Typography>All steps completed - you&apos;re finished</Typography>
154
-          <Button onClick={handleReset} sx={{ mt: 1, mr: 1 }}>
155
-            Reset
156
-          </Button>
157
-        </Paper>
158
-      )}
159
-
160
-        <Typography variant="body2" align="center" sx={{ color: 'text.secondary', mt: 3 }}>
161
-        Estoy de acuerdo con las {" "}
162
-        <Link underline="always" sx={{ color: "#d32f2f" }}>
163
-        Condiciones de servicio
164
-        </Link>
165
-        {" "}y{" "}
166
-        <Link underline="always" sx={{ color: "#d32f2f" }}>
167
-        Política de privacidad
127
+                    {activeStep === steps.length && (
128
+                        <Paper square elevation={0} sx={{ p: 3 }}>
129
+                            <Typography>All steps completed - you&apos;re finished</Typography>
130
+                            <Button onClick={handleReset} sx={{ mt: 1, mr: 1 }}>
131
+                                Reset
132
+                            </Button>
133
+                        </Paper>
134
+                    )}
135
+
136
+                    <div>
137
+                    <Typography variant="body2" align="center" sx={{ color: 'text.secondary', mt: 0 }}>
138
+                        Estoy de acuerdo con las {" "}
139
+                        <Link underline="always" sx={{ color: "#d32f2f" }}>
140
+                            Condiciones de servicio
141
+                        </Link>
142
+                        {" "}y{" "}
143
+                        <Link underline="always" sx={{ color: "#d32f2f" }}>
144
+                            Política de privacidad
168
                         </Link>
145
                         </Link>
169
                         .
146
                         .
170
                     </Typography>
147
                     </Typography>
171
 
148
 
172
-                    <div>
173
-                        <Typography variant="subtitle2" sx={{ mt: 3, textAlign: 'center' }}>
149
+                        <Typography variant="subtitle2" sx={{ mt: 0, textAlign: 'center' }}>
174
                             Ya tiene una cuenta?&nbsp;
150
                             Ya tiene una cuenta?&nbsp;
175
                             <Link to="/login" component={RouterLink}>
151
                             <Link to="/login" component={RouterLink}>
176
                                 Ingresa
152
                                 Ingresa
177
                             </Link>
153
                             </Link>
178
                         </Typography>
154
                         </Typography>
179
                     </div>
155
                     </div>
180
-                </ContentStyle>
181
-            </Container>
182
-        </RootStyle>
156
+
157
+            
158
+                </Col>
159
+            </Row>
160
+        </Container>
183
     );
161
     );
184
 }
162
 }