Browse Source

maqueta stepper form

amenpunk 2 years ago
parent
commit
09574ffe23

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

8
 
8
 
9
 import { Puesto } from '../Password/Steps/puesto'
9
 import { Puesto } from '../Password/Steps/puesto'
10
 import { Password } from '../Password/Steps/password'
10
 import { Password } from '../Password/Steps/password'
11
-import { StepFour } from '../Password/Steps/four'
11
+import { Candidato } from '../Password/Steps/candidato'
12
 
12
 
13
 export function HelpModal(props) {
13
 export function HelpModal(props) {
14
 
14
 
51
 
51
 
52
     const steps = [
52
     const steps = [
53
         {
53
         {
54
-            label: 'Selecciona un Puesto',
54
+            label: 'Puesto',
55
             operation:
55
             operation:
56
                 <Puesto
56
                 <Puesto
57
                     handleNext={handleNext}
57
                     handleNext={handleNext}
71
                 />
71
                 />
72
         },
72
         },
73
         {
73
         {
74
-            label: 'Seleccionar pruebas',
74
+            label: 'Candidato',
75
             operation:
75
             operation:
76
-                <Puesto
76
+                <Candidato
77
                     handleNext={handleNext}
77
                     handleNext={handleNext}
78
                     handleBack={handleBack}
78
                     handleBack={handleBack}
79
                     password={password}
79
                     password={password}
82
         },
82
         },
83
         {
83
         {
84
             label: 'Confirmar',
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
 import React from 'react'
1
 import React from 'react'
2
 import * as Yup from 'yup';
2
 import * as Yup from 'yup';
3
-import { useState } from 'react';
4
 import { useFormik, Form, FormikProvider } from 'formik';
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
 } from '@mui/material';
8
 } from '@mui/material';
11
 
9
 
12
-import { niveles_educativos } from '../Rows'
13
-
14
 
10
 
15
 export function Candidato(props) {
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
     const CandidatoSchema = Yup.object().shape({
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
     const formik = useFormik({
33
     const formik = useFormik({
44
         initialValues: {
34
         initialValues: {
45
-            firstName: password.firstName ,
35
+            firstName: password.firstName,
46
             lastName: password.lastName,
36
             lastName: password.lastName,
47
             puesto: password.puesto,
37
             puesto: password.puesto,
48
             niveles_educativo: password.niveles_educativo,
38
             niveles_educativo: password.niveles_educativo,
49
         },
39
         },
50
         onSubmit: (fields) => {
40
         onSubmit: (fields) => {
51
-            setPassword({...password, ...fields})
41
+            setPassword({ ...password, ...fields })
52
             handleNext()
42
             handleNext()
53
         },
43
         },
54
         validationSchema: CandidatoSchema,
44
         validationSchema: CandidatoSchema,
55
     });
45
     });
56
 
46
 
57
-    const {errors, touched, handleSubmit, getFieldProps } = formik;
47
+    const { errors, touched, handleSubmit, getFieldProps } = formik;
58
 
48
 
59
     return (
49
     return (
60
-        <FormikProvider style={{ padding : 25 }} value={formik}>
50
+        <FormikProvider style={{ padding: 25 }} value={formik}>
61
             <Form autoComplete="off" noValidate onSubmit={handleSubmit}>
51
             <Form autoComplete="off" noValidate onSubmit={handleSubmit}>
62
                 <Stack spacing={3}>
52
                 <Stack spacing={3}>
63
                     <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
53
                     <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
67
                             {...getFieldProps('firstName')}
57
                             {...getFieldProps('firstName')}
68
                             error={Boolean(touched.firstName && errors.firstName)}
58
                             error={Boolean(touched.firstName && errors.firstName)}
69
                             helperText={touched.firstName && errors.firstName}
59
                             helperText={touched.firstName && errors.firstName}
70
-                            />
60
+                        />
71
 
61
 
72
                         <TextField
62
                         <TextField
73
                             label="Apellidos"
63
                             label="Apellidos"
75
                             {...getFieldProps('lastName')}
65
                             {...getFieldProps('lastName')}
76
                             error={Boolean(touched.lastName && errors.lastName)}
66
                             error={Boolean(touched.lastName && errors.lastName)}
77
                             helperText={touched.lastName && errors.lastName}
67
                             helperText={touched.lastName && errors.lastName}
78
-                            />
68
+                        />
79
                     </Stack>
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
                     <Box sx={{ mb: 2 }}>
116
                     <Box sx={{ mb: 2 }}>
112
-                        <div style={{ paddingTop  : 15}}>
117
+                        <div style={{ paddingTop: 15 }}>
113
                             <Button
118
                             <Button
114
                                 type="submit"
119
                                 type="submit"
115
-                                className="registerBtn" 
120
+                                className="registerBtn"
116
                                 variant="contained"
121
                                 variant="contained"
117
                                 sx={{ mt: 1, mr: 1 }}
122
                                 sx={{ mt: 1, mr: 1 }}
118
                             >
123
                             >
119
                                 {'Siguiente'}
124
                                 {'Siguiente'}
120
                             </Button>
125
                             </Button>
121
                             <Button
126
                             <Button
122
-                                disabled={true}
127
+                                disabled={false}
123
                                 onClick={handleBack}
128
                                 onClick={handleBack}
124
                                 sx={{ mt: 1, mr: 1 }}
129
                                 sx={{ mt: 1, mr: 1 }}
125
                             >
130
                             >

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

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

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

116
                                 {'Siguiente'}
116
                                 {'Siguiente'}
117
                             </Button>
117
                             </Button>
118
                             <Button
118
                             <Button
119
-                                disabled={false}
119
+                                disabled={true}
120
                                 onClick={handleBack}
120
                                 onClick={handleBack}
121
                                 sx={{ mt: 1, mr: 1 }}
121
                                 sx={{ mt: 1, mr: 1 }}
122
                             >
122
                             >
130
         </FormikProvider>
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
-