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 | 4x 3x 3x 3x 3x 3x 1x 1x 3x | import React, { useEffect } from "react";
import { Checkbox } from "../Checkbox";
import { useBulkMarkMerchants } from "@components/AcquirerMerchants/hooks/useBulkMarkMerchants";
import { useAppDispatch } from "@redux/hooks";
import { resetMarkedMerchants } from "@redux/slices/enterprise/merchants";
import useCheckSponsor from "@hooks/common/useCheckSponsor";
import { CustomToolTip } from "../BusinessOwners/CustomToolTip";
import { ACTION_DENY_MESSAGE } from "@constants/permissions";
import { Box } from "@mui/material";
import { useGetBackgroundTaskStatus } from "@components/AcquirerMerchants/hooks/useGetBackgroundTaskStatus";
const MarkAllCheckBox = () => {
const { isMarkAllChecked, toggleBulkMark, readyForReviewCount } =
useBulkMarkMerchants();
const dispatch = useAppDispatch();
const { hasSponsorAccess } = useCheckSponsor();
useGetBackgroundTaskStatus({ enabled: true });
useEffect(() => {
// reset marked merchants on page exit
return () => {
dispatch(resetMarkedMerchants({}));
};
}, []);
return (
<CustomToolTip
message={ACTION_DENY_MESSAGE}
showToolTip={!hasSponsorAccess}
>
<Box onClick={(e) => e.stopPropagation()}>
<Checkbox
onClick={(e) => e.stopPropagation()}
onChange={(e) => {
toggleBulkMark && toggleBulkMark(e.target.checked);
}}
disabled={!hasSponsorAccess || readyForReviewCount === 0}
aria-disabled={false}
checked={isMarkAllChecked}
data-testid="mark-all-checkbox"
/>
</Box>
</CustomToolTip>
);
};
export default React.memo(MarkAllCheckBox);
|