Explorar el Código

maqueta stepper form

amenpunk hace 2 años
padre
commit
09574ffe23

+ 5 - 11
src/Components/Modal/PasswordModal.jsx

@@ -8,7 +8,7 @@ import {
8 8
 
9 9
 import { Puesto } from '../Password/Steps/puesto'
10 10
 import { Password } from '../Password/Steps/password'
11
-import { StepFour } from '../Password/Steps/four'
11
+import { Candidato } from '../Password/Steps/candidato'
12 12
 
13 13
 export function HelpModal(props) {
14 14
 
@@ -51,7 +51,7 @@ export function HelpModal(props) {
51 51
 
52 52
     const steps = [
53 53
         {
54
-            label: 'Selecciona un Puesto',
54
+            label: 'Puesto',
55 55
             operation:
56 56
                 <Puesto
57 57
                     handleNext={handleNext}
@@ -71,9 +71,9 @@ export function HelpModal(props) {
71 71
                 />
72 72
         },
73 73
         {
74
-            label: 'Seleccionar pruebas',
74
+            label: 'Candidato',
75 75
             operation:
76
-                <Puesto
76
+                <Candidato
77 77
                     handleNext={handleNext}
78 78
                     handleBack={handleBack}
79 79
                     password={password}
@@ -82,13 +82,7 @@ export function HelpModal(props) {
82 82
         },
83 83
         {
84 84
             label: 'Confirmar',
85
-            operation:
86
-                <StepFour
87
-                    handleNext={handleNext}
88
-                    handleBack={handleBack}
89
-                    password={password}
90
-                    setPassword={setPassword}
91
-                />
85
+            operation: <h1>guardar</h1>
92 86
         },
93 87
     ];
94 88
 

+ 69 - 64
src/Components/Password/Steps/candidato.jsx

@@ -1,63 +1,53 @@
1 1
 import React from 'react'
2 2
 import * as Yup from 'yup';
3
-import { useState } from 'react';
4 3
 import { useFormik, Form, FormikProvider } from 'formik';
5 4
 
6
-import {  
7
-    Box, Button,
8
-    Stack, TextField, 
9
-    InputLabel,MenuItem,FormControl,Select
5
+import {
6
+    Box, Button, FormControlLabel, Checkbox,
7
+    Stack, TextField, FormGroup,
10 8
 } from '@mui/material';
11 9
 
12
-import { niveles_educativos } from '../Rows'
13
-
14 10
 
15 11
 export function Candidato(props) {
16 12
 
17
-    const [educativo, setEducativo] = useState('');
18
-
19
-    const changeNivelEducativo = (event) => {
20
-        setEducativo(event.target.value);
21
-    };
22
-
23 13
     const CandidatoSchema = Yup.object().shape({
24
-        firstName: 
25
-        Yup.string()
26
-        .min(2, 'Demasiado corto!')
27
-        .max(50, 'Demasiado largo!')
28
-        .required("Ingresa un nombre válido"),
29
-        lastName: 
30
-        Yup.string()
31
-        .required("Ingresa un apellido válido")
32
-        .min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
33
-        puesto: 
34
-        Yup.string()
35
-        .required("Ingrea un puesto válido"),
36
-        niveles_educativo: 
37
-        Yup.number('Ingresa un valor válido')
38
-        .required('Ingresa un nivel educativo válido'),
14
+        firstName:
15
+            Yup.string()
16
+                .min(2, 'Demasiado corto!')
17
+                .max(50, 'Demasiado largo!')
18
+                .required("Ingresa un nombre válido"),
19
+        lastName:
20
+            Yup.string()
21
+                .required("Ingresa un apellido válido")
22
+                .min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
23
+        puesto:
24
+            Yup.string()
25
+                .required("Ingrea un puesto válido"),
26
+        niveles_educativo:
27
+            Yup.number('Ingresa un valor válido')
28
+                .required('Ingresa un nivel educativo válido'),
39 29
     });
40 30
 
41
-    let {  handleNext, handleBack, password, setPassword } = props
31
+    let { handleNext, handleBack, password, setPassword } = props
42 32
 
43 33
     const formik = useFormik({
44 34
         initialValues: {
45
-            firstName: password.firstName ,
35
+            firstName: password.firstName,
46 36
             lastName: password.lastName,
47 37
             puesto: password.puesto,
48 38
             niveles_educativo: password.niveles_educativo,
49 39
         },
50 40
         onSubmit: (fields) => {
51
-            setPassword({...password, ...fields})
41
+            setPassword({ ...password, ...fields })
52 42
             handleNext()
53 43
         },
54 44
         validationSchema: CandidatoSchema,
55 45
     });
56 46
 
57
-    const {errors, touched, handleSubmit, getFieldProps } = formik;
47
+    const { errors, touched, handleSubmit, getFieldProps } = formik;
58 48
 
59 49
     return (
60
-        <FormikProvider style={{ padding : 25 }} value={formik}>
50
+        <FormikProvider style={{ padding: 25 }} value={formik}>
61 51
             <Form autoComplete="off" noValidate onSubmit={handleSubmit}>
62 52
                 <Stack spacing={3}>
63 53
                     <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
@@ -67,7 +57,7 @@ export function Candidato(props) {
67 57
                             {...getFieldProps('firstName')}
68 58
                             error={Boolean(touched.firstName && errors.firstName)}
69 59
                             helperText={touched.firstName && errors.firstName}
70
-                            />
60
+                        />
71 61
 
72 62
                         <TextField
73 63
                             label="Apellidos"
@@ -75,51 +65,66 @@ export function Candidato(props) {
75 65
                             {...getFieldProps('lastName')}
76 66
                             error={Boolean(touched.lastName && errors.lastName)}
77 67
                             helperText={touched.lastName && errors.lastName}
78
-                            />
68
+                        />
79 69
                     </Stack>
80 70
 
81
-                    <TextField
82
-                        fullWidth
83
-                        type="text"
84
-                        label="Experiencia laboral o puesto"
85
-                        {...getFieldProps('puesto')}
86
-                        error={Boolean(touched.puesto && errors.puesto)}
87
-                        helperText={touched.puesto && errors.puesto}
71
+                    <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
72
+                        <TextField
73
+                            fullWidth
74
+                            type="text"
75
+                            label="Correo Electronico"
76
+                            {...getFieldProps('puesto')}
77
+                            error={Boolean(touched.puesto && errors.puesto)}
78
+                            helperText={touched.puesto && errors.puesto}
88 79
                         />
80
+                        <FormGroup>
81
+
82
+                            <FormControlLabel
83
+                                control={
84
+                                    <Checkbox
85
+                                        defaultChecked
86
+                                        color="default"
87
+                                    />
88
+                                }
89
+                                label="Enviar Correo"
90
+                            />
91
+                        </FormGroup>
92
+                    </Stack>
93
+
94
+
89 95
 
90
-                    <FormControl fullWidth>
91
-                        <InputLabel id="demo-simple-select-label">Nivel Educativo</InputLabel>
92
-                        <Select
93
-                            labelId="demo-simple-select-label"
94
-                            id="demo-simple-select"
95
-                            value={educativo}
96
-                            label="Nivel Educativo"
97
-                            onChange={changeNivelEducativo}
98
-                            {...getFieldProps('niveles_educativo')}
99
-                            error={Boolean(touched.niveles_educativo && errors.niveles_educativo)} >
100
-                            {
101
-                                niveles_educativos.map( ( nivel, index ) => {
102
-                                return (
103
-                                    <MenuItem key={nivel} value={index}>{nivel}</MenuItem>
104
-                                )
105
-                            })
106
-                        }
107
-                        </Select>
108
-                    </FormControl>
96
+                    <Stack direction={{ xs: 'column', sm: 'row' }} spacing={4}>
97
+                        <TextField
98
+                            fullWidth
99
+                            type="text"
100
+                            label="Puesto"
101
+                            {...getFieldProps('puesto')}
102
+                            error={Boolean(touched.puesto && errors.puesto)}
103
+                            helperText={touched.puesto && errors.puesto}
104
+                        />
105
+                        <TextField
106
+                            fullWidth
107
+                            type="text"
108
+                            label="Empresa"
109
+                            {...getFieldProps('puesto')}
110
+                            error={Boolean(touched.puesto && errors.puesto)}
111
+                            helperText={touched.puesto && errors.puesto}
112
+                        />
113
+                    </Stack>
109 114
 
110 115
 
111 116
                     <Box sx={{ mb: 2 }}>
112
-                        <div style={{ paddingTop  : 15}}>
117
+                        <div style={{ paddingTop: 15 }}>
113 118
                             <Button
114 119
                                 type="submit"
115
-                                className="registerBtn" 
120
+                                className="registerBtn"
116 121
                                 variant="contained"
117 122
                                 sx={{ mt: 1, mr: 1 }}
118 123
                             >
119 124
                                 {'Siguiente'}
120 125
                             </Button>
121 126
                             <Button
122
-                                disabled={true}
127
+                                disabled={false}
123 128
                                 onClick={handleBack}
124 129
                                 sx={{ mt: 1, mr: 1 }}
125 130
                             >

+ 1 - 9
src/Components/Password/Steps/password.jsx

@@ -1,27 +1,18 @@
1 1
 import React from 'react'
2 2
 import * as Yup from 'yup';
3
-import { useState } from 'react';
4 3
 import { useFormik, Form, FormikProvider } from 'formik';
5 4
 
6 5
 import {  
7 6
     Box, Button,
8 7
     Stack, TextField, 
9
-    InputLabel,MenuItem,FormControl,Select
10 8
 } from '@mui/material';
11 9
 
12 10
 import DateFnsUtils from '@date-io/date-fns';
13 11
 import { DesktopDatePicker, LocalizationProvider } from '@mui/lab';
14 12
 
15
-import { niveles_educativos } from '../Rows'
16 13
 
17 14
 export function Password(props) {
18 15
 
19
-    const [educativo, setEducativo] = useState('');
20
-
21
-    const changeNivelEducativo = (event) => {
22
-        setEducativo(event.target.value);
23
-    };
24
-
25 16
     const PasswordSchema = Yup.object().shape({
26 17
         pwd: 
27 18
         Yup
@@ -34,6 +25,7 @@ export function Password(props) {
34 25
     });
35 26
 
36 27
     let {  handleNext, handleBack, password, setPassword } = props
28
+    console.log(password, setPassword)
37 29
 
38 30
     const formik = useFormik({
39 31
         initialValues: {

+ 1 - 18
src/Components/Password/Steps/puesto.js

@@ -116,7 +116,7 @@ export function Puesto(props) {
116 116
                                 {'Siguiente'}
117 117
                             </Button>
118 118
                             <Button
119
-                                disabled={false}
119
+                                disabled={true}
120 120
                                 onClick={handleBack}
121 121
                                 sx={{ mt: 1, mr: 1 }}
122 122
                             >
@@ -130,20 +130,3 @@ export function Puesto(props) {
130 130
         </FormikProvider>
131 131
     );
132 132
 }
133
-const top100Films = [
134
-    { label: 'City of God', year: 2002 },
135
-    { label: 'Se7en', year: 1995 },
136
-    { label: 'The Silence of the Lambs', year: 1991 },
137
-    { label: "It's a Wonderful Life", year: 1946 },
138
-    { label: 'Life Is Beautiful', year: 1997 },
139
-    { label: 'The Usual Suspects', year: 1995 },
140
-    { label: 'Grave of the Fireflies', year: 1988 },
141
-    { label: 'Paths of Glory', year: 1957 },
142
-    { label: 'Django Unchained', year: 2012 },
143
-    { label: 'The Shining', year: 1980 },
144
-    { label: 'WALL·E', year: 2008 },
145
-    { label: 'American Beauty', year: 1999 },
146
-    { label: 'The Dark Knight Rises', year: 2012 },
147
-];
148
-
149
-