瀏覽代碼

[add] toggle grid list view

amenpunk 3 年之前
父節點
當前提交
ce3f0983ca
共有 3 個文件被更改,包括 84 次插入92 次删除
  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,4 +754,4 @@
754 754
 }(jQuery));
755 755
 
756 756
 $('input[type=file]').customFile();
757
-  </script>
757
+  </script>

+ 11 - 0
psicoadmin/src/App.css

@@ -98,4 +98,15 @@
98 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,4 +1,5 @@
1 1
 import * as React from 'react';
2
+import classnames from 'classnames';
2 3
 import { Row, Col } from 'react-bootstrap'
3 4
 
4 5
 import Box from '@mui/material/Box';
@@ -7,7 +8,6 @@ import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
7 8
 
8 9
 import ViewListIcon from '@mui/icons-material/ViewList';
9 10
 import ViewModuleIcon from '@mui/icons-material/ViewModule';
10
-import ViewQuiltIcon from '@mui/icons-material/ViewQuilt';
11 11
     
12 12
 let data = [{
13 13
     nombre : 'Nombre puesto',
@@ -23,27 +23,27 @@ for( let _ of new Array(10) ){
23 23
 function ListMode() {
24 24
 
25 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 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 47
                                 data.map( plaza => {
48 48
                                     return (
49 49
                                         <tr>
@@ -54,21 +54,20 @@ function ListMode() {
54 54
                                         </tr>
55 55
                                     )
56 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,27 +77,27 @@ function ModuleMode () {
78 77
         <React.Fragment> 
79 78
             {
80 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 85
                                         <img src="images/not_found.png"/>
87 86
                                     </div>
88 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 90
                                         <p>Nombre de la plaza</p>
92 91
                                         <p>Descripción</p>
93 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 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 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 101
                                         </div>
103 102
                                     </div>
104 103
                                 </div>
@@ -106,7 +105,6 @@ function ModuleMode () {
106 105
                         </div>
107 106
                     </div>
108 107
                     : undefined
109
-
110 108
             }
111 109
         </React.Fragment>
112 110
     )
@@ -116,20 +114,15 @@ export function Puestos() {
116 114
 
117 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 119
     const children = [
124
-        <ToggleButton value="left" key="left">
120
+        <ToggleButton value="list" key="list">
125 121
             <ViewListIcon />
126 122
         </ToggleButton>,
127
-        <ToggleButton value="center" key="center">
123
+        <ToggleButton value="grid" key="grid">
128 124
             <ViewModuleIcon/>
129 125
         </ToggleButton>,
130
-        <ToggleButton value="right" key="right">
131
-            <ViewQuiltIcon/>
132
-        </ToggleButton>,
133 126
     ];
134 127
 
135 128
     const control = {
@@ -139,52 +132,40 @@ export function Puestos() {
139 132
     };
140 133
 
141 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 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 150
                                 <a href="#" data-toggle="modal" data-target="#addProducto">Agregar manual</a>
172 151
                             </div>
173 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 155
                                 <a href="#" data-toggle="modal" data-target="#addProductoExpress">Agregar express</a>
177 156
                             </div>
178 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 161
                     <Row>
183 162
                         <ModuleMode/>
184 163
                     </Row>
185 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 169
                 </div>
189 170
             </div>
190 171
         </div>