|
@@ -1,12 +1,8 @@
|
1
|
1
|
import * as React from 'react';
|
2
|
2
|
|
3
|
|
-import {
|
4
|
|
- EditSharp,
|
5
|
|
- MailSharp,
|
6
|
|
-} from '@mui/icons-material'
|
|
3
|
+import { EditSharp, MailSharp } from '@mui/icons-material'
|
7
|
4
|
|
8
|
5
|
import {
|
9
|
|
- // descendingComparator,
|
10
|
6
|
rows,
|
11
|
7
|
action_icon,
|
12
|
8
|
Comparar,
|
|
@@ -20,12 +16,8 @@ import {
|
20
|
16
|
TableRow, TablePagination,
|
21
|
17
|
Paper, Box, Switch, FormControlLabel,
|
22
|
18
|
Checkbox,
|
23
|
|
- // TableSortLabel,TableHead,Card
|
24
|
19
|
} from '@mui/material';
|
25
|
20
|
|
26
|
|
-import { Row, Col, Container } from 'react-bootstrap';
|
27
|
|
-
|
28
|
|
-
|
29
|
21
|
export function Contras() {
|
30
|
22
|
|
31
|
23
|
const [order, setOrder] = React.useState('asc');
|
|
@@ -43,20 +35,18 @@ export function Contras() {
|
43
|
35
|
|
44
|
36
|
const SeleccionarTodos = (event) => {
|
45
|
37
|
if (event.target.checked) {
|
46
|
|
- const newSelecteds = rows.map( (n) => n.name);
|
|
38
|
+ const newSelecteds = rows.map( (n) => n.pass);
|
47
|
39
|
setSelected(newSelecteds);
|
48
|
40
|
return;
|
49
|
41
|
}
|
50
|
42
|
setSelected([]);
|
51
|
43
|
};
|
52
|
44
|
|
53
|
|
- const Seleccionar = (event, name) => {
|
|
45
|
+ const Seleccionar = (_event, name) => {
|
54
|
46
|
|
55
|
47
|
const selectedIndex = selected.indexOf(name);
|
56
|
48
|
let newSelected = [];
|
57
|
49
|
|
58
|
|
- console.log(name, selectedIndex)
|
59
|
|
-
|
60
|
50
|
if (selectedIndex === -1) {
|
61
|
51
|
newSelected = newSelected.concat(selected, name);
|
62
|
52
|
} else if (selectedIndex === 0) {
|
|
@@ -93,117 +83,113 @@ export function Contras() {
|
93
|
83
|
return (
|
94
|
84
|
<div className="content-section">
|
95
|
85
|
<div className="main">
|
96
|
|
- <Container>
|
97
|
|
- <Row>
|
98
|
|
- <Col>
|
99
|
|
- <Box sx={{ width: '100%' }}>
|
100
|
|
- <Paper sx={{ width: '100%', mb: 2 }}>
|
101
|
|
-
|
102
|
|
- <TableEncabezadoOperation numSelected={selected.length} />
|
103
|
|
-
|
104
|
|
- <TableContainer>
|
105
|
|
-
|
106
|
|
- <Table
|
107
|
|
- sx={{ minWidth: 750 }}
|
108
|
|
- aria-labelledby="tableTitle"
|
109
|
|
- size={dense ? 'small' : 'medium'}
|
110
|
|
- >
|
111
|
|
-
|
112
|
|
- <EnhancedTableHead
|
113
|
|
- numSelected={selected.length}
|
114
|
|
- order={order}
|
115
|
|
- orderBy={orderBy}
|
116
|
|
- onSelectAllClick={SeleccionarTodos}
|
117
|
|
- onRequestSort={CambiarTipoOrden}
|
118
|
|
- rowCount={rows.length} />
|
119
|
|
-
|
120
|
|
-
|
121
|
|
- <TableBody>
|
122
|
|
- {Cuerpo(rows, Comparar(order, orderBy))
|
123
|
|
- .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
124
|
|
- .map( (row, index) => {
|
125
|
|
-
|
126
|
|
- const isItemSelected = isSelected(row.pass);
|
127
|
|
- const labelId = `enhanced-table-checkbox-${index}`;
|
128
|
|
-
|
129
|
|
- return (
|
130
|
|
- <TableRow
|
131
|
|
- hover
|
132
|
|
- onClick={(event) => Seleccionar(event, row.pass)}
|
133
|
|
- // onClick={(event) => console.log(event)}
|
134
|
|
- role="checkbox"
|
135
|
|
- aria-checked={isItemSelected}
|
136
|
|
- tabIndex={-1}
|
137
|
|
- key={row.pass}
|
138
|
|
- selected={isItemSelected}
|
139
|
|
- >
|
140
|
|
- <TableCell padding="checkbox">
|
141
|
|
- <Checkbox
|
142
|
|
- color="primary"
|
143
|
|
- checked={isItemSelected}
|
144
|
|
- inputProps={{
|
145
|
|
- 'aria-labelledby': labelId,
|
146
|
|
- }}
|
147
|
|
- />
|
148
|
|
- </TableCell>
|
149
|
|
- <TableCell
|
150
|
|
- component="th"
|
151
|
|
- id={labelId}
|
152
|
|
- scope="row"
|
153
|
|
- padding="none"
|
154
|
|
- >
|
155
|
|
- {row.pass}
|
156
|
|
- </TableCell>
|
157
|
|
- <TableCell align="right">{row.nivel}</TableCell>
|
158
|
|
- <TableCell align="right">{row.puesto}</TableCell>
|
159
|
|
- <TableCell align="right">{row.cui}</TableCell>
|
160
|
|
- <TableCell align="right">{row.uso}</TableCell>
|
161
|
|
- <TableCell align="right">{row.picture}</TableCell>
|
162
|
|
- <TableCell align="right">{row.cv}</TableCell>
|
163
|
|
- <TableCell align="right">{row.replic}</TableCell>
|
164
|
|
- <TableCell align="center">
|
165
|
|
- <EditSharp style={action_icon} />
|
166
|
|
- <MailSharp style={action_icon}/>
|
167
|
|
- </TableCell>
|
168
|
|
- </TableRow>
|
169
|
|
- );
|
170
|
|
- })}
|
171
|
|
- {emptyRows > 0 && (
|
172
|
|
- <TableRow
|
173
|
|
- style={{
|
174
|
|
- height: (dense ? 33 : 53) * emptyRows,
|
|
86
|
+ <Box sx={{ width: '100%' }}>
|
|
87
|
+ <Paper sx={{ width: '100%', mb: 2 }}>
|
|
88
|
+
|
|
89
|
+ <TableEncabezadoOperation numSelected={selected.length} />
|
|
90
|
+
|
|
91
|
+ <TableContainer>
|
|
92
|
+
|
|
93
|
+ <Table
|
|
94
|
+ sx={{ minWidth: 750 }}
|
|
95
|
+ aria-labelledby="Contrasenas"
|
|
96
|
+ size={dense ? 'small' : 'medium'}
|
|
97
|
+ >
|
|
98
|
+
|
|
99
|
+ <EnhancedTableHead
|
|
100
|
+ numSelected={selected.length}
|
|
101
|
+ order={order}
|
|
102
|
+ orderBy={orderBy}
|
|
103
|
+ onSelectAllClick={SeleccionarTodos}
|
|
104
|
+ onRequestSort={CambiarTipoOrden}
|
|
105
|
+ rowCount={rows.length} />
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+ <TableBody>
|
|
109
|
+ {Cuerpo(rows, Comparar(order, orderBy))
|
|
110
|
+ .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
111
|
+ .map( (row, index) => {
|
|
112
|
+
|
|
113
|
+ const isItemSelected = isSelected(row.pass);
|
|
114
|
+ const labelId = `enhanced-table-checkbox-${index}`;
|
|
115
|
+
|
|
116
|
+ return (
|
|
117
|
+ <TableRow
|
|
118
|
+ hover
|
|
119
|
+ onClick={(event) => Seleccionar(event, row.pass)}
|
|
120
|
+ // onClick={(event) => console.log(event)}
|
|
121
|
+ role="checkbox"
|
|
122
|
+ aria-checked={isItemSelected}
|
|
123
|
+ tabIndex={-1}
|
|
124
|
+ key={row.pass}
|
|
125
|
+ selected={isItemSelected}
|
|
126
|
+ >
|
|
127
|
+ <TableCell padding="checkbox">
|
|
128
|
+ <Checkbox
|
|
129
|
+ color="primary"
|
|
130
|
+ checked={isItemSelected}
|
|
131
|
+ inputProps={{
|
|
132
|
+ 'aria-labelledby': labelId,
|
175
|
133
|
}}
|
176
|
|
- >
|
177
|
|
- <TableCell colSpan={6} />
|
178
|
|
- </TableRow>
|
179
|
|
- )}
|
180
|
|
- </TableBody>
|
181
|
|
- </Table>
|
182
|
|
- </TableContainer>
|
183
|
|
-
|
184
|
|
- <TablePagination
|
185
|
|
- rowsPerPageOptions={[5, 10, 25]}
|
186
|
|
- component="div"
|
187
|
|
- count={rows.length}
|
188
|
|
- rowsPerPage={rowsPerPage}
|
189
|
|
- page={page}
|
190
|
|
- onPageChange={handleChangePage}
|
191
|
|
- onRowsPerPageChange={handleChangeRowsPerPage}
|
192
|
|
- />
|
193
|
|
-
|
194
|
|
-
|
195
|
|
- </Paper>
|
196
|
|
-
|
197
|
|
- <FormControlLabel
|
198
|
|
- control={<Switch checked={dense} onChange={handleChangeDense} />}
|
199
|
|
- label="Comprimir"
|
200
|
|
- />
|
201
|
|
-
|
202
|
|
- </Box>
|
203
|
|
- </Col>
|
204
|
|
- </Row>
|
205
|
|
- </Container>
|
|
134
|
+ />
|
|
135
|
+ </TableCell>
|
|
136
|
+ <TableCell
|
|
137
|
+ component="th"
|
|
138
|
+ id={labelId}
|
|
139
|
+ scope="row"
|
|
140
|
+ padding="none"
|
|
141
|
+ >
|
|
142
|
+ {row.pass}
|
|
143
|
+ </TableCell>
|
|
144
|
+ <TableCell align="right">{row.nivel}</TableCell>
|
|
145
|
+ <TableCell align="right">{row.puesto}</TableCell>
|
|
146
|
+ <TableCell align="right">{row.cui}</TableCell>
|
|
147
|
+ <TableCell align="right">{row.uso}</TableCell>
|
|
148
|
+ <TableCell align="right">{row.picture}</TableCell>
|
|
149
|
+ <TableCell align="right">{row.cv}</TableCell>
|
|
150
|
+ <TableCell align="right">{row.replic}</TableCell>
|
|
151
|
+ <TableCell align="center">
|
|
152
|
+ <EditSharp style={action_icon} />
|
|
153
|
+ <MailSharp style={action_icon}/>
|
|
154
|
+ </TableCell>
|
|
155
|
+ </TableRow>
|
|
156
|
+ );
|
|
157
|
+ })}
|
|
158
|
+ {emptyRows > 0 && (
|
|
159
|
+ <TableRow
|
|
160
|
+ style={{
|
|
161
|
+ height: (dense ? 33 : 53) * emptyRows,
|
|
162
|
+ }}
|
|
163
|
+ >
|
|
164
|
+ <TableCell colSpan={6} />
|
|
165
|
+ </TableRow>
|
|
166
|
+ )}
|
|
167
|
+ </TableBody>
|
|
168
|
+ </Table>
|
|
169
|
+ </TableContainer>
|
|
170
|
+
|
|
171
|
+ <TablePagination
|
|
172
|
+ rowsPerPageOptions={[5, 10, 25]}
|
|
173
|
+ component="div"
|
|
174
|
+ count={rows.length}
|
|
175
|
+ rowsPerPage={rowsPerPage}
|
|
176
|
+ page={page}
|
|
177
|
+ onPageChange={handleChangePage}
|
|
178
|
+ onRowsPerPageChange={handleChangeRowsPerPage}
|
|
179
|
+ labelRowsPerPage={"Mostrar: "}
|
|
180
|
+ />
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+ </Paper>
|
|
184
|
+
|
|
185
|
+ <FormControlLabel
|
|
186
|
+ control={<Switch checked={dense} onChange={handleChangeDense} />}
|
|
187
|
+ label="Comprimir"
|
|
188
|
+ />
|
|
189
|
+
|
|
190
|
+ </Box>
|
206
|
191
|
</div>
|
207
|
192
|
</div>
|
208
|
193
|
);
|
|
194
|
+
|
209
|
195
|
}
|