ListMode.jsx 3.3 KB

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