Browse Source

migrate from formik to other alternative

amenpunk 2 years ago
parent
commit
8879ce3823

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

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

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

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

+ 2 - 2
src/Pages/Puestos.jsx

@@ -70,7 +70,7 @@ export function Puestos() {
70 70
 
71 71
   const toggle = useCallback((type, puesto) => {
72 72
    // console.log('usecall: ',puesto)
73
-    // setPuesto(puesto)
73
+    setPuesto(puesto)
74 74
     switch (type) {
75 75
       case "VER": {
76 76
         setShow(!show);
@@ -86,7 +86,7 @@ export function Puestos() {
86 86
       }
87 87
       default: break;
88 88
     }
89
-  }, [edit, del, show])
89
+  }, [del, show])
90 90
 
91 91
 
92 92
   if(isLoading){