|
@@ -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
|
>
|