Browse Source

custom datatable operation toolbar

amenpunk 3 years ago
parent
commit
ce538331ae

+ 1 - 0
package.json

23
         "jquery": "^3.6.0",
23
         "jquery": "^3.6.0",
24
         "js-cookie": "^3.0.1",
24
         "js-cookie": "^3.0.1",
25
         "jwt-decode": "^3.1.2",
25
         "jwt-decode": "^3.1.2",
26
+        "mui-datatables": "^4.2.2",
26
         "react": "^17.0.2",
27
         "react": "^17.0.2",
27
         "react-bootstrap": "2.4.0",
28
         "react-bootstrap": "2.4.0",
28
         "react-dom": "^17.0.2",
29
         "react-dom": "^17.0.2",

+ 1 - 1
src/App.css

82
     flex-direction: row;
82
     flex-direction: row;
83
     padding : 90px;
83
     padding : 90px;
84
     max-height : 175px;
84
     max-height : 175px;
85
-    margin-bottom:20px
85
+    /* margin-bottom:20px */
86
 }
86
 }
87
 .MuiFormControl{
87
 .MuiFormControl{
88
     border : 1px solid #eceff1;
88
     border : 1px solid #eceff1;

+ 2 - 2
src/Components/Home/Actividades.js

71
                                             <TextField 
71
                                             <TextField 
72
                                                 sx={{
72
                                                 sx={{
73
                                                     '& ::before' : {
73
                                                     '& ::before' : {
74
-                                                        'borderBottom': "0px solid red"
74
+                                                        'borderBottom': "0px solid red !important"
75
                                                     }
75
                                                     }
76
                                                 }}
76
                                                 }}
77
                                                 fullWidth={true} 
77
                                                 fullWidth={true} 
96
                                         <TextField 
96
                                         <TextField 
97
                                             sx={{
97
                                             sx={{
98
                                                 '& ::before' : {
98
                                                 '& ::before' : {
99
-                                                    'borderBottom': "0px  solid red"
99
+                                                    'borderBottom': "0px  solid red !important"
100
                                                 }
100
                                                 }
101
                                             }}
101
                                             }}
102
                                             fullWidth={true} 
102
                                             fullWidth={true} 

+ 28 - 0
src/Components/Password/CustomToolbar.jsx

1
+import React from "react";
2
+import {
3
+    IconButton, Tooltip
4
+} from '@mui/material';
5
+
6
+import { Add as AddIcon } from '@mui/icons-material'
7
+
8
+export default class CustomToolbar extends React.Component {
9
+
10
+    handleClick = () => {
11
+        console.log("clicked on icon!");
12
+    }
13
+
14
+    render() {
15
+
16
+        return (
17
+            <React.Fragment>
18
+                <Tooltip title={"custom icon"}>
19
+                    <IconButton onClick={this.handleClick}>
20
+                        <AddIcon />
21
+                    </IconButton>
22
+                </Tooltip>
23
+            </React.Fragment>
24
+        );
25
+    }
26
+
27
+}
28
+

+ 2 - 1
src/Components/Routes.js

6
 import { Register } from '../Pages/Register'
6
 import { Register } from '../Pages/Register'
7
 import { Home } from '../Pages/Home'
7
 import { Home } from '../Pages/Home'
8
 import { Puestos } from '../Pages/Puestos'
8
 import { Puestos } from '../Pages/Puestos'
9
-import { Contras  } from '../Pages/Contras'
9
+// import { Contras  } from '../Pages/Contras'
10
+import { Contrasv2  as Contras } from '../Pages/ContrasV2'
10
 import { Expedientes } from '../Pages/Expedientes'
11
 import { Expedientes } from '../Pages/Expedientes'
11
 import { Resultados } from '../Pages/Resultados'
12
 import { Resultados } from '../Pages/Resultados'
12
 import { Configuracion } from '../Pages/Configuracion'
13
 import { Configuracion } from '../Pages/Configuracion'

+ 1 - 1
src/Css/all.css

290
     width: 100%;
290
     width: 100%;
291
     float: left;
291
     float: left;
292
     border: 1px solid #dcdcdc;
292
     border: 1px solid #dcdcdc;
293
-    /* padding : 10px; */
293
+    padding : 10px;
294
 }
294
 }
295
 .footerinfo p {
295
 .footerinfo p {
296
     font-size: 14px;
296
     font-size: 14px;

+ 67 - 0
src/Pages/ContrasV2.jsx

1
+import * as React from 'react';
2
+
3
+// import { rows, action_icon, Comparar, Cuerpo, } from '../Components/Password/config.js';
4
+import { default as CustomToolbar} from '../Components/Password/CustomToolbar';
5
+
6
+import { 
7
+    // Table, TableBody, TableCell, TableContainer, TableRow, TablePagination,
8
+    Paper, Box, 
9
+    // Switch, FormControlLabel, Checkbox,
10
+} from '@mui/material';
11
+
12
+// import { EditSharp, MailSharp } from '@mui/icons-material'
13
+
14
+
15
+
16
+import MUIDataTable from "mui-datatables";
17
+
18
+const columns = ["Name", "Company", "City", "State"];
19
+
20
+const data = [
21
+    ["Joe James", "Test Corp", "Yonkers", "NY"],
22
+    ["John Walsh", "Test Corp", "Hartford", "CT"],
23
+    ["Bob Herm", "Test Corp", "Tampa", "FL"],
24
+    ["James Houston", "Test Corp", "Dallas", "TX"],
25
+];
26
+
27
+
28
+export function Contrasv2() {
29
+
30
+
31
+    const columns = ["Name", "Company", "City", "State"];
32
+
33
+    const data = [
34
+        ["Joe James", "Test Corp", "Yonkers", "NY"],
35
+        ["John Walsh", "Test Corp", "Hartford", "CT"],
36
+        ["Bob Herm", "Test Corp", "Tampa", "FL"],
37
+        ["James Houston", "Test Corp", "Dallas", "TX"],
38
+    ];
39
+
40
+
41
+    const options = {
42
+        filterType: 'checkbox',
43
+        customToolbar: () => {
44
+            return (
45
+                <CustomToolbar />
46
+            );
47
+        }
48
+    };
49
+
50
+    return (
51
+        <div className="content-section">
52
+            <div className="main">
53
+                <Box sx={{ width: '100%' }}>
54
+                    <Paper sx={{ width: '100%', mb: 2 }}>
55
+                        <MUIDataTable
56
+                            title={"Contraseñas"}
57
+                            data={data}
58
+                            columns={columns}
59
+                            options={options}
60
+                        />
61
+                    </Paper>
62
+                </Box>
63
+            </div>
64
+        </div>
65
+    );
66
+
67
+}