|
@@ -20,23 +20,34 @@ export function StepOne(props) {
|
20
|
20
|
};
|
21
|
21
|
|
22
|
22
|
const CandidatoSchema = Yup.object().shape({
|
23
|
|
- firstName: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado largo!'),
|
24
|
|
- lastName: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
|
25
|
|
- puesto: Yup.string(),
|
26
|
|
- niveles_educativo: Yup.number(),
|
|
23
|
+ firstName:
|
|
24
|
+ Yup.string()
|
|
25
|
+ .min(2, 'Demasiado corto!')
|
|
26
|
+ .max(50, 'Demasiado largo!')
|
|
27
|
+ .required("Ingresa un nombre válido"),
|
|
28
|
+ lastName:
|
|
29
|
+ Yup.string()
|
|
30
|
+ .required("Ingresa un apellido valido")
|
|
31
|
+ .min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
|
|
32
|
+ puesto:
|
|
33
|
+ Yup.string()
|
|
34
|
+ .required("Ingrea un puesto valido"),
|
|
35
|
+ niveles_educativo:
|
|
36
|
+ Yup.number('Ingresa un valor valido')
|
|
37
|
+ .required('Ingresa un nivel educativo válido'),
|
27
|
38
|
});
|
28
|
39
|
|
29
|
|
- let { handleNext, handleBack } = props
|
|
40
|
+ let { handleNext, handleBack, password, setPassword } = props
|
30
|
41
|
|
31
|
42
|
const formik = useFormik({
|
32
|
43
|
initialValues: {
|
33
|
|
- firstName: '',
|
34
|
|
- lastName: '',
|
35
|
|
- puesto: '',
|
36
|
|
- niveles_educativo: 0,
|
|
44
|
+ firstName: password.firstName ,
|
|
45
|
+ lastName: password.lastName,
|
|
46
|
+ puesto: password.puesto,
|
|
47
|
+ niveles_educativo: password.niveles_educativo,
|
37
|
48
|
},
|
38
|
49
|
onSubmit: (fields) => {
|
39
|
|
- console.log('SUBMIT > ',fields)
|
|
50
|
+ setPassword({...password, ...fields})
|
40
|
51
|
handleNext()
|
41
|
52
|
},
|
42
|
53
|
validationSchema: CandidatoSchema,
|
|
@@ -84,8 +95,7 @@ export function StepOne(props) {
|
84
|
95
|
label="Nivel Educativo"
|
85
|
96
|
onChange={changeNivelEducativo}
|
86
|
97
|
{...getFieldProps('niveles_educativo')}
|
87
|
|
- error={Boolean(touched.niveles_educativo && errors.niveles_educativo)}
|
88
|
|
- >
|
|
98
|
+ error={Boolean(touched.niveles_educativo && errors.niveles_educativo)} >
|
89
|
99
|
{
|
90
|
100
|
niveles_educativos.map( ( nivel, index ) => {
|
91
|
101
|
return (
|