Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Fixes Process Payments button not being enabled if all RBs from all the period pages are selected #113

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import PageTitle from "components/PageTitle";
import {
getWorkPeriodsHasSelectedItems,
getWorkPeriodsIsProcessingPayments,
getWorkPeriodsIsSelectedAll,
} from "store/selectors/workPeriods";
import { processPayments } from "store/thunks/workPeriods";
import styles from "./styles.module.scss";

const PeriodsContentHeader = () => {
const hasSelectedItems = useSelector(getWorkPeriodsHasSelectedItems);
const isProcessingPayments = useSelector(getWorkPeriodsIsProcessingPayments);
const isSelectedAll = useSelector(getWorkPeriodsIsSelectedAll);
const dispatch = useDispatch();

const onProcessPaymentsClick = useCallback(() => {
Expand All @@ -25,7 +27,9 @@ const PeriodsContentHeader = () => {
<Button
className={styles.button}
variant="contained"
isDisabled={!hasSelectedItems || isProcessingPayments}
isDisabled={
isProcessingPayments || !(hasSelectedItems || isSelectedAll)
}
onClick={onProcessPaymentsClick}
>
Process Payment
Expand Down