|
@@ -11,7 +11,7 @@ import {
|
11
|
11
|
action_icon,
|
12
|
12
|
Comparar,
|
13
|
13
|
Cuerpo,
|
14
|
|
- TableHeader as EnhancedTableHead,
|
|
14
|
+ EnhancedTableHead,
|
15
|
15
|
TableEncabezadoOperation
|
16
|
16
|
} from '../Components/Password/config.js';
|
17
|
17
|
|
|
@@ -29,20 +29,19 @@ import { Row, Col, Container } from 'react-bootstrap';
|
29
|
29
|
export function Contras() {
|
30
|
30
|
|
31
|
31
|
const [order, setOrder] = React.useState('asc');
|
32
|
|
- const [orderBy, setOrderBy] = React.useState('calories');
|
|
32
|
+ const [orderBy, setOrderBy] = React.useState('pass');
|
33
|
33
|
const [selected, setSelected] = React.useState([]);
|
34
|
34
|
const [page, setPage] = React.useState(0);
|
35
|
35
|
const [dense, setDense] = React.useState(false);
|
36
|
36
|
const [rowsPerPage, setRowsPerPage] = React.useState(10);
|
37
|
37
|
|
38
|
|
- const handleRequestSort = (_event, property) => {
|
|
38
|
+ const CambiarTipoOrden = (_event, property) => {
|
39
|
39
|
const isAsc = orderBy === property && order === 'asc';
|
40
|
40
|
setOrder(isAsc ? 'desc' : 'asc');
|
41
|
41
|
setOrderBy(property);
|
42
|
42
|
};
|
43
|
43
|
|
44
|
|
- const handleSelectAllClick = (event) => {
|
45
|
|
-
|
|
44
|
+ const SeleccionarTodos = (event) => {
|
46
|
45
|
if (event.target.checked) {
|
47
|
46
|
const newSelecteds = rows.map( (n) => n.name);
|
48
|
47
|
setSelected(newSelecteds);
|
|
@@ -51,10 +50,13 @@ export function Contras() {
|
51
|
50
|
setSelected([]);
|
52
|
51
|
};
|
53
|
52
|
|
54
|
|
- const handleClick = (__event, name) => {
|
|
53
|
+ const Seleccionar = (event, name) => {
|
|
54
|
+
|
55
|
55
|
const selectedIndex = selected.indexOf(name);
|
56
|
56
|
let newSelected = [];
|
57
|
57
|
|
|
58
|
+ console.log(name, selectedIndex)
|
|
59
|
+
|
58
|
60
|
if (selectedIndex === -1) {
|
59
|
61
|
newSelected = newSelected.concat(selected, name);
|
60
|
62
|
} else if (selectedIndex === 0) {
|
|
@@ -96,36 +98,43 @@ export function Contras() {
|
96
|
98
|
<Col>
|
97
|
99
|
<Box sx={{ width: '100%' }}>
|
98
|
100
|
<Paper sx={{ width: '100%', mb: 2 }}>
|
|
101
|
+
|
99
|
102
|
<TableEncabezadoOperation numSelected={selected.length} />
|
|
103
|
+
|
100
|
104
|
<TableContainer>
|
|
105
|
+
|
101
|
106
|
<Table
|
102
|
107
|
sx={{ minWidth: 750 }}
|
103
|
108
|
aria-labelledby="tableTitle"
|
104
|
|
- size={dense ? 'small' : 'medium'}
|
|
109
|
+ size={dense ? 'small' : 'medium'}
|
105
|
110
|
>
|
|
111
|
+
|
106
|
112
|
<EnhancedTableHead
|
107
|
113
|
numSelected={selected.length}
|
108
|
114
|
order={order}
|
109
|
115
|
orderBy={orderBy}
|
110
|
|
- onSelectAllClick={handleSelectAllClick}
|
111
|
|
- onRequestSort={handleRequestSort}
|
112
|
|
- rowCount={rows.length}
|
113
|
|
- />
|
|
116
|
+ onSelectAllClick={SeleccionarTodos}
|
|
117
|
+ onRequestSort={CambiarTipoOrden}
|
|
118
|
+ rowCount={rows.length} />
|
|
119
|
+
|
|
120
|
+
|
114
|
121
|
<TableBody>
|
115
|
122
|
{Cuerpo(rows, Comparar(order, orderBy))
|
116
|
123
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
117
|
124
|
.map( (row, index) => {
|
118
|
|
- const isItemSelected = isSelected(row.name);
|
|
125
|
+
|
|
126
|
+ const isItemSelected = isSelected(row.pass);
|
119
|
127
|
const labelId = `enhanced-table-checkbox-${index}`;
|
120
|
128
|
|
121
|
129
|
return (
|
122
|
130
|
<TableRow
|
123
|
131
|
hover
|
124
|
|
- onClick={(event) => handleClick(event, row.name)}
|
|
132
|
+ onClick={(event) => Seleccionar(event, row.pass)}
|
|
133
|
+ // onClick={(event) => console.log(event)}
|
125
|
134
|
role="checkbox"
|
126
|
135
|
aria-checked={isItemSelected}
|
127
|
136
|
tabIndex={-1}
|
128
|
|
- key={row.name}
|
|
137
|
+ key={row.pass}
|
129
|
138
|
selected={isItemSelected}
|
130
|
139
|
>
|
131
|
140
|
<TableCell padding="checkbox">
|
|
@@ -135,7 +144,7 @@ export function Contras() {
|
135
|
144
|
inputProps={{
|
136
|
145
|
'aria-labelledby': labelId,
|
137
|
146
|
}}
|
138
|
|
- />
|
|
147
|
+ />
|
139
|
148
|
</TableCell>
|
140
|
149
|
<TableCell
|
141
|
150
|
component="th"
|
|
@@ -152,7 +161,7 @@ export function Contras() {
|
152
|
161
|
<TableCell align="right">{row.picture}</TableCell>
|
153
|
162
|
<TableCell align="right">{row.cv}</TableCell>
|
154
|
163
|
<TableCell align="right">{row.replic}</TableCell>
|
155
|
|
- <TableCell align="right">
|
|
164
|
+ <TableCell align="center">
|
156
|
165
|
<EditSharp style={action_icon} />
|
157
|
166
|
<MailSharp style={action_icon}/>
|
158
|
167
|
</TableCell>
|
|
@@ -171,6 +180,7 @@ export function Contras() {
|
171
|
180
|
</TableBody>
|
172
|
181
|
</Table>
|
173
|
182
|
</TableContainer>
|
|
183
|
+
|
174
|
184
|
<TablePagination
|
175
|
185
|
rowsPerPageOptions={[5, 10, 25]}
|
176
|
186
|
component="div"
|
|
@@ -179,12 +189,16 @@ export function Contras() {
|
179
|
189
|
page={page}
|
180
|
190
|
onPageChange={handleChangePage}
|
181
|
191
|
onRowsPerPageChange={handleChangeRowsPerPage}
|
182
|
|
- />
|
|
192
|
+ />
|
|
193
|
+
|
|
194
|
+
|
183
|
195
|
</Paper>
|
|
196
|
+
|
184
|
197
|
<FormControlLabel
|
185
|
198
|
control={<Switch checked={dense} onChange={handleChangeDense} />}
|
186
|
199
|
label="Comprimir"
|
187
|
|
- />
|
|
200
|
+ />
|
|
201
|
+
|
188
|
202
|
</Box>
|
189
|
203
|
</Col>
|
190
|
204
|
</Row>
|