mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 16:19:01 +00:00
Workload and Performance page server-side at 10 rows and now return Page, PageSize, and TotalDispatchers on dev (backend#126/#127), so wire the pager that SH-346 and SH-347 require: getWorkload/getPerformance send a 1-based `page` and parse the paging envelope, the hooks and query keys carry the page, and each dispatcher table renders a 10-row pager. Page state is per-table and resets on a range change so switching range never lands on an out-of-range empty page that reads as a false "no dispatchers" state. Drop `docs=No` from the Aveta Pending drilldown. `docs` filters on completion-document status, not the Aveta clearance document the tile counts (SH-294 / backend#138), so it narrowed to the wrong rows. The board has no missing-Aveta-document filter, so the drilldown is now the Aveta-required work in the two-day open window — a deliberate superset of the count.
40 lines
908 B
TypeScript
40 lines
908 B
TypeScript
import { Box, Pagination } from "@mui/material";
|
|
|
|
interface DispatcherTablePagerProps {
|
|
page: number;
|
|
pageSize: number;
|
|
totalDispatchers: number;
|
|
onPageChange: (page: number) => void;
|
|
label: string;
|
|
}
|
|
|
|
/**
|
|
* 10-row pager for the dispatcher tables (SH-346/SH-347). Renders nothing until
|
|
* there is more than one page, so single-page tables are unchanged.
|
|
*/
|
|
export function DispatcherTablePager({
|
|
page,
|
|
pageSize,
|
|
totalDispatchers,
|
|
onPageChange,
|
|
label,
|
|
}: DispatcherTablePagerProps) {
|
|
const pageCount = pageSize > 0 ? Math.ceil(totalDispatchers / pageSize) : 1;
|
|
|
|
if (pageCount <= 1) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Box className="mt-3 flex justify-end">
|
|
<Pagination
|
|
size="small"
|
|
color="primary"
|
|
count={pageCount}
|
|
page={page}
|
|
onChange={(_event, value) => onPageChange(value)}
|
|
aria-label={label}
|
|
/>
|
|
</Box>
|
|
);
|
|
}
|