Browse Source

fix bug pre QA

amenpunk 2 years ago
parent
commit
f6fffc3219

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

@@ -7,7 +7,6 @@ import { Divider, Chip } from '@mui/material'
7 7
 function Mostrar(props) {
8 8
 
9 9
     let { visible, puesto } = props
10
-  console.log("PUESTO: ", puesto)
11 10
     const opciones = { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' };
12 11
     const close = () => props.toggle("VER");
13 12
 

+ 3 - 6
src/Components/Modal/PasswordModal.jsx

@@ -27,14 +27,11 @@ export function HelpModal(props) {
27 27
     sendmail: true,
28 28
     nombrepuesto: null,
29 29
     nombreEmpresa: null,
30
-    candidatos : [
31
-      {
32
-      'nombres': 'ming',
33
-      'apellidos': 'mecca',
34
-      'mail': 'ming@gmail.com', }
35
-    ]
30
+    candidatos : []
36 31
   });
37 32
 
33
+  console.log('password: ', password)
34
+
38 35
   const isStepSkipped = (step) => {
39 36
     return skipped.has(step);
40 37
   };

+ 9 - 1
src/Components/Password/Operation.jsx

@@ -147,10 +147,18 @@ function ModalForm(props) {
147 147
 
148 148
   const { errors, touched, handleSubmit, getFieldProps, values, setValues } = formik;
149 149
 
150
+  function fromBase64(text){
151
+    try{
152
+      return atob(text)
153
+    }catch(_e){
154
+      return text
155
+    }
156
+  }
157
+
150 158
   React.useEffect(() => {
151 159
     setValues({
152 160
       ...props.initialValues,
153
-      pwd: props.initialValues.pwd ? atob(props.initialValues.pwd) : 'loading'
161
+      pwd: props.initialValues.pwd ? fromBase64(props.initialValues.pwd) : 'loading'
154 162
     })
155 163
   }, [props, setValues])
156 164
 

+ 11 - 1
src/Components/Password/Rows.js

@@ -1,5 +1,14 @@
1 1
 import { Operation } from './Operation'
2 2
 
3
+function fromBase64(text){
4
+  try{
5
+    return atob(text)
6
+  }catch(_e){
7
+    return text
8
+  }
9
+}
10
+
11
+
3 12
 export const Encabezados = [
4 13
   {
5 14
     name: 'name',
@@ -46,9 +55,10 @@ export const niveles_educativos = [
46 55
 
47 56
 export function Build(pwds) {
48 57
   return pwds.map(password => {
58
+    console.log('puesto: ', password)
49 59
     let { pwd, plaza_id } = password
50 60
     return {
51
-      name: atob( pwd ),
61
+      name: fromBase64( pwd ),//atob( pwd ),
52 62
       activacion: new Date().toUTCString(),//dateToActived, 
53 63
       dead: new Date().toUTCString(), //deadpwd,
54 64
       op: <Operation plz={plaza_id} pwd={pwd} />

+ 7 - 8
src/Components/Password/Steps/MailTable.jsx

@@ -1,11 +1,8 @@
1 1
 import * as React from 'react';
2
-import Table from '@mui/material/Table';
3
-import TableBody from '@mui/material/TableBody';
4
-import TableCell from '@mui/material/TableCell';
5
-import TableContainer from '@mui/material/TableContainer';
6
-import TableHead from '@mui/material/TableHead';
7
-import TableRow from '@mui/material/TableRow';
8
-import Paper from '@mui/material/Paper';
2
+import { 
3
+  Table, TableBody,TableCell, TableContainer, TableHead,
4
+  TableRow, Paper, ButtonBase
5
+} from '@mui/material'
9 6
 
10 7
 import { DisabledByDefault } from '@mui/icons-material'
11 8
 
@@ -33,7 +30,9 @@ export function MailTable(props) {
33 30
               <TableCell align="right">{row.nombres}</TableCell>
34 31
               <TableCell align="right">{row.apellidos}</TableCell>
35 32
               <TableCell align="right">
36
-                <DisabledByDefault onClick={() => remove(row.mail)} color="primary"/>
33
+                <ButtonBase>
34
+                  <DisabledByDefault onClick={() => remove(row.mail)} color="primary"/>
35
+                </ButtonBase>
37 36
               </TableCell>
38 37
             </TableRow>
39 38
           ) ) :  null }

+ 5 - 1
src/Components/Password/Steps/candidato.jsx

@@ -38,6 +38,7 @@ export function Candidato(props) {
38 38
       // nombreEmpresa: password.nombreEmpresa ? password.nombreEmpresa : auth.getProfile().nombre,
39 39
     },
40 40
     onSubmit: () => {
41
+      console.log('on submit')
41 42
       console.log(password.candidatos)
42 43
       if(password.candidatos.length <= 0){
43 44
         toast.error("Seleciona almenos un destino")
@@ -50,9 +51,12 @@ export function Candidato(props) {
50 51
     validationSchema: CandidatoSchema,
51 52
   });
52 53
 
53
-  const { errors, touched, handleSubmit, getFieldProps, values, resetForm } = formik;
54
+  const { errors, touched, handleSubmit, getFieldProps, values, resetForm,isValid } = formik;
54 55
 
55 56
   const addToList = () => {
57
+    if(!isValid) {
58
+      return toast.error("Completa la informacion del candidato")
59
+    }
56 60
     let user = {
57 61
       'nombres': values.nombres,
58 62
       'apellidos': values.apellidos,

+ 1 - 2
src/Components/Puestos/Card.jsx

@@ -10,6 +10,7 @@ import QA from '../../Images/puesto.jpg'
10 10
 
11 11
 export function PuestoCard(props) {
12 12
 
13
+  console.log('render')
13 14
     let { plaza } = props
14 15
     let { nombrepuesto, notas } = plaza
15 16
 
@@ -27,8 +28,6 @@ export function PuestoCard(props) {
27 28
                 </Typography>
28 29
                 <Typography variant="body2" color="text.secondary">
29 30
                     {notas}
30
-                    Lizards are a widespread group of squamate reptiles, with over 6,000
31
-                    species, ranging across all continents except Antarctica
32 31
                 </Typography>
33 32
             </CardContent>
34 33
             <CardActions>

+ 19 - 19
src/Components/Puestos/GridMode.jsx

@@ -5,24 +5,24 @@ import { PuestoCard } from './Card';
5 5
 
6 6
 export function GridMode(props) {
7 7
 
8
-    let { data, index, showing, toggle } = props;
8
+  let { data, index, showing, toggle } = props;
9 9
 
10
-    return (
11
-        <React.Fragment>
12
-            {
13
-                data.length && showing === 'grid' ?
14
-                    data[index].map(plaza => {
15
-                        return (
16
-                            <Grow in={true} style={{ transformOrigin: '0 0 0' }} timeout={500} key={plaza.id} >
17
-                                <Col lg="4" md="6" sm="6" xs="12" >
18
-                                    <div style={{ padding: 15 }}>
19
-                                        <PuestoCard toggle={toggle} plaza={plaza} />
20
-                                    </div>
21
-                                </Col>
22
-                            </Grow>
23
-                        )
24
-                    }) : <div></div>
25
-            }
26
-        </React.Fragment>
27
-    )
10
+  return (
11
+    <React.Fragment>
12
+      {
13
+        data.length && showing === 'grid' ?
14
+          data[index].map(plaza => {
15
+            return (
16
+              <Grow in={true} style={{ transformOrigin: '0 0 0' }} timeout={500} key={plaza.id} >
17
+                <Col lg="4" md="6" sm="6" xs="12" >
18
+                  <div style={{ padding: 15 }}>
19
+                    <PuestoCard toggle={toggle} plaza={plaza} />
20
+                  </div>
21
+                </Col>
22
+              </Grow>
23
+            )
24
+          }) : <div></div>
25
+      }
26
+    </React.Fragment>
27
+  )
28 28
 }

+ 70 - 70
src/Components/Puestos/ListMode.jsx

@@ -6,76 +6,76 @@ import EditI from '@mui/icons-material/Edit';
6 6
 import Deletei from '@mui/icons-material/Delete';
7 7
 
8 8
 export function ListMode(props) {
9
-    
10
-    const opciones = { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' };
11
-    let {  data, index, showing } = props;
12 9
 
13
-    const isMovil = Size('(min-width:770px)');
10
+  const opciones = { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' };
11
+  let {  data, index, showing } = props;
14 12
 
15
-    return(
16
-        <Col md="12">
17
-            <div className={!isMovil ? "body-table-responsive" : "body-table"}>
18
-                <Table responsive borderless id="tablaproductos" style={{ color : 'white' }}>
19
-                    <thead>
20
-                        <tr >
21
-                            <th className="text-center">Nombre</th>
22
-                            <th className="text-center">Descripción</th>
23
-                            <th className="text-center">Creación</th>
24
-                            <th className="text-center">Acción</th>
25
-                        </tr>
26
-                    </thead>
27
-                    <tbody>
28
-                        {
29
-                            data.length && showing === 'list' ? 
30
-                                data[index].map( (plaza) => {
31
-                                    return (
32
-                                    <Zoom key={plaza.id} in={true}>
33
-                                        <tr >
34
-                                            <td className="text-center">{ plaza.nombrepuesto }</td>
35
-                                            <td className="text-center">{plaza.notas.length > 50 ? plaza.notas.slice(0,50) + "...." : plaza.notas }</td>
36
-                                            <td className="text-center">{ new Date( plaza.createday ).toLocaleDateString('es-GT',opciones) }</td>
37
-                                            <TableCell
38
-                                                sx={{
39
-                                                    "display":'flex',
40
-                                                    "flexDirection":'row',
41
-                                                    "justifyContent": "space-between !important",
42
-                                                    "flexWrap": !isMovil ? "wrap": "nowrap",
43
-                                                }} 
44
-                                                className="actions_butons_plaza"> 
45
-                                                <Button 
46
-                                                    onClick={() => props.toggle("VER", plaza)}
47
-                                                    className="ver_producto">
48
-                                                    {!isMovil ? <ShowI/> : "Ver"}
49
-                                                </Button>
50
-                                                <Button 
51
-                                                    onClick={() => props.toggle("EDIT", plaza)}
52
-                                                    className="editar_producto">
53
-                                                    {!isMovil ? <EditI/> : "Editar"}
54
-                                                </Button>
55
-                                                <Button 
56
-                                                    onClick={() => {
57
-                                                        console.log("ELIMINAR")
58
-                                                    }} 
59
-                                                    className="eliminar_producto">
60
-                                                    {!isMovil ? <Deletei/> : "Eliminar"}
61
-                                                </Button>
62
-                                            </TableCell>
63
-                                        </tr>
64
-                                    </Zoom>
65
-                                    )
66
-                            }) : undefined
67
-                        }
68
-                    </tbody>
69
-                    <tfoot>
70
-                        <tr>
71
-                            <th className="text-center">Nombre de la plaza</th>
72
-                            <th className="text-center">Descripción</th>
73
-                            <th className="text-center">Salario</th>
74
-                            <th className="text-center">Acciones</th>
75
-                        </tr>
76
-                    </tfoot>
77
-                </Table>
78
-            </div>
79
-        </Col>
80
-    )
13
+  const isMovil = Size('(min-width:770px)');
14
+
15
+  return(
16
+    <Col md="12">
17
+      <div className={!isMovil ? "body-table-responsive" : "body-table"}>
18
+        <Table responsive borderless id="tablaproductos" style={{ color : 'white' }}>
19
+          <thead>
20
+            <tr >
21
+              <th className="text-center">Nombre</th>
22
+              <th className="text-center">Descripción</th>
23
+              <th className="text-center">Creación</th>
24
+              <th className="text-center">Acción</th>
25
+            </tr>
26
+          </thead>
27
+          <tbody>
28
+            {
29
+              data.length && showing === 'list' ? 
30
+                data[index].map( (plaza) => {
31
+                  return (
32
+                    <Zoom key={plaza.id} in={true}>
33
+                      <tr >
34
+                        <td className="text-center">{ plaza.nombrepuesto }</td>
35
+                        <td className="text-center">{plaza.notas.length > 50 ? plaza.notas.slice(0,50) + "...." : plaza.notas }</td>
36
+                        <td className="text-center">{ new Date( plaza.createday ).toLocaleDateString('es-GT',opciones) }</td>
37
+                        <TableCell
38
+                          sx={{
39
+                            "display":'flex',
40
+                            "flexDirection":'row',
41
+                            "justifyContent": "space-between !important",
42
+                            "flexWrap": !isMovil ? "wrap": "nowrap",
43
+                          }} 
44
+                          className="actions_butons_plaza"> 
45
+                          <Button 
46
+                            onClick={() => props.toggle("VER", plaza)}
47
+                            className="ver_producto">
48
+                            {!isMovil ? <ShowI/> : "Ver"}
49
+                          </Button>
50
+                          <Button 
51
+                            onClick={() => props.toggle("EDIT", plaza)}
52
+                            className="editar_producto">
53
+                            {!isMovil ? <EditI/> : "Editar"}
54
+                          </Button>
55
+                          <Button 
56
+                            onClick={() => {
57
+                              console.log("ELIMINAR")
58
+                            }} 
59
+                            className="eliminar_producto">
60
+                            {!isMovil ? <Deletei/> : "Eliminar"}
61
+                          </Button>
62
+                        </TableCell>
63
+                      </tr>
64
+                    </Zoom>
65
+                  )
66
+                }) : undefined
67
+            }
68
+          </tbody>
69
+          <tfoot>
70
+            <tr>
71
+              <th className="text-center">Nombre de la plaza</th>
72
+              <th className="text-center">Descripción</th>
73
+              <th className="text-center">Salario</th>
74
+              <th className="text-center">Acciones</th>
75
+            </tr>
76
+          </tfoot>
77
+        </Table>
78
+      </div>
79
+    </Col>
80
+  )
81 81
 }

+ 1 - 2
src/Pages/ContrasV2.jsx

@@ -18,7 +18,7 @@ export function Contrasv2() {
18 18
     let rest = new Service('/contrasenia/getallbyidUsr');
19 19
     return await rest.getQuery(auth.token)
20 20
   }
21
-
21
+  
22 22
   const { data, status  } = useQuery('passwords', getAllPwd );
23 23
   const options = {
24 24
     filterType: 'checkbox',
@@ -30,7 +30,6 @@ export function Contrasv2() {
30 30
     textLabels: TextLabels
31 31
   };
32 32
 
33
-
34 33
   return (
35 34
     <div className="content-section">
36 35
       <div className="main">

+ 1 - 0
src/Pages/Puestos.jsx

@@ -31,6 +31,7 @@ import { useQuery } from 'react-query';
31 31
 
32 32
 export function Puestos() {
33 33
 
34
+  console.log('render puestos')
34 35
   const auth = useSelector((state) => state.token)
35 36
   const [page, setPage] = useState(1);
36 37