Browse Source

[add] toggle grid list view

amenpunk 3 years ago
parent
commit
ce3f0983ca
3 changed files with 84 additions and 92 deletions
  1. 1 1
      plazas.php
  2. 11 0
      psicoadmin/src/App.css
  3. 72 91
      psicoadmin/src/Pages/Puestos.js

+ 1 - 1
plazas.php

754
 }(jQuery));
754
 }(jQuery));
755
 
755
 
756
 $('input[type=file]').customFile();
756
 $('input[type=file]').customFile();
757
-  </script>
757
+  </script>

+ 11 - 0
psicoadmin/src/App.css

98
     padding : 10px;
98
     padding : 10px;
99
 }
99
 }
100
 
100
 
101
+.activar_vista{
102
+    display : block !important;
103
+    transition: opacity 0.5s;
104
+    opacity: 1;
105
+}
106
+.desactivar_vista{
107
+    display : none !important;
108
+    opacity: 0;
109
+    pointer-events:none;
110
+}
111
+
101
 
112
 

+ 72 - 91
psicoadmin/src/Pages/Puestos.js

1
 import * as React from 'react';
1
 import * as React from 'react';
2
+import classnames from 'classnames';
2
 import { Row, Col } from 'react-bootstrap'
3
 import { Row, Col } from 'react-bootstrap'
3
 
4
 
4
 import Box from '@mui/material/Box';
5
 import Box from '@mui/material/Box';
7
 
8
 
8
 import ViewListIcon from '@mui/icons-material/ViewList';
9
 import ViewListIcon from '@mui/icons-material/ViewList';
9
 import ViewModuleIcon from '@mui/icons-material/ViewModule';
10
 import ViewModuleIcon from '@mui/icons-material/ViewModule';
10
-import ViewQuiltIcon from '@mui/icons-material/ViewQuilt';
11
     
11
     
12
 let data = [{
12
 let data = [{
13
     nombre : 'Nombre puesto',
13
     nombre : 'Nombre puesto',
23
 function ListMode() {
23
 function ListMode() {
24
 
24
 
25
     let actions = [
25
     let actions = [
26
-        <a href="#" class="ver_producto" data-toggle="modal" data-target="#verProducto">Ver</a>,
27
-        <a href="#" class="editar_producto" data-toggle="modal" data-target="#editarProducto">Editar</a>,
28
-        <a href="#" class="eliminar_producto" data-toggle="modal" data-target="#deleteProducto">Eliminar</a>,
26
+        <a href="#" className="ver_producto" data-toggle="modal" data-target="#verProducto">Ver</a>,
27
+        <a href="#" className="editar_producto" data-toggle="modal" data-target="#editarProducto">Editar</a>,
28
+        <a href="#" className="eliminar_producto" data-toggle="modal" data-target="#deleteProducto">Eliminar</a>,
29
     ]
29
     ]
30
 
30
 
31
     return(
31
     return(
32
-        <Row class="row">
33
-            <Col style={{ padding : 0 }} md="12">
34
-                <div class="body-table">
35
-                    <table id="tablaproductos" class="display" style={{ width : "100%" }}>
36
-                        <thead>
37
-                            <tr>
38
-                                <th>Nombre de la plaza</th>
39
-                                <th>Descripción</th>
40
-                                <th>Salario</th>
41
-                                <th>Acciones</th>
42
-                            </tr>
43
-                        </thead>
44
-                        <tbody>
45
-                            {
46
-                                data.length ? 
32
+        <Col md="12">
33
+            <div className="body-table">
34
+                <table id="tablaproductos" className="display" style={{ width : "100%" }}>
35
+                    <thead>
36
+                        <tr>
37
+                            <th>Nombre de la plaza</th>
38
+                            <th>Descripción</th>
39
+                            <th>Salario</th>
40
+                            <th>Acciones</th>
41
+                        </tr>
42
+                    </thead>
43
+                    <tbody>
44
+
45
+                        {
46
+                            data.length ? 
47
                                 data.map( plaza => {
47
                                 data.map( plaza => {
48
                                     return (
48
                                     return (
49
                                         <tr>
49
                                         <tr>
54
                                         </tr>
54
                                         </tr>
55
                                     )
55
                                     )
56
                                 }) : undefined
56
                                 }) : undefined
57
-                            }
58
-
59
-                        </tbody>
60
-                        <tfoot>
61
-                            <tr>
62
-                                <th>Nombre de la plaza</th>
63
-                                <th>Descripción</th>
64
-                                <th>Salario</th>
65
-                                <th>Acciones</th>
66
-                            </tr>
67
-                        </tfoot>
68
-                    </table>
69
-                </div>
70
-            </Col>
71
-        </Row>
57
+                        }
58
+
59
+                    </tbody>
60
+                    <tfoot>
61
+                        <tr>
62
+                            <th>Nombre de la plaza</th>
63
+                            <th>Descripción</th>
64
+                            <th>Salario</th>
65
+                            <th>Acciones</th>
66
+                        </tr>
67
+                    </tfoot>
68
+                </table>
69
+            </div>
70
+        </Col>
72
     )
71
     )
73
 }
72
 }
74
 
73
 
78
         <React.Fragment> 
77
         <React.Fragment> 
79
             {
78
             {
80
                 data.length ? 
79
                 data.length ? 
81
-                    <div class="col-md-3">
82
-                        <div class="panel">
83
-                            <div class="row">
84
-                                <div class="col-md-4">
85
-                                    <div class="img-container">
80
+                    <div className="col-md-3">
81
+                        <div className="panel">
82
+                            <div className="row">
83
+                                <div className="col-md-4">
84
+                                    <div className="img-container">
86
                                         <img src="images/not_found.png"/>
85
                                         <img src="images/not_found.png"/>
87
                                     </div>
86
                                     </div>
88
                                 </div>
87
                                 </div>
89
-                                <div class="col-md-8">
90
-                                    <div class="info_details">
88
+                                <div className="col-md-8">
89
+                                    <div className="info_details">
91
                                         <p>Nombre de la plaza</p>
90
                                         <p>Nombre de la plaza</p>
92
                                         <p>Descripción</p>
91
                                         <p>Descripción</p>
93
                                         <p>Salario</p>
92
                                         <p>Salario</p>
94
-                                        <div class="botones_interactivos">
95
-                                            <a href="#" tooltip-location="top" tooltip-animate tooltip="Ver plaza" data-toggle="modal" data-target="#verProducto"><i class="far fa-eye"></i></a>
93
+                                        <div className="botones_interactivos">
94
+                                            <a href="#" tooltip-location="top" tooltip-animate tooltip="Ver plaza" data-toggle="modal" data-target="#verProducto"><i className="far fa-eye"></i></a>
96
                                         </div>
95
                                         </div>
97
-                                        <div class="botones_interactivos">
98
-                                            <a href="#" tooltip-location="top" tooltip-animate tooltip="Editar plaza" data-toggle="modal" data-target="#editarProducto"><i class="far fa-edit"></i></a>
96
+                                        <div className="botones_interactivos">
97
+                                            <a href="#" tooltip-location="top" tooltip-animate tooltip="Editar plaza" data-toggle="modal" data-target="#editarProducto"><i className="far fa-edit"></i></a>
99
                                         </div>
98
                                         </div>
100
-                                        <div class="botones_interactivos">
101
-                                            <a href="#" tooltip-location="top" tooltip-animate tooltip="Eliminar plaza" data-toggle="modal" data-target="#deleteProducto"><i class="far fa-times-circle"></i></a>
99
+                                        <div className="botones_interactivos">
100
+                                            <a href="#" tooltip-location="top" tooltip-animate tooltip="Eliminar plaza" data-toggle="modal" data-target="#deleteProducto"><i className="far fa-times-circle"></i></a>
102
                                         </div>
101
                                         </div>
103
                                     </div>
102
                                     </div>
104
                                 </div>
103
                                 </div>
106
                         </div>
105
                         </div>
107
                     </div>
106
                     </div>
108
                     : undefined
107
                     : undefined
109
-
110
             }
108
             }
111
         </React.Fragment>
109
         </React.Fragment>
112
     )
110
     )
116
 
114
 
117
     const [alignment, setAlignment] = React.useState('left');
115
     const [alignment, setAlignment] = React.useState('left');
118
 
116
 
119
-    const handleChange = (event, newAlignment) => {
120
-        setAlignment(newAlignment);
121
-    };
117
+    const handleChange = (event, newAlignment) => setAlignment(newAlignment);
122
 
118
 
123
     const children = [
119
     const children = [
124
-        <ToggleButton value="left" key="left">
120
+        <ToggleButton value="list" key="list">
125
             <ViewListIcon />
121
             <ViewListIcon />
126
         </ToggleButton>,
122
         </ToggleButton>,
127
-        <ToggleButton value="center" key="center">
123
+        <ToggleButton value="grid" key="grid">
128
             <ViewModuleIcon/>
124
             <ViewModuleIcon/>
129
         </ToggleButton>,
125
         </ToggleButton>,
130
-        <ToggleButton value="right" key="right">
131
-            <ViewQuiltIcon/>
132
-        </ToggleButton>,
133
     ];
126
     ];
134
 
127
 
135
     const control = {
128
     const control = {
139
     };
132
     };
140
 
133
 
141
     return (
134
     return (
142
-        <div class="content-section">
143
-            <div class="main">
144
-                <div class="breadcrumb-header">
145
-                    <Box sx={{ float : 'left',display: 'flex', flexDirection: 'column', alignItems: 'center', '& > :not(style) + :not(style)': { mt: 2 }, }} >
146
-                        <ToggleButtonGroup size="small" {...control}>
147
-                            {children}
148
-                        </ToggleButtonGroup>
149
-                    </Box>
150
-                </div>
151
-                <div class="row">
152
-                    <div class="col-md-6">
153
-                        <div class="list_view">
154
-                            <div class="row">
155
-                                <div class="colgrilla">
156
-                                    <div class="btn_view">
157
-                                        <a class="activar_vista" id="list_click" tooltip-location="top" tooltip-animate tooltip="Ver como lista" onclick="activarlista()"><i class="fas fa-list"></i></a>
158
-                                    </div>
159
-                                </div>
160
-                                <div class="colgrilla">
161
-                                    <div class="btn_view">
162
-                                        <a id="grid_click" tooltip-location="top" tooltip-animate tooltip="Ver como grupo" onclick="activargrid()"><i class="fas fa-th"></i></a>
163
-                                    </div>
164
-                                </div>
165
-                            </div>
135
+        <div className="content-section">
136
+            <div className="main">
137
+                <Row>
138
+                    <Col md="6">
139
+                        <div className="breadcrumb-header">
140
+                            <Box sx={{ float : 'left',display: 'flex', flexDirection: 'column', alignItems: 'center', '& > :not(style) + :not(style)': { mt: 2 }, }} >
141
+                                <ToggleButtonGroup size="small" {...control}>
142
+                                    {children}
143
+                                </ToggleButtonGroup>
144
+                            </Box>
166
                         </div>
145
                         </div>
167
-                    </div>
168
-                    <div class="col-md-6">
169
-                        <div class="add_producto">
170
-                            <div class="btn_add_producto">
146
+                    </Col>
147
+                    <Col md="6">
148
+                        <div className="add_producto">
149
+                            <div className="btn_add_producto">
171
                                 <a href="#" data-toggle="modal" data-target="#addProducto">Agregar manual</a>
150
                                 <a href="#" data-toggle="modal" data-target="#addProducto">Agregar manual</a>
172
                             </div>
151
                             </div>
173
                         </div>
152
                         </div>
174
-                        <div class="add_producto">
175
-                            <div class="btn_add_producto">
153
+                        <div className="add_producto">
154
+                            <div className="btn_add_producto">
176
                                 <a href="#" data-toggle="modal" data-target="#addProductoExpress">Agregar express</a>
155
                                 <a href="#" data-toggle="modal" data-target="#addProductoExpress">Agregar express</a>
177
                             </div>
156
                             </div>
178
                         </div>
157
                         </div>
179
-                    </div>
180
-                </div>
181
-                <div class="main_productos" id="grid_view">
158
+                    </Col>
159
+                </Row>
160
+                <div className={`main_productos ${ alignment === 'grid' ? 'activar_vista' : 'desactivar_vista'  }`} id="grid_view">
182
                     <Row>
161
                     <Row>
183
                         <ModuleMode/>
162
                         <ModuleMode/>
184
                     </Row>
163
                     </Row>
185
                 </div>
164
                 </div>
186
-                <div class="main_list_products" id="list_view_products">
187
-                    <ListMode/>
165
+                <div className={`main_list_products ${alignment === 'list' ?  'activar_vista' : 'desactivar_vista'}`} id="list_view_products">
166
+                    <Row>
167
+                        <ListMode/>
168
+                    </Row>
188
                 </div>
169
                 </div>
189
             </div>
170
             </div>
190
         </div>
171
         </div>