|
|
@@ -20,23 +20,34 @@ export function StepOne(props) {
|
|
|
};
|
|
|
|
|
|
const CandidatoSchema = Yup.object().shape({
|
|
|
- firstName: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado largo!'),
|
|
|
- lastName: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
|
|
|
- puesto: Yup.string(),
|
|
|
- niveles_educativo: Yup.number(),
|
|
|
+ firstName:
|
|
|
+ Yup.string()
|
|
|
+ .min(2, 'Demasiado corto!')
|
|
|
+ .max(50, 'Demasiado largo!')
|
|
|
+ .required("Ingresa un nombre válido"),
|
|
|
+ lastName:
|
|
|
+ Yup.string()
|
|
|
+ .required("Ingresa un apellido valido")
|
|
|
+ .min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
|
|
|
+ puesto:
|
|
|
+ Yup.string()
|
|
|
+ .required("Ingrea un puesto valido"),
|
|
|
+ niveles_educativo:
|
|
|
+ Yup.number('Ingresa un valor valido')
|
|
|
+ .required('Ingresa un nivel educativo válido'),
|
|
|
});
|
|
|
|
|
|
- let { handleNext, handleBack } = props
|
|
|
+ let { handleNext, handleBack, password, setPassword } = props
|
|
|
|
|
|
const formik = useFormik({
|
|
|
initialValues: {
|
|
|
- firstName: '',
|
|
|
- lastName: '',
|
|
|
- puesto: '',
|
|
|
- niveles_educativo: 0,
|
|
|
+ firstName: password.firstName ,
|
|
|
+ lastName: password.lastName,
|
|
|
+ puesto: password.puesto,
|
|
|
+ niveles_educativo: password.niveles_educativo,
|
|
|
},
|
|
|
onSubmit: (fields) => {
|
|
|
- console.log('SUBMIT > ',fields)
|
|
|
+ setPassword({...password, ...fields})
|
|
|
handleNext()
|
|
|
},
|
|
|
validationSchema: CandidatoSchema,
|
|
|
@@ -84,8 +95,7 @@ export function StepOne(props) {
|
|
|
label="Nivel Educativo"
|
|
|
onChange={changeNivelEducativo}
|
|
|
{...getFieldProps('niveles_educativo')}
|
|
|
- error={Boolean(touched.niveles_educativo && errors.niveles_educativo)}
|
|
|
- >
|
|
|
+ error={Boolean(touched.niveles_educativo && errors.niveles_educativo)} >
|
|
|
{
|
|
|
niveles_educativos.map( ( nivel, index ) => {
|
|
|
return (
|