Parcourir la source

comple step one by usign remember value

amenpunk il y a 4 ans
Parent
commit
bd2d162e47

+ 2 - 3
src/Components/Home/Candidatos.js

@@ -15,7 +15,8 @@ const USER_LENGTH = 120
 
 
 function Divide(arregloOriginal){
-    const LONGITUD_PEDAZOS = 6;
+
+    const LONGITUD_PEDAZOS = 8;
     let arregloDeArreglos = [];
     for (let i = 0; i < arregloOriginal.length; i += LONGITUD_PEDAZOS) {
         let pedazo = arregloOriginal.slice(i, i + LONGITUD_PEDAZOS);
@@ -30,9 +31,7 @@ export default function Candidatos () {
     const [users, setUser] = useState([]);
 
     const changePage = ( _ , value) => {
-
         let page_numer = value;
-
         Divide(users)
         setPage(page_numer);
     };

+ 8 - 0
src/Components/Modal/PasswordModal.jsx

@@ -17,6 +17,12 @@ export function HelpModal (props) {
 
     const [activeStep, setActiveStep] = React.useState(0);
     const [skipped, setSkipped] = React.useState(new Set());
+    const [password, setPassword] = React.useState({
+        firstName: '',
+        lastName: '',
+        puesto: '',
+        niveles_educativo: 0,
+    });
 
     const isStepSkipped = (step) => {
         return skipped.has(step);
@@ -49,6 +55,8 @@ export function HelpModal (props) {
                 <StepOne 
                     handleNext={handleNext} 
                     handleBack={handleBack} 
+                    password={password} 
+                    setPassword={setPassword} 
                 />
         },
         {

+ 22 - 12
src/Components/Password/Steps/one.js

@@ -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 (