Ver código fonte

fix bug pre QA

amenpunk 3 anos atrás
pai
commit
f6fffc3219

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

@@ -7,7 +7,6 @@ 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");
 

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

@@ -27,14 +27,11 @@ export function HelpModal(props) {
     sendmail: true,
     nombrepuesto: null,
     nombreEmpresa: null,
-    candidatos : [
-      {
-      'nombres': 'ming',
-      'apellidos': 'mecca',
-      'mail': 'ming@gmail.com', }
-    ]
+    candidatos : []
   });
 
+  console.log('password: ', password)
+
   const isStepSkipped = (step) => {
     return skipped.has(step);
   };

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

@@ -147,10 +147,18 @@ function ModalForm(props) {
 
   const { errors, touched, handleSubmit, getFieldProps, values, setValues } = formik;
 
+  function fromBase64(text){
+    try{
+      return atob(text)
+    }catch(_e){
+      return text
+    }
+  }
+
   React.useEffect(() => {
     setValues({
       ...props.initialValues,
-      pwd: props.initialValues.pwd ? atob(props.initialValues.pwd) : 'loading'
+      pwd: props.initialValues.pwd ? fromBase64(props.initialValues.pwd) : 'loading'
     })
   }, [props, setValues])
 

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

@@ -1,5 +1,14 @@
 import { Operation } from './Operation'
 
+function fromBase64(text){
+  try{
+    return atob(text)
+  }catch(_e){
+    return text
+  }
+}
+
+
 export const Encabezados = [
   {
     name: 'name',
@@ -46,9 +55,10 @@ export const niveles_educativos = [
 
 export function Build(pwds) {
   return pwds.map(password => {
+    console.log('puesto: ', password)
     let { pwd, plaza_id } = password
     return {
-      name: atob( pwd ),
+      name: fromBase64( pwd ),//atob( pwd ),
       activacion: new Date().toUTCString(),//dateToActived, 
       dead: new Date().toUTCString(), //deadpwd,
       op: <Operation plz={plaza_id} pwd={pwd} />

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

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

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

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

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

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

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

@@ -5,24 +5,24 @@ import { PuestoCard } from './Card';
 
 export function GridMode(props) {
 
-    let { data, index, showing, toggle } = props;
+  let { data, index, showing, toggle } = props;
 
-    return (
-        <React.Fragment>
-            {
-                data.length && showing === 'grid' ?
-                    data[index].map(plaza => {
-                        return (
-                            <Grow in={true} style={{ transformOrigin: '0 0 0' }} timeout={500} key={plaza.id} >
-                                <Col lg="4" md="6" sm="6" xs="12" >
-                                    <div style={{ padding: 15 }}>
-                                        <PuestoCard toggle={toggle} plaza={plaza} />
-                                    </div>
-                                </Col>
-                            </Grow>
-                        )
-                    }) : <div></div>
-            }
-        </React.Fragment>
-    )
+  return (
+    <React.Fragment>
+      {
+        data.length && showing === 'grid' ?
+          data[index].map(plaza => {
+            return (
+              <Grow in={true} style={{ transformOrigin: '0 0 0' }} timeout={500} key={plaza.id} >
+                <Col lg="4" md="6" sm="6" xs="12" >
+                  <div style={{ padding: 15 }}>
+                    <PuestoCard toggle={toggle} plaza={plaza} />
+                  </div>
+                </Col>
+              </Grow>
+            )
+          }) : <div></div>
+      }
+    </React.Fragment>
+  )
 }

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

@@ -6,76 +6,76 @@ import EditI from '@mui/icons-material/Edit';
 import Deletei from '@mui/icons-material/Delete';
 
 export function ListMode(props) {
-    
-    const opciones = { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' };
-    let {  data, index, showing } = props;
 
-    const isMovil = Size('(min-width:770px)');
+  const opciones = { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' };
+  let {  data, index, showing } = props;
 
-    return(
-        <Col md="12">
-            <div className={!isMovil ? "body-table-responsive" : "body-table"}>
-                <Table responsive borderless id="tablaproductos" style={{ color : 'white' }}>
-                    <thead>
-                        <tr >
-                            <th className="text-center">Nombre</th>
-                            <th className="text-center">Descripción</th>
-                            <th className="text-center">Creación</th>
-                            <th className="text-center">Acción</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        {
-                            data.length && showing === 'list' ? 
-                                data[index].map( (plaza) => {
-                                    return (
-                                    <Zoom key={plaza.id} in={true}>
-                                        <tr >
-                                            <td className="text-center">{ plaza.nombrepuesto }</td>
-                                            <td className="text-center">{plaza.notas.length > 50 ? plaza.notas.slice(0,50) + "...." : plaza.notas }</td>
-                                            <td className="text-center">{ new Date( plaza.createday ).toLocaleDateString('es-GT',opciones) }</td>
-                                            <TableCell
-                                                sx={{
-                                                    "display":'flex',
-                                                    "flexDirection":'row',
-                                                    "justifyContent": "space-between !important",
-                                                    "flexWrap": !isMovil ? "wrap": "nowrap",
-                                                }} 
-                                                className="actions_butons_plaza"> 
-                                                <Button 
-                                                    onClick={() => props.toggle("VER", plaza)}
-                                                    className="ver_producto">
-                                                    {!isMovil ? <ShowI/> : "Ver"}
-                                                </Button>
-                                                <Button 
-                                                    onClick={() => props.toggle("EDIT", plaza)}
-                                                    className="editar_producto">
-                                                    {!isMovil ? <EditI/> : "Editar"}
-                                                </Button>
-                                                <Button 
-                                                    onClick={() => {
-                                                        console.log("ELIMINAR")
-                                                    }} 
-                                                    className="eliminar_producto">
-                                                    {!isMovil ? <Deletei/> : "Eliminar"}
-                                                </Button>
-                                            </TableCell>
-                                        </tr>
-                                    </Zoom>
-                                    )
-                            }) : undefined
-                        }
-                    </tbody>
-                    <tfoot>
-                        <tr>
-                            <th className="text-center">Nombre de la plaza</th>
-                            <th className="text-center">Descripción</th>
-                            <th className="text-center">Salario</th>
-                            <th className="text-center">Acciones</th>
-                        </tr>
-                    </tfoot>
-                </Table>
-            </div>
-        </Col>
-    )
+  const isMovil = Size('(min-width:770px)');
+
+  return(
+    <Col md="12">
+      <div className={!isMovil ? "body-table-responsive" : "body-table"}>
+        <Table responsive borderless id="tablaproductos" style={{ color : 'white' }}>
+          <thead>
+            <tr >
+              <th className="text-center">Nombre</th>
+              <th className="text-center">Descripción</th>
+              <th className="text-center">Creación</th>
+              <th className="text-center">Acción</th>
+            </tr>
+          </thead>
+          <tbody>
+            {
+              data.length && showing === 'list' ? 
+                data[index].map( (plaza) => {
+                  return (
+                    <Zoom key={plaza.id} in={true}>
+                      <tr >
+                        <td className="text-center">{ plaza.nombrepuesto }</td>
+                        <td className="text-center">{plaza.notas.length > 50 ? plaza.notas.slice(0,50) + "...." : plaza.notas }</td>
+                        <td className="text-center">{ new Date( plaza.createday ).toLocaleDateString('es-GT',opciones) }</td>
+                        <TableCell
+                          sx={{
+                            "display":'flex',
+                            "flexDirection":'row',
+                            "justifyContent": "space-between !important",
+                            "flexWrap": !isMovil ? "wrap": "nowrap",
+                          }} 
+                          className="actions_butons_plaza"> 
+                          <Button 
+                            onClick={() => props.toggle("VER", plaza)}
+                            className="ver_producto">
+                            {!isMovil ? <ShowI/> : "Ver"}
+                          </Button>
+                          <Button 
+                            onClick={() => props.toggle("EDIT", plaza)}
+                            className="editar_producto">
+                            {!isMovil ? <EditI/> : "Editar"}
+                          </Button>
+                          <Button 
+                            onClick={() => {
+                              console.log("ELIMINAR")
+                            }} 
+                            className="eliminar_producto">
+                            {!isMovil ? <Deletei/> : "Eliminar"}
+                          </Button>
+                        </TableCell>
+                      </tr>
+                    </Zoom>
+                  )
+                }) : undefined
+            }
+          </tbody>
+          <tfoot>
+            <tr>
+              <th className="text-center">Nombre de la plaza</th>
+              <th className="text-center">Descripción</th>
+              <th className="text-center">Salario</th>
+              <th className="text-center">Acciones</th>
+            </tr>
+          </tfoot>
+        </Table>
+      </div>
+    </Col>
+  )
 }

+ 1 - 2
src/Pages/ContrasV2.jsx

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

+ 1 - 0
src/Pages/Puestos.jsx

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