|
@@ -1,63 +1,53 @@
|
|
|
import React from 'react'
|
|
import React from 'react'
|
|
|
import * as Yup from 'yup';
|
|
import * as Yup from 'yup';
|
|
|
-import { useState } from 'react';
|
|
|
|
|
import { useFormik, Form, FormikProvider } from 'formik';
|
|
import { useFormik, Form, FormikProvider } from 'formik';
|
|
|
|
|
|
|
|
-import {
|
|
|
|
|
- Box, Button,
|
|
|
|
|
- Stack, TextField,
|
|
|
|
|
- InputLabel,MenuItem,FormControl,Select
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ Box, Button, FormControlLabel, Checkbox,
|
|
|
|
|
+ Stack, TextField, FormGroup,
|
|
|
} from '@mui/material';
|
|
} from '@mui/material';
|
|
|
|
|
|
|
|
-import { niveles_educativos } from '../Rows'
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
export function Candidato(props) {
|
|
export function Candidato(props) {
|
|
|
|
|
|
|
|
- const [educativo, setEducativo] = useState('');
|
|
|
|
|
-
|
|
|
|
|
- const changeNivelEducativo = (event) => {
|
|
|
|
|
- setEducativo(event.target.value);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
const CandidatoSchema = Yup.object().shape({
|
|
const CandidatoSchema = Yup.object().shape({
|
|
|
- firstName:
|
|
|
|
|
- Yup.string()
|
|
|
|
|
- .min(2, 'Demasiado corto!')
|
|
|
|
|
- .max(50, 'Demasiado largo!')
|
|
|
|
|
- .required("Ingresa un nombre válido"),
|
|
|
|
|
- lastName:
|
|
|
|
|
- Yup.string()
|
|
|
|
|
- .required("Ingresa un apellido válido")
|
|
|
|
|
- .min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
|
|
|
|
|
- puesto:
|
|
|
|
|
- Yup.string()
|
|
|
|
|
- .required("Ingrea un puesto válido"),
|
|
|
|
|
- niveles_educativo:
|
|
|
|
|
- Yup.number('Ingresa un valor válido')
|
|
|
|
|
- .required('Ingresa un nivel educativo válido'),
|
|
|
|
|
|
|
+ firstName:
|
|
|
|
|
+ Yup.string()
|
|
|
|
|
+ .min(2, 'Demasiado corto!')
|
|
|
|
|
+ .max(50, 'Demasiado largo!')
|
|
|
|
|
+ .required("Ingresa un nombre válido"),
|
|
|
|
|
+ lastName:
|
|
|
|
|
+ Yup.string()
|
|
|
|
|
+ .required("Ingresa un apellido válido")
|
|
|
|
|
+ .min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
|
|
|
|
|
+ puesto:
|
|
|
|
|
+ Yup.string()
|
|
|
|
|
+ .required("Ingrea un puesto válido"),
|
|
|
|
|
+ niveles_educativo:
|
|
|
|
|
+ Yup.number('Ingresa un valor válido')
|
|
|
|
|
+ .required('Ingresa un nivel educativo válido'),
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- let { handleNext, handleBack, password, setPassword } = props
|
|
|
|
|
|
|
+ let { handleNext, handleBack, password, setPassword } = props
|
|
|
|
|
|
|
|
const formik = useFormik({
|
|
const formik = useFormik({
|
|
|
initialValues: {
|
|
initialValues: {
|
|
|
- firstName: password.firstName ,
|
|
|
|
|
|
|
+ firstName: password.firstName,
|
|
|
lastName: password.lastName,
|
|
lastName: password.lastName,
|
|
|
puesto: password.puesto,
|
|
puesto: password.puesto,
|
|
|
niveles_educativo: password.niveles_educativo,
|
|
niveles_educativo: password.niveles_educativo,
|
|
|
},
|
|
},
|
|
|
onSubmit: (fields) => {
|
|
onSubmit: (fields) => {
|
|
|
- setPassword({...password, ...fields})
|
|
|
|
|
|
|
+ setPassword({ ...password, ...fields })
|
|
|
handleNext()
|
|
handleNext()
|
|
|
},
|
|
},
|
|
|
validationSchema: CandidatoSchema,
|
|
validationSchema: CandidatoSchema,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- const {errors, touched, handleSubmit, getFieldProps } = formik;
|
|
|
|
|
|
|
+ const { errors, touched, handleSubmit, getFieldProps } = formik;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <FormikProvider style={{ padding : 25 }} value={formik}>
|
|
|
|
|
|
|
+ <FormikProvider style={{ padding: 25 }} value={formik}>
|
|
|
<Form autoComplete="off" noValidate onSubmit={handleSubmit}>
|
|
<Form autoComplete="off" noValidate onSubmit={handleSubmit}>
|
|
|
<Stack spacing={3}>
|
|
<Stack spacing={3}>
|
|
|
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
|
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
|
@@ -67,7 +57,7 @@ export function Candidato(props) {
|
|
|
{...getFieldProps('firstName')}
|
|
{...getFieldProps('firstName')}
|
|
|
error={Boolean(touched.firstName && errors.firstName)}
|
|
error={Boolean(touched.firstName && errors.firstName)}
|
|
|
helperText={touched.firstName && errors.firstName}
|
|
helperText={touched.firstName && errors.firstName}
|
|
|
- />
|
|
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
<TextField
|
|
<TextField
|
|
|
label="Apellidos"
|
|
label="Apellidos"
|
|
@@ -75,51 +65,66 @@ export function Candidato(props) {
|
|
|
{...getFieldProps('lastName')}
|
|
{...getFieldProps('lastName')}
|
|
|
error={Boolean(touched.lastName && errors.lastName)}
|
|
error={Boolean(touched.lastName && errors.lastName)}
|
|
|
helperText={touched.lastName && errors.lastName}
|
|
helperText={touched.lastName && errors.lastName}
|
|
|
- />
|
|
|
|
|
|
|
+ />
|
|
|
</Stack>
|
|
</Stack>
|
|
|
|
|
|
|
|
- <TextField
|
|
|
|
|
- fullWidth
|
|
|
|
|
- type="text"
|
|
|
|
|
- label="Experiencia laboral o puesto"
|
|
|
|
|
- {...getFieldProps('puesto')}
|
|
|
|
|
- error={Boolean(touched.puesto && errors.puesto)}
|
|
|
|
|
- helperText={touched.puesto && errors.puesto}
|
|
|
|
|
|
|
+ <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
|
|
|
|
+ <TextField
|
|
|
|
|
+ fullWidth
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ label="Correo Electronico"
|
|
|
|
|
+ {...getFieldProps('puesto')}
|
|
|
|
|
+ error={Boolean(touched.puesto && errors.puesto)}
|
|
|
|
|
+ helperText={touched.puesto && errors.puesto}
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <FormGroup>
|
|
|
|
|
+
|
|
|
|
|
+ <FormControlLabel
|
|
|
|
|
+ control={
|
|
|
|
|
+ <Checkbox
|
|
|
|
|
+ defaultChecked
|
|
|
|
|
+ color="default"
|
|
|
|
|
+ />
|
|
|
|
|
+ }
|
|
|
|
|
+ label="Enviar Correo"
|
|
|
|
|
+ />
|
|
|
|
|
+ </FormGroup>
|
|
|
|
|
+ </Stack>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- <FormControl fullWidth>
|
|
|
|
|
- <InputLabel id="demo-simple-select-label">Nivel Educativo</InputLabel>
|
|
|
|
|
- <Select
|
|
|
|
|
- labelId="demo-simple-select-label"
|
|
|
|
|
- id="demo-simple-select"
|
|
|
|
|
- value={educativo}
|
|
|
|
|
- label="Nivel Educativo"
|
|
|
|
|
- onChange={changeNivelEducativo}
|
|
|
|
|
- {...getFieldProps('niveles_educativo')}
|
|
|
|
|
- error={Boolean(touched.niveles_educativo && errors.niveles_educativo)} >
|
|
|
|
|
- {
|
|
|
|
|
- niveles_educativos.map( ( nivel, index ) => {
|
|
|
|
|
- return (
|
|
|
|
|
- <MenuItem key={nivel} value={index}>{nivel}</MenuItem>
|
|
|
|
|
- )
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- </Select>
|
|
|
|
|
- </FormControl>
|
|
|
|
|
|
|
+ <Stack direction={{ xs: 'column', sm: 'row' }} spacing={4}>
|
|
|
|
|
+ <TextField
|
|
|
|
|
+ fullWidth
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ label="Puesto"
|
|
|
|
|
+ {...getFieldProps('puesto')}
|
|
|
|
|
+ error={Boolean(touched.puesto && errors.puesto)}
|
|
|
|
|
+ helperText={touched.puesto && errors.puesto}
|
|
|
|
|
+ />
|
|
|
|
|
+ <TextField
|
|
|
|
|
+ fullWidth
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ label="Empresa"
|
|
|
|
|
+ {...getFieldProps('puesto')}
|
|
|
|
|
+ error={Boolean(touched.puesto && errors.puesto)}
|
|
|
|
|
+ helperText={touched.puesto && errors.puesto}
|
|
|
|
|
+ />
|
|
|
|
|
+ </Stack>
|
|
|
|
|
|
|
|
|
|
|
|
|
<Box sx={{ mb: 2 }}>
|
|
<Box sx={{ mb: 2 }}>
|
|
|
- <div style={{ paddingTop : 15}}>
|
|
|
|
|
|
|
+ <div style={{ paddingTop: 15 }}>
|
|
|
<Button
|
|
<Button
|
|
|
type="submit"
|
|
type="submit"
|
|
|
- className="registerBtn"
|
|
|
|
|
|
|
+ className="registerBtn"
|
|
|
variant="contained"
|
|
variant="contained"
|
|
|
sx={{ mt: 1, mr: 1 }}
|
|
sx={{ mt: 1, mr: 1 }}
|
|
|
>
|
|
>
|
|
|
{'Siguiente'}
|
|
{'Siguiente'}
|
|
|
</Button>
|
|
</Button>
|
|
|
<Button
|
|
<Button
|
|
|
- disabled={true}
|
|
|
|
|
|
|
+ disabled={false}
|
|
|
onClick={handleBack}
|
|
onClick={handleBack}
|
|
|
sx={{ mt: 1, mr: 1 }}
|
|
sx={{ mt: 1, mr: 1 }}
|
|
|
>
|
|
>
|