|
|
@@ -2,31 +2,28 @@ import React from 'react'
|
|
|
import * as Yup from 'yup';
|
|
|
import { useState } from 'react';
|
|
|
import { useFormik, Form, FormikProvider } from 'formik';
|
|
|
-import { Icon } from '@iconify/react';
|
|
|
|
|
|
import {
|
|
|
Box, Button,
|
|
|
- Stack, TextField, IconButton, InputAdornment,
|
|
|
+ Stack, TextField,
|
|
|
+ InputLabel,MenuItem,FormControl,Select
|
|
|
} from '@mui/material';
|
|
|
|
|
|
-import eyeFill from '@iconify/icons-eva/eye-fill';
|
|
|
-import eyeOffFill from '@iconify/icons-eva/eye-off-fill';
|
|
|
-// import { V1, V2 } from '../../Utils/HTTP'
|
|
|
+import { niveles_educativos } from '../Rows'
|
|
|
|
|
|
export function StepOne(props) {
|
|
|
|
|
|
- const steplen = 2;
|
|
|
- const index = 0;
|
|
|
+ const [educativo, setEducativo] = useState('');
|
|
|
|
|
|
- const [showPassword, setShowPassword] = useState(false);
|
|
|
- const [showPasswordTwo, setShowPasswordTwo] = useState(false);
|
|
|
+ const changeNivelEducativo = (event) => {
|
|
|
+ setEducativo(event.target.value);
|
|
|
+ };
|
|
|
|
|
|
- const RegisterSchema = Yup.object().shape({
|
|
|
- firstName: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado largo!').required('Tu nombre es requerido'),
|
|
|
+ const CandidatoSchema = Yup.object().shape({
|
|
|
+ firstName: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado largo!').required('El nombre es requerido'),
|
|
|
lastName: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!').required('El apellido es requerido'),
|
|
|
- email: Yup.string().email('El correo no es valido').required('Email es requerido'),
|
|
|
- password: Yup.string().min(5, 'La contraseña debe contener mínimo 5 caracteres').required('la contraseña es requerida'),
|
|
|
- password_confirm: Yup.string().required('Las contraseñas no coincidien').oneOf([Yup.ref('password'), null], 'Las contraseñas no coincidien')
|
|
|
+ puesto: Yup.string().required('El puesto es requerido'),
|
|
|
+ niveles_educativo: Yup.number().required('Selecciona un nivel educativo')
|
|
|
});
|
|
|
|
|
|
let { handleNext, handleBack } = props
|
|
|
@@ -35,14 +32,14 @@ export function StepOne(props) {
|
|
|
initialValues: {
|
|
|
firstName: '',
|
|
|
lastName: '',
|
|
|
- email: '',
|
|
|
- password: '',
|
|
|
- password_confirm: ''
|
|
|
+ puesto: '',
|
|
|
+ niveles_educativo: 0,
|
|
|
},
|
|
|
onSubmit: (fields) => {
|
|
|
+ console.log('SUBMIT > ',fields)
|
|
|
handleNext()
|
|
|
},
|
|
|
- validationSchema: RegisterSchema,
|
|
|
+ validationSchema: CandidatoSchema,
|
|
|
});
|
|
|
|
|
|
const {errors, touched, handleSubmit, getFieldProps } = formik;
|
|
|
@@ -58,7 +55,7 @@ export function StepOne(props) {
|
|
|
{...getFieldProps('firstName')}
|
|
|
error={Boolean(touched.firstName && errors.firstName)}
|
|
|
helperText={touched.firstName && errors.firstName}
|
|
|
- />
|
|
|
+ />
|
|
|
|
|
|
<TextField
|
|
|
label="Apellidos"
|
|
|
@@ -66,76 +63,59 @@ export function StepOne(props) {
|
|
|
{...getFieldProps('lastName')}
|
|
|
error={Boolean(touched.lastName && errors.lastName)}
|
|
|
helperText={touched.lastName && errors.lastName}
|
|
|
- />
|
|
|
+ />
|
|
|
</Stack>
|
|
|
|
|
|
<TextField
|
|
|
fullWidth
|
|
|
- autoComplete="username"
|
|
|
- type="email"
|
|
|
- label="Correo Electrónico"
|
|
|
- {...getFieldProps('email')}
|
|
|
- error={Boolean(touched.email && errors.email)}
|
|
|
- helperText={touched.email && errors.email}
|
|
|
- />
|
|
|
-
|
|
|
- <TextField
|
|
|
- fullWidth
|
|
|
- autoComplete="current-password"
|
|
|
- type={showPassword ? 'text' : 'password'}
|
|
|
- label="Contraseña"
|
|
|
- {...getFieldProps('password')}
|
|
|
- InputProps={{
|
|
|
- endAdornment: (
|
|
|
- <InputAdornment position="end">
|
|
|
- <IconButton edge="end" onClick={() => setShowPassword((prev) => !prev)}>
|
|
|
- <Icon icon={showPassword ? eyeFill : eyeOffFill} />
|
|
|
- </IconButton>
|
|
|
- </InputAdornment>
|
|
|
- )
|
|
|
- }}
|
|
|
- error={Boolean(touched.password && errors.password)}
|
|
|
- helperText={touched.password && errors.password}
|
|
|
- />
|
|
|
+ type="text"
|
|
|
+ label="Experiencia laboral o puesto"
|
|
|
+ {...getFieldProps('puesto')}
|
|
|
+ error={Boolean(touched.puesto && errors.puesto)}
|
|
|
+ helperText={touched.puesto && errors.puesto}
|
|
|
+ />
|
|
|
|
|
|
- <TextField
|
|
|
- fullWidth
|
|
|
- type={showPasswordTwo ? 'text' : 'password'}
|
|
|
- label="Confirma contraseña"
|
|
|
- {...getFieldProps('password_confirm')}
|
|
|
- InputProps={{
|
|
|
- endAdornment: (
|
|
|
- <InputAdornment position="end">
|
|
|
- <IconButton edge="end" onClick={() => setShowPasswordTwo((prev) => !prev)}>
|
|
|
- <Icon icon={showPasswordTwo ? eyeFill : eyeOffFill} />
|
|
|
- </IconButton>
|
|
|
- </InputAdornment>
|
|
|
- )
|
|
|
- }}
|
|
|
- error={Boolean(touched.password_confirm && errors.password_confirm)}
|
|
|
- helperText={touched.password_confirm && errors.password_confirm}
|
|
|
- />
|
|
|
-
|
|
|
-
|
|
|
- <Box sx={{ mb: 2 }}>
|
|
|
- <div style={{ paddingTop : 15}}>
|
|
|
- <Button
|
|
|
- type="submit"
|
|
|
- className="registerBtn"
|
|
|
- variant="contained"
|
|
|
- sx={{ mt: 1, mr: 1 }}
|
|
|
- >
|
|
|
- {index === steplen - 1 ? 'Registrarme' : 'Siguiente'}
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- disabled={true}
|
|
|
- onClick={handleBack}
|
|
|
- sx={{ mt: 1, mr: 1 }}
|
|
|
- >
|
|
|
- Regresar
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- </Box>
|
|
|
+ <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>
|
|
|
+
|
|
|
+
|
|
|
+ <Box sx={{ mb: 2 }}>
|
|
|
+ <div style={{ paddingTop : 15}}>
|
|
|
+ <Button
|
|
|
+ type="submit"
|
|
|
+ className="registerBtn"
|
|
|
+ variant="contained"
|
|
|
+ sx={{ mt: 1, mr: 1 }}
|
|
|
+ >
|
|
|
+ {'Siguiente'}
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ disabled={true}
|
|
|
+ onClick={handleBack}
|
|
|
+ sx={{ mt: 1, mr: 1 }}
|
|
|
+ >
|
|
|
+ Regresar
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ </Box>
|
|
|
|
|
|
</Stack>
|
|
|
</Form>
|