Browse Source

migrate from formik to other alternative

amenpunk 3 years ago
parent
commit
8879ce3823

+ 5 - 5
src/Components/Modal/EditPlaza.js

@@ -63,8 +63,8 @@ function Edit(props) {
         queryClient.invalidateQueries('puestos')
       },
       onError:() => {
-        close();
-        setOpen(false)
+        //close();
+        //setOpen(false)
         toast.error("Lo sentimos ocurrió error inténtalo más tarde")
       }
     })
@@ -124,7 +124,7 @@ function Edit(props) {
         let { areadeptoplz_id, fecha, tests } = response.data;
         let temp_test = tests.map( t => ({ id : t.id} ))
         setChecklist(temp_test.map( t => t.id))
-        reset({...response.data, areadepto : areadeptoplz_id, fecha : new Date(fecha) , tests : temp_test  })
+        reset({...response.data, aredepto : areadeptoplz_id, fecha : new Date(fecha) , tests : temp_test  })
       })
       .catch(console.log)
   },[visible, auth,reset])
@@ -199,8 +199,8 @@ function Edit(props) {
                 <FormControl fullWidth>
                   <InputLabel>Departamento</InputLabel>
                   <Controller
-                    helperText={errors.areadepto?.message}
-                    error={Boolean(errors?.areadepto)}
+                    helperText={errors.aredepto?.message}
+                    error={Boolean(errors?.aredepto)}
                     name="aredepto"
                     control={control}
                     render={ ({field}) =>

+ 2 - 1
src/Components/Modal/MostrarPlaza.js

@@ -7,6 +7,7 @@ import { Divider, Chip } from '@mui/material'
 function Mostrar(props) {
 
     let { visible, puesto } = props
+  console.log("PUESTO: ", puesto)
     const opciones = { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' };
     const close = () => props.toggle("VER");
 
@@ -36,7 +37,7 @@ function Mostrar(props) {
                                 name="sku" readOnly />
                             <div>
                                 {
-                                    puesto
+                                    puesto && visible
                                     ? puesto.tests.map( ( {decription, id} ) => 
                                         (<Chip color="primary" key={id} label={decription}/>)
                                     ) : null

+ 2 - 2
src/Pages/Puestos.jsx

@@ -70,7 +70,7 @@ export function Puestos() {
 
   const toggle = useCallback((type, puesto) => {
    // console.log('usecall: ',puesto)
-    // setPuesto(puesto)
+    setPuesto(puesto)
     switch (type) {
       case "VER": {
         setShow(!show);
@@ -86,7 +86,7 @@ export function Puestos() {
       }
       default: break;
     }
-  }, [edit, del, show])
+  }, [del, show])
 
 
   if(isLoading){