Bläddra i källkod

grid mode bug fix

amenpunk 3 år sedan
förälder
incheckning
9f0b68d7aa
3 ändrade filer med 67 tillägg och 69 borttagningar
  1. 58 57
      src/Components/Puestos/GridMode.jsx
  2. 3 2
      src/Components/Puestos/ListMode.jsx
  3. 6 10
      src/Pages/Puestos.jsx

+ 58 - 57
src/Components/Puestos/GridMode.jsx

@@ -11,71 +11,72 @@ import { Row, Col } from 'react-bootstrap'
11 11
 
12 12
 export function GridMode(props){
13 13
 
14
-    let { setEdit, setDelete, setShow, setPuesto,data } = props;
14
+    let { setEdit, setDelete, setShow, setPuesto, data } = props;
15 15
 
16 16
     return(
17 17
         <React.Fragment> 
18 18
             {
19 19
                 data.length ? 
20
-                data.slice(23).map( plaza => {
21
-                    return(
22
-                        <Col key={plaza.id} lg="4" md="6" sm="6" xs="12" >
23
-                            <div className="panel">
24
-                                <Row>
25
-                                    <Col md="4">
26
-                                        <div className="img-container">
27
-                                            <img alt="not found" src={NotFound}/>
28
-                                        </div>
29
-                                    </Col>
30
-                                    <Col md="8">
31
-                                        <div className="info_details">
32
-                                            <p>{ plaza.nombre }</p>
33
-                                            <p>{ plaza.description }</p>
34
-                                            <p>{ plaza.salario }</p>
35
-                                        </div>
36
-                                        <div className="btn_interactivos">
37
-
38
-                                            <div className="botones_interactivos">
39
-                                                <span 
40
-                                                    onClick={ () => {
41
-                                                        setPuesto(plaza)
42
-                                                        setShow(true)
43
-                                                    }} 
44
-                                                    tooltip-location="top" 
45
-                                                    tooltip="Ver plaza">
46
-                                                    <RemoveRedEyeIcon className="grid_btn"/>
47
-                                                </span>
48
-                                            </div>
49
-                                            <div className="botones_interactivos">
50
-                                                <span 
51
-                                                    onClick={() => {
52
-                                                        setPuesto(plaza)
53
-                                                        setEdit(true)
54
-                                                    }} 
55
-                                                    tooltip-location="top" 
56
-                                                    tooltip="Editar plaza">
57
-                                                    <EditIcon className="grid_btn"/>
58
-                                                </span>
20
+                    data.map( plaza => {
21
+                        console.log('plaza', plaza)
22
+                        return(
23
+                            <Col key={plaza.id} lg="4" md="6" sm="6" xs="12" >
24
+                                <div className="panel">
25
+                                    <Row>
26
+                                        <Col md="4">
27
+                                            <div className="img-container">
28
+                                                <img alt="not found" src={NotFound}/>
59 29
                                             </div>
60
-                                            <div className="botones_interactivos">
61
-                                                <span 
62
-                                                    onClick={() => {
63
-                                                        setPuesto(plaza)
64
-                                                        setDelete(true)
65
-                                                    }} 
66
-                                                    tooltip-location="top" 
67
-                                                    tooltip="Eliminar plaza">
68
-                                                    <HighlightOffIcon className="grid_btn"/>
69
-                                                </span>
30
+                                        </Col>
31
+                                        <Col md="8">
32
+                                            <div className="info_details">
33
+                                                <p>{ plaza.nombre }</p>
34
+                                                <p>{ plaza.description }</p>
35
+                                                <p>{'100'}</p>
70 36
                                             </div>
37
+                                            <div className="btn_interactivos">
71 38
 
72
-                                        </div>
73
-                                    </Col>
74
-                                </Row>
75
-                            </div>
76
-                        </Col>
77
-                    )
78
-                }) : undefined
39
+                                                <div className="botones_interactivos">
40
+                                                    <span 
41
+                                                        onClick={ () => {
42
+                                                            setPuesto(plaza)
43
+                                                            setShow(true)
44
+                                                        }} 
45
+                                                        tooltip-location="top" 
46
+                                                        tooltip="Ver plaza">
47
+                                                        <RemoveRedEyeIcon className="grid_btn"/>
48
+                                                    </span>
49
+                                                </div>
50
+                                                <div className="botones_interactivos">
51
+                                                    <span 
52
+                                                        onClick={() => {
53
+                                                            setPuesto(plaza)
54
+                                                            setEdit(true)
55
+                                                        }} 
56
+                                                        tooltip-location="top" 
57
+                                                        tooltip="Editar plaza">
58
+                                                        <EditIcon className="grid_btn"/>
59
+                                                    </span>
60
+                                                </div>
61
+                                                <div className="botones_interactivos">
62
+                                                    <span 
63
+                                                        onClick={() => {
64
+                                                            setPuesto(plaza)
65
+                                                            setDelete(true)
66
+                                                        }} 
67
+                                                        tooltip-location="top" 
68
+                                                        tooltip="Eliminar plaza">
69
+                                                        <HighlightOffIcon className="grid_btn"/>
70
+                                                    </span>
71
+                                                </div>
72
+
73
+                                            </div>
74
+                                        </Col>
75
+                                    </Row>
76
+                                </div>
77
+                            </Col>
78
+                        )
79
+                    }) : <h1>no hay data</h1>
79 80
             }
80 81
         </React.Fragment>
81 82
     )

+ 3 - 2
src/Components/Puestos/ListMode.jsx

@@ -2,6 +2,7 @@ import {  Col, Button, Table } from 'react-bootstrap'
2 2
 
3 3
 export function ListMode(props) {
4 4
     
5
+    const opciones = { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' };
5 6
     let { setEdit, setDelete, setShow, setPuesto, data } = props;
6 7
 
7 8
     return(
@@ -20,12 +21,12 @@ export function ListMode(props) {
20 21
 
21 22
                         {
22 23
                             data.length ? 
23
-                                data.slice( 0,23 ).map( (plaza, i) => {
24
+                                data.slice( 0,23 ).map( (plaza) => {
24 25
                                     return (
25 26
                                         <tr key={plaza.id}>
26 27
                                             <td className="text-center">{ plaza.nombre }</td>
27 28
                                             <td className="text-center">{ plaza.description }</td>
28
-                                            <td className="text-center">{ plaza.created }</td>
29
+                                            <td className="text-center">{ new Date( plaza.created ).toLocaleDateString('es-GT',opciones) }</td>
29 30
                                             <td className="actions_butons_plaza"> 
30 31
                                                 <Button 
31 32
                                                     onClick={() => {

+ 6 - 10
src/Pages/Puestos.jsx

@@ -2,16 +2,9 @@ import React, { useState, useEffect }  from 'react';
2 2
 import { Row, Col } from 'react-bootstrap'
3 3
 import toast, { Toaster } from 'react-hot-toast';
4 4
 
5
-import {
6
-    ToggleButton,
7
-    ToggleButtonGroup,
8
-    Box, Paper
9
-} from '@mui/material';
5
+import { ToggleButton, ToggleButtonGroup, Box, Paper } from '@mui/material';
10 6
 
11
-import {
12
-    ViewList as ViewListIcon,
13
-    ViewModule as ViewModuleIcon,
14
-} from '@mui/icons-material';
7
+import { ViewList as ViewListIcon, ViewModule as ViewModuleIcon, } from '@mui/icons-material';
15 8
 
16 9
 import { default as useAuth } from '../Auth/useAuth';
17 10
 import { Service } from '../Utils/HTTP';
@@ -60,7 +53,10 @@ export function Puestos() {
60 53
 
61 54
     const [alignment, setAlignment] = React.useState('list');
62 55
 
63
-    const handleChange = (_event, newAlignment) => setAlignment(newAlignment);
56
+    const handleChange = (_event, newAlignment) => {
57
+        console.log("new alignment :: ", newAlignment );
58
+        setAlignment(newAlignment)
59
+    } ;
64 60
 
65 61
     const children = [
66 62
         <ToggleButton value="list" key="list">