source: src/sections/employee/employee-table-row.tsx@ 057453c

main
Last change on this file since 057453c was 057453c, checked in by Naum Shapkarovski <naumshapkarovski@…>, 5 weeks ago

feat: implement employees

  • Property mode set to 100644
File size: 2.0 KB
Line 
1// @mui
2import Avatar from '@mui/material/Avatar';
3import Tooltip from '@mui/material/Tooltip';
4import TableRow from '@mui/material/TableRow';
5import TableCell from '@mui/material/TableCell';
6import IconButton from '@mui/material/IconButton';
7// hooks
8import { useBoolean } from 'src/hooks/use-boolean';
9// types
10import { Employee } from 'src/schemas';
11// components
12import Label from 'src/components/label';
13import Iconify from 'src/components/iconify';
14//
15import EmployeeQuickEditForm from './employee-quick-edit-form';
16
17// ----------------------------------------------------------------------
18
19type Props = {
20 selected: boolean;
21 onEditRow: VoidFunction;
22 row: Employee;
23};
24
25export default function EmployeeTableRow({ row, selected, onEditRow }: Props) {
26 const { name, photo, project, status, email } = row;
27
28 const quickEdit = useBoolean();
29
30 return (
31 <>
32 <TableRow hover selected={selected}>
33 <TableCell sx={{ display: 'flex', alignItems: 'center' }}>
34 <Avatar alt={name} src={photo || ''} sx={{ mr: 2 }} />
35 <span>{name}</span>
36 </TableCell>
37
38 <TableCell sx={{ whiteSpace: 'nowrap' }}>{email}</TableCell>
39
40 <TableCell sx={{ whiteSpace: 'nowrap' }}>{project || '-'}</TableCell>
41
42 <TableCell>
43 <Label
44 variant="soft"
45 color={
46 (status === 'active' && 'success') ||
47 (status === 'inactive' && 'warning') ||
48 'default'
49 }
50 >
51 {status}
52 </Label>
53 </TableCell>
54
55 <TableCell align="right" sx={{ px: 1, whiteSpace: 'nowrap' }}>
56 <Tooltip title="Quick Edit" placement="top" arrow>
57 <IconButton color={quickEdit.value ? 'inherit' : 'default'} onClick={quickEdit.onTrue}>
58 <Iconify icon="solar:pen-bold" />
59 </IconButton>
60 </Tooltip>
61 </TableCell>
62 </TableRow>
63
64 <EmployeeQuickEditForm
65 currentEmployee={row}
66 open={quickEdit.value}
67 onClose={quickEdit.onFalse}
68 />
69 </>
70 );
71}
Note: See TracBrowser for help on using the repository browser.