Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1749 | Rev 1756 | 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',
1755 stevensc 26
    fontWeight: '500',
27
    '&:last-child': {
28
      borderBottom: 'none'
29
    }
1747 stevensc 30
  }
31
}))
32
 
33
export default function ReportTable({ reports = [] }) {
34
  if (!reports || reports.length === 0) {
35
    return <Typography variant='h2'>No hay reportes disponibles</Typography>
36
  }
37
 
38
  return (
39
    <TableContainer
40
      component={Paper}
41
      sx={{ border: '1px solid var(--font-color)' }}
42
    >
43
      <Table sx={{ minWidth: 650 }} aria-label='simple table'>
44
        <TableHead>
45
          <TableRow>
46
            <StyledTableCell>Email</StyledTableCell>
47
            <StyledTableCell align='right'>Nombre completo</StyledTableCell>
48
            <StyledTableCell align='right'>Estatus</StyledTableCell>
49
            <StyledTableCell align='right'>Motivo</StyledTableCell>
50
            <StyledTableCell align='right'>Tipo</StyledTableCell>
51
            <StyledTableCell align='right'>Fecha</StyledTableCell>
1749 stevensc 52
            <StyledTableCell align='center'>Acciones</StyledTableCell>
1747 stevensc 53
          </TableRow>
54
        </TableHead>
55
        <TableBody>
56
          {reports.map(
57
            (
58
              {
59
                first_name,
60
                last_name,
61
                email,
62
                status,
63
                reason,
64
                type,
65
                date,
66
                actions
67
              },
68
              key
69
            ) => (
70
              <TableRow key={key} sx={{ '& td:last-child': { border: 0 } }}>
71
                <StyledTableCell component='th' scope='row'>
72
                  {email}
73
                </StyledTableCell>
74
                <StyledTableCell align='right'>{`${first_name} ${last_name}`}</StyledTableCell>
75
                <StyledTableCell align='right'>{status}</StyledTableCell>
76
                <StyledTableCell align='right'>{reason}</StyledTableCell>
77
                <StyledTableCell align='right'>{type}</StyledTableCell>
78
                <StyledTableCell align='right'>{date}</StyledTableCell>
1749 stevensc 79
                <StyledTableCell align='center'>
1747 stevensc 80
                  <IconButton component={Link} to={actions?.link_view}>
81
                    <Visibility />
82
                  </IconButton>
83
                </StyledTableCell>
84
              </TableRow>
85
            )
86
          )}
87
        </TableBody>
88
      </Table>
89
    </TableContainer>
90
  )
91
}