|
@@ -11,17 +11,20 @@ import {
|
|
|
export function StepTwo(props) {
|
|
export function StepTwo(props) {
|
|
|
|
|
|
|
|
const PlazaScheme = Yup.object().shape({
|
|
const PlazaScheme = Yup.object().shape({
|
|
|
- puesto: Yup.object().required('Escoge un puesto valido')
|
|
|
|
|
|
|
+ puesto_id:
|
|
|
|
|
+ Yup.number()
|
|
|
|
|
+ .positive('Escoge un puesto válido')
|
|
|
|
|
+ .required('Escoge un puesto válido')
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- let { handleNext, handleBack } = props
|
|
|
|
|
|
|
+ let { handleNext, handleBack, password, setPassword } = props
|
|
|
|
|
|
|
|
const formik = useFormik({
|
|
const formik = useFormik({
|
|
|
initialValues: {
|
|
initialValues: {
|
|
|
- puesto: {}
|
|
|
|
|
|
|
+ puesto_id: password.puesto_id
|
|
|
},
|
|
},
|
|
|
onSubmit: (fields) => {
|
|
onSubmit: (fields) => {
|
|
|
- console.log('SUBMIT > ',fields)
|
|
|
|
|
|
|
+ setPassword({...password, ...fields})
|
|
|
handleNext()
|
|
handleNext()
|
|
|
},
|
|
},
|
|
|
validationSchema: PlazaScheme,
|
|
validationSchema: PlazaScheme,
|
|
@@ -30,10 +33,11 @@ export function StepTwo(props) {
|
|
|
const [age, setAge] = React.useState('');
|
|
const [age, setAge] = React.useState('');
|
|
|
|
|
|
|
|
const handleChange = (event) => {
|
|
const handleChange = (event) => {
|
|
|
|
|
+ console.log("Edad -> ",event.target.value)
|
|
|
setAge(event.target.value);
|
|
setAge(event.target.value);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const { handleSubmit,} = formik;
|
|
|
|
|
|
|
+ const { handleSubmit, touched, errors, getFieldProps } = formik;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<FormikProvider style={{ padding : 25 }} value={formik}>
|
|
<FormikProvider style={{ padding : 25 }} value={formik}>
|
|
@@ -48,13 +52,17 @@ export function StepTwo(props) {
|
|
|
value={age}
|
|
value={age}
|
|
|
label="Puestos"
|
|
label="Puestos"
|
|
|
onChange={handleChange}
|
|
onChange={handleChange}
|
|
|
|
|
+ {...getFieldProps('puesto_id')}
|
|
|
|
|
+ error={Boolean(touched.puesto_id && errors.puesto_id)}
|
|
|
>
|
|
>
|
|
|
- <MenuItem value={10}>Ten</MenuItem>
|
|
|
|
|
- <MenuItem value={20}>Twenty</MenuItem>
|
|
|
|
|
- <MenuItem value={30}>Thirty</MenuItem>
|
|
|
|
|
|
|
+ <MenuItem value={10}>Full Stack</MenuItem>
|
|
|
|
|
+ <MenuItem value={20}>Web Developer</MenuItem>
|
|
|
|
|
+ <MenuItem value={30}>Database Administrator</MenuItem>
|
|
|
</Select>
|
|
</Select>
|
|
|
</FormControl>
|
|
</FormControl>
|
|
|
-
|
|
|
|
|
|
|
+ <label className="feedback_error">
|
|
|
|
|
+ {touched.puesto_id && errors.puesto_id}
|
|
|
|
|
+ </label>
|
|
|
<Box sx={{ mb: 2 }}>
|
|
<Box sx={{ mb: 2 }}>
|
|
|
<div style={{ paddingTop : 15}}>
|
|
<div style={{ paddingTop : 15}}>
|
|
|
<Button
|
|
<Button
|