|
@@ -13,81 +13,7 @@ import TableHead from "@material-ui/core/TableHead";
|
|
import TableRow from "@material-ui/core/TableRow";
|
|
import TableRow from "@material-ui/core/TableRow";
|
|
import TableFooter from '@material-ui/core/TableFooter';
|
|
import TableFooter from '@material-ui/core/TableFooter';
|
|
import TablePagination from '@material-ui/core/TablePagination';
|
|
import TablePagination from '@material-ui/core/TablePagination';
|
|
-import IconButton from '@material-ui/core/IconButton';
|
|
|
|
-import FirstPageIcon from '@material-ui/icons/FirstPage';
|
|
|
|
-import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft';
|
|
|
|
-import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight';
|
|
|
|
-import LastPageIcon from '@material-ui/icons/LastPage';
|
|
|
|
-
|
|
|
|
-const useStyles1 = makeStyles((theme: Theme) =>
|
|
|
|
- createStyles({
|
|
|
|
- root: {
|
|
|
|
- flexShrink: 0,
|
|
|
|
- marginLeft: theme.spacing(2.5),
|
|
|
|
- },
|
|
|
|
- }),
|
|
|
|
-);
|
|
|
|
-
|
|
|
|
-interface TablePaginationActionsProps {
|
|
|
|
- count: number;
|
|
|
|
- page: number;
|
|
|
|
- rowsPerPage: number;
|
|
|
|
- onPageChange: (event: React.MouseEvent<HTMLButtonElement>, newPage: number) => void;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const TablePaginationActions = (props: TablePaginationActionsProps) => {
|
|
|
|
- const theme = useTheme();
|
|
|
|
- const { count, page, rowsPerPage, onPageChange } = props;
|
|
|
|
-
|
|
|
|
- const handleFirstPageButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
|
|
- console.log('first button is clicked')
|
|
|
|
- onPageChange(event, 0);
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- const handleBackButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
|
|
- console.log('back button is clicked')
|
|
|
|
- onPageChange(event, page - 1);
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- const handleNextButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
|
|
- console.log('next button is clicked')
|
|
|
|
- onPageChange(event, page + 1);
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- const handleLastPageButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
|
|
- console.log('last button is clicked')
|
|
|
|
- onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- return (
|
|
|
|
- <div >
|
|
|
|
- <IconButton
|
|
|
|
- onClick={handleFirstPageButtonClick}
|
|
|
|
- disabled={page === 0}
|
|
|
|
- aria-label="first page"
|
|
|
|
- >
|
|
|
|
- {theme.direction === 'rtl' ? <LastPageIcon /> : <FirstPageIcon />}
|
|
|
|
- </IconButton>
|
|
|
|
- <IconButton onClick={handleBackButtonClick} disabled={page === 0} aria-label="previous page">
|
|
|
|
- {theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
|
|
|
|
- </IconButton>
|
|
|
|
- <IconButton
|
|
|
|
- onClick={handleNextButtonClick}
|
|
|
|
- disabled={page >= Math.ceil(count / rowsPerPage) - 1}
|
|
|
|
- aria-label="next page"
|
|
|
|
- >
|
|
|
|
- {theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
|
|
|
|
- </IconButton>
|
|
|
|
- <IconButton
|
|
|
|
- onClick={handleLastPageButtonClick}
|
|
|
|
- disabled={page >= Math.ceil(count / rowsPerPage) - 1}
|
|
|
|
- aria-label="last page"
|
|
|
|
- >
|
|
|
|
- {theme.direction === 'rtl' ? <FirstPageIcon /> : <LastPageIcon />}
|
|
|
|
- </IconButton>
|
|
|
|
- </div>
|
|
|
|
- );
|
|
|
|
-}
|
|
|
|
|
|
+import TablePaginationActions from './ui/TablePaginationActions';
|
|
|
|
|
|
export function GroupWorkers(props: { council: ElectedCouncil, workingGroup : WorkingGroup }) {
|
|
export function GroupWorkers(props: { council: ElectedCouncil, workingGroup : WorkingGroup }) {
|
|
|
|
|
|
@@ -136,7 +62,6 @@ export function GroupWorkers(props: { council: ElectedCouncil, workingGroup : Wo
|
|
|
|
|
|
const useStyles2 = makeStyles({
|
|
const useStyles2 = makeStyles({
|
|
table: {
|
|
table: {
|
|
- minWidth: 500,
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -149,18 +74,16 @@ const WorkGroup = (props: { council: ElectedCouncil | undefined}) => {
|
|
const [rowsPerPage, setRowsPerPage] = React.useState(4);
|
|
const [rowsPerPage, setRowsPerPage] = React.useState(4);
|
|
|
|
|
|
const handleChangePage = (event: unknown, newPage: number) => {
|
|
const handleChangePage = (event: unknown, newPage: number) => {
|
|
- console.log(`handlechangepage : ${newPage}`)
|
|
|
|
setPage(newPage);
|
|
setPage(newPage);
|
|
};
|
|
};
|
|
|
|
|
|
const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
- console.log(`handleChangeRowsPerPage: ${parseInt(event.target.value, 10)}`)
|
|
|
|
setRowsPerPage(parseInt(event.target.value, 10));
|
|
setRowsPerPage(parseInt(event.target.value, 10));
|
|
setPage(0);
|
|
setPage(0);
|
|
};
|
|
};
|
|
|
|
|
|
return (
|
|
return (
|
|
- <SubBlock title="WorkGroup" stretch={true}>
|
|
|
|
|
|
+ <SubBlock title="WorkGroup" stretch={6}>
|
|
{ !loading && (
|
|
{ !loading && (
|
|
<>
|
|
<>
|
|
<TableContainer>
|
|
<TableContainer>
|
|
@@ -173,20 +96,20 @@ const WorkGroup = (props: { council: ElectedCouncil | undefined}) => {
|
|
<TableCell>Budget/Debt at end of Term</TableCell>
|
|
<TableCell>Budget/Debt at end of Term</TableCell>
|
|
</TableRow>
|
|
</TableRow>
|
|
</TableHead>
|
|
</TableHead>
|
|
- {workingGroups && ( <>
|
|
|
|
|
|
+ {workingGroups && (
|
|
<TableBody>
|
|
<TableBody>
|
|
- { /*rowsPerPage > 0 ?
|
|
|
|
|
|
+ { rowsPerPage > 0 ?
|
|
workingGroups.slice(page * rowsPerPage, page *rowsPerPage + rowsPerPage)
|
|
workingGroups.slice(page * rowsPerPage, page *rowsPerPage + rowsPerPage)
|
|
.map((workingGroup) => <GroupWorkers key={workingGroup.id} council={council} workingGroup={workingGroup} />)
|
|
.map((workingGroup) => <GroupWorkers key={workingGroup.id} council={council} workingGroup={workingGroup} />)
|
|
- :*/ workingGroups.map((workingGroup) => <GroupWorkers key={workingGroup.id} council={council} workingGroup={workingGroup} />)
|
|
|
|
|
|
+ : workingGroups.map((workingGroup) => <GroupWorkers key={workingGroup.id} council={council} workingGroup={workingGroup} />)
|
|
}
|
|
}
|
|
</TableBody>
|
|
</TableBody>
|
|
- </>)}
|
|
|
|
- {/* <TableFooter>
|
|
|
|
|
|
+ )}
|
|
|
|
+ <TableFooter>
|
|
<TableRow>
|
|
<TableRow>
|
|
<TablePagination
|
|
<TablePagination
|
|
rowsPerPageOptions={[4]}
|
|
rowsPerPageOptions={[4]}
|
|
- colSpan={3}
|
|
|
|
|
|
+ colSpan={4}
|
|
count={workingGroups ? workingGroups.length : 0}
|
|
count={workingGroups ? workingGroups.length : 0}
|
|
rowsPerPage={rowsPerPage}
|
|
rowsPerPage={rowsPerPage}
|
|
page={page}
|
|
page={page}
|
|
@@ -199,7 +122,7 @@ const WorkGroup = (props: { council: ElectedCouncil | undefined}) => {
|
|
ActionsComponent={TablePaginationActions}
|
|
ActionsComponent={TablePaginationActions}
|
|
/>
|
|
/>
|
|
</TableRow>
|
|
</TableRow>
|
|
- </TableFooter> */}
|
|
|
|
|
|
+ </TableFooter>
|
|
</Table>
|
|
</Table>
|
|
</TableContainer>
|
|
</TableContainer>
|
|
</>
|
|
</>
|