|
@@ -11,7 +11,7 @@ import {
|
|
|
action_icon,
|
|
action_icon,
|
|
|
Comparar,
|
|
Comparar,
|
|
|
Cuerpo,
|
|
Cuerpo,
|
|
|
- TableHeader as EnhancedTableHead,
|
|
|
|
|
|
|
+ EnhancedTableHead,
|
|
|
TableEncabezadoOperation
|
|
TableEncabezadoOperation
|
|
|
} from '../Components/Password/config.js';
|
|
} from '../Components/Password/config.js';
|
|
|
|
|
|
|
@@ -29,20 +29,19 @@ import { Row, Col, Container } from 'react-bootstrap';
|
|
|
export function Contras() {
|
|
export function Contras() {
|
|
|
|
|
|
|
|
const [order, setOrder] = React.useState('asc');
|
|
const [order, setOrder] = React.useState('asc');
|
|
|
- const [orderBy, setOrderBy] = React.useState('calories');
|
|
|
|
|
|
|
+ const [orderBy, setOrderBy] = React.useState('pass');
|
|
|
const [selected, setSelected] = React.useState([]);
|
|
const [selected, setSelected] = React.useState([]);
|
|
|
const [page, setPage] = React.useState(0);
|
|
const [page, setPage] = React.useState(0);
|
|
|
const [dense, setDense] = React.useState(false);
|
|
const [dense, setDense] = React.useState(false);
|
|
|
const [rowsPerPage, setRowsPerPage] = React.useState(10);
|
|
const [rowsPerPage, setRowsPerPage] = React.useState(10);
|
|
|
|
|
|
|
|
- const handleRequestSort = (_event, property) => {
|
|
|
|
|
|
|
+ const CambiarTipoOrden = (_event, property) => {
|
|
|
const isAsc = orderBy === property && order === 'asc';
|
|
const isAsc = orderBy === property && order === 'asc';
|
|
|
setOrder(isAsc ? 'desc' : 'asc');
|
|
setOrder(isAsc ? 'desc' : 'asc');
|
|
|
setOrderBy(property);
|
|
setOrderBy(property);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const handleSelectAllClick = (event) => {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const SeleccionarTodos = (event) => {
|
|
|
if (event.target.checked) {
|
|
if (event.target.checked) {
|
|
|
const newSelecteds = rows.map( (n) => n.name);
|
|
const newSelecteds = rows.map( (n) => n.name);
|
|
|
setSelected(newSelecteds);
|
|
setSelected(newSelecteds);
|
|
@@ -51,10 +50,13 @@ export function Contras() {
|
|
|
setSelected([]);
|
|
setSelected([]);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const handleClick = (__event, name) => {
|
|
|
|
|
|
|
+ const Seleccionar = (event, name) => {
|
|
|
|
|
+
|
|
|
const selectedIndex = selected.indexOf(name);
|
|
const selectedIndex = selected.indexOf(name);
|
|
|
let newSelected = [];
|
|
let newSelected = [];
|
|
|
|
|
|
|
|
|
|
+ console.log(name, selectedIndex)
|
|
|
|
|
+
|
|
|
if (selectedIndex === -1) {
|
|
if (selectedIndex === -1) {
|
|
|
newSelected = newSelected.concat(selected, name);
|
|
newSelected = newSelected.concat(selected, name);
|
|
|
} else if (selectedIndex === 0) {
|
|
} else if (selectedIndex === 0) {
|
|
@@ -96,36 +98,43 @@ export function Contras() {
|
|
|
<Col>
|
|
<Col>
|
|
|
<Box sx={{ width: '100%' }}>
|
|
<Box sx={{ width: '100%' }}>
|
|
|
<Paper sx={{ width: '100%', mb: 2 }}>
|
|
<Paper sx={{ width: '100%', mb: 2 }}>
|
|
|
|
|
+
|
|
|
<TableEncabezadoOperation numSelected={selected.length} />
|
|
<TableEncabezadoOperation numSelected={selected.length} />
|
|
|
|
|
+
|
|
|
<TableContainer>
|
|
<TableContainer>
|
|
|
|
|
+
|
|
|
<Table
|
|
<Table
|
|
|
sx={{ minWidth: 750 }}
|
|
sx={{ minWidth: 750 }}
|
|
|
aria-labelledby="tableTitle"
|
|
aria-labelledby="tableTitle"
|
|
|
- size={dense ? 'small' : 'medium'}
|
|
|
|
|
|
|
+ size={dense ? 'small' : 'medium'}
|
|
|
>
|
|
>
|
|
|
|
|
+
|
|
|
<EnhancedTableHead
|
|
<EnhancedTableHead
|
|
|
numSelected={selected.length}
|
|
numSelected={selected.length}
|
|
|
order={order}
|
|
order={order}
|
|
|
orderBy={orderBy}
|
|
orderBy={orderBy}
|
|
|
- onSelectAllClick={handleSelectAllClick}
|
|
|
|
|
- onRequestSort={handleRequestSort}
|
|
|
|
|
- rowCount={rows.length}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ onSelectAllClick={SeleccionarTodos}
|
|
|
|
|
+ onRequestSort={CambiarTipoOrden}
|
|
|
|
|
+ rowCount={rows.length} />
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
<TableBody>
|
|
<TableBody>
|
|
|
{Cuerpo(rows, Comparar(order, orderBy))
|
|
{Cuerpo(rows, Comparar(order, orderBy))
|
|
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
|
.map( (row, index) => {
|
|
.map( (row, index) => {
|
|
|
- const isItemSelected = isSelected(row.name);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const isItemSelected = isSelected(row.pass);
|
|
|
const labelId = `enhanced-table-checkbox-${index}`;
|
|
const labelId = `enhanced-table-checkbox-${index}`;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<TableRow
|
|
<TableRow
|
|
|
hover
|
|
hover
|
|
|
- onClick={(event) => handleClick(event, row.name)}
|
|
|
|
|
|
|
+ onClick={(event) => Seleccionar(event, row.pass)}
|
|
|
|
|
+ // onClick={(event) => console.log(event)}
|
|
|
role="checkbox"
|
|
role="checkbox"
|
|
|
aria-checked={isItemSelected}
|
|
aria-checked={isItemSelected}
|
|
|
tabIndex={-1}
|
|
tabIndex={-1}
|
|
|
- key={row.name}
|
|
|
|
|
|
|
+ key={row.pass}
|
|
|
selected={isItemSelected}
|
|
selected={isItemSelected}
|
|
|
>
|
|
>
|
|
|
<TableCell padding="checkbox">
|
|
<TableCell padding="checkbox">
|
|
@@ -135,7 +144,7 @@ export function Contras() {
|
|
|
inputProps={{
|
|
inputProps={{
|
|
|
'aria-labelledby': labelId,
|
|
'aria-labelledby': labelId,
|
|
|
}}
|
|
}}
|
|
|
- />
|
|
|
|
|
|
|
+ />
|
|
|
</TableCell>
|
|
</TableCell>
|
|
|
<TableCell
|
|
<TableCell
|
|
|
component="th"
|
|
component="th"
|
|
@@ -152,7 +161,7 @@ export function Contras() {
|
|
|
<TableCell align="right">{row.picture}</TableCell>
|
|
<TableCell align="right">{row.picture}</TableCell>
|
|
|
<TableCell align="right">{row.cv}</TableCell>
|
|
<TableCell align="right">{row.cv}</TableCell>
|
|
|
<TableCell align="right">{row.replic}</TableCell>
|
|
<TableCell align="right">{row.replic}</TableCell>
|
|
|
- <TableCell align="right">
|
|
|
|
|
|
|
+ <TableCell align="center">
|
|
|
<EditSharp style={action_icon} />
|
|
<EditSharp style={action_icon} />
|
|
|
<MailSharp style={action_icon}/>
|
|
<MailSharp style={action_icon}/>
|
|
|
</TableCell>
|
|
</TableCell>
|
|
@@ -171,6 +180,7 @@ export function Contras() {
|
|
|
</TableBody>
|
|
</TableBody>
|
|
|
</Table>
|
|
</Table>
|
|
|
</TableContainer>
|
|
</TableContainer>
|
|
|
|
|
+
|
|
|
<TablePagination
|
|
<TablePagination
|
|
|
rowsPerPageOptions={[5, 10, 25]}
|
|
rowsPerPageOptions={[5, 10, 25]}
|
|
|
component="div"
|
|
component="div"
|
|
@@ -179,12 +189,16 @@ export function Contras() {
|
|
|
page={page}
|
|
page={page}
|
|
|
onPageChange={handleChangePage}
|
|
onPageChange={handleChangePage}
|
|
|
onRowsPerPageChange={handleChangeRowsPerPage}
|
|
onRowsPerPageChange={handleChangeRowsPerPage}
|
|
|
- />
|
|
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</Paper>
|
|
</Paper>
|
|
|
|
|
+
|
|
|
<FormControlLabel
|
|
<FormControlLabel
|
|
|
control={<Switch checked={dense} onChange={handleChangeDense} />}
|
|
control={<Switch checked={dense} onChange={handleChangeDense} />}
|
|
|
label="Comprimir"
|
|
label="Comprimir"
|
|
|
- />
|
|
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
</Box>
|
|
</Box>
|
|
|
</Col>
|
|
</Col>
|
|
|
</Row>
|
|
</Row>
|