Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 1x | import { useAppSelector } from "@redux/hooks";
import CustomersTableV2 from "./CustomersTableV2";
import { QKEY_LIST_CUSTOMERS } from "constants/queryKeys";
import TechnicalErrorState from "componentsV2/Table/components/TechnicalErrorState";
import { PortalRootContainerV2 } from "components/Layout/LayoutV2";
import { useListCustomersV2 } from "./hooks/useListCustomersV2";
import { STORED_CUSTOMER_ROWS_PER_PAGE } from "@constants/stringConstants";
const CustomersPageV2 = () => {
const {
isLoading,
totalRows,
allRows,
page,
setPage,
setPageDispatcher,
isFetching,
handleResetFilters,
hasFilters,
state: { isEmpty, isError },
rowsPerPage
} = useListCustomersV2();
const hasNotCustomersListPermission = useAppSelector(
(state) => state.app.permissions?.customers_list,
);
if (isError && !hasNotCustomersListPermission && !isLoading)
return <TechnicalErrorState />;
return (
<PortalRootContainerV2 data-testid="customers-page">
<CustomersTableV2
type="customers"
allRows={allRows}
isLoading={isLoading}
isFetching={isFetching}
totalRows={totalRows}
page={page}
setPageDispatcher={setPageDispatcher}
setPage={setPage}
queryKey={QKEY_LIST_CUSTOMERS}
handleResetFilters={handleResetFilters}
isEmpty={isEmpty}
hasFilters={hasFilters}
isListPermissionAllowed={!hasNotCustomersListPermission}
sectionName="Customers"
rowsPerPage={rowsPerPage}
storageKey={STORED_CUSTOMER_ROWS_PER_PAGE}
/>
</PortalRootContainerV2>
);
};
export default CustomersPageV2;
|