Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1748 | Rev 1755 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1747 stevensc 1
import React from 'react'
2
import { Link } from 'react-router-dom'
3
import {
4
  IconButton,
5
  Paper,
6
  Table,
7
  TableBody,
8
  TableCell,
9
  TableContainer,
10
  TableHead,
11
  TableRow,
12
  Typography,
13
  styled,
14
  tableCellClasses
15
} from '@mui/material'
16
import { Visibility } from '@mui/icons-material'
17
 
18
const StyledTableCell = styled(TableCell)(() => ({
19
  borderColor: 'var(--font-color)',
20
  [`&.${tableCellClasses.head}`]: {
21
    fontWeight: '600'
22
  },
23
  [`&.${tableCellClasses.body}`]: {
24
    position: 'relative',
25
    borderRight: '1px solid',
26
    borderBottom: 'none',
27
    fontWeight: '500'
28
  }
29
}))
30
 
31
export default function ReportTable({ reports = [] }) {
32
  if (!reports || reports.length === 0) {
33
    return <Typography variant='h2'>No hay reportes disponibles</Typography>
34
  }
35
 
36
  return (
37
    <TableContainer
38
      component={Paper}
39
      sx={{ border: '1px solid var(--font-color)' }}
40
    >
41
      <Table sx={{ minWidth: 650 }} aria-label='simple table'>
42
        <TableHead>
43
          <TableRow>
44
            <StyledTableCell>Email</StyledTableCell>
45
            <StyledTableCell align='right'>Nombre completo</StyledTableCell>
46
            <StyledTableCell align='right'>Estatus</StyledTableCell>
47
            <StyledTableCell align='right'>Motivo</StyledTableCell>
48
            <StyledTableCell align='right'>Tipo</StyledTableCell>
49
            <StyledTableCell align='right'>Fecha</StyledTableCell>
1749 stevensc 50
            <StyledTableCell align='center'>Acciones</StyledTableCell>
1747 stevensc 51
          </TableRow>
52
        </TableHead>
53
        <TableBody>
54
          {reports.map(
55
            (
56
              {
57
                first_name,
58
                last_name,
59
                email,
60
                status,
61
                reason,
62
                type,
63
                date,
64
                actions
65
              },
66
              key
67
            ) => (
68
              <TableRow key={key} sx={{ '& td:last-child': { border: 0 } }}>
69
                <StyledTableCell component='th' scope='row'>
70
                  {email}
71
                </StyledTableCell>
72
                <StyledTableCell align='right'>{`${first_name} ${last_name}`}</StyledTableCell>
73
                <StyledTableCell align='right'>{status}</StyledTableCell>
74
                <StyledTableCell align='right'>{reason}</StyledTableCell>
75
                <StyledTableCell align='right'>{type}</StyledTableCell>
76
                <StyledTableCell align='right'>{date}</StyledTableCell>
1749 stevensc 77
                <StyledTableCell align='center'>
1747 stevensc 78
                  <IconButton component={Link} to={actions?.link_view}>
79
                    <Visibility />
80
                  </IconButton>
81
                </StyledTableCell>
82
              </TableRow>
83
            )
84
          )}
85
        </TableBody>
86
      </Table>
87
    </TableContainer>
88
  )
89
}