Skip to content

Commit df987f6

Browse files
committed
pass billing grace end period data from useOnyx
1 parent 5fc6b58 commit df987f6

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/components/Search/SearchPageHeader/SearchFiltersBar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ function SearchFiltersBar({
146146
}: SearchFiltersBarProps) {
147147
const scrollRef = useRef<FlatList<FilterItem>>(null);
148148
const currentPolicy = usePolicy(currentSelectedPolicyID);
149+
const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true});
149150
const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: isUserValidatedSelector, canBeMissing: true});
150151
const [searchAdvancedFiltersForm = getEmptyObject<Partial<SearchAdvancedFiltersForm>>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
151152
// type, groupBy, status, and view values are not guaranteed to respect the ts type as they come from user input
@@ -807,6 +808,7 @@ function SearchFiltersBar({
807808
activeAdminPolicies,
808809
isUserValidated,
809810
isDelegateAccessRestricted,
811+
userBillingGraceEndPeriodCollection,
810812
showDelegateNoAccessModal,
811813
confirmPayment,
812814
})

src/libs/actions/Search.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import type {SearchAdvancedFiltersForm} from '@src/types/form/SearchAdvancedFilt
5151
import type {
5252
BankAccountList,
5353
Beta,
54+
BillingGraceEndPeriod,
5455
ExportTemplate,
5556
LastPaymentMethod,
5657
LastPaymentMethodType,
@@ -1291,6 +1292,7 @@ function handleBulkPayItemSelected(params: {
12911292
activeAdminPolicies: Policy[];
12921293
isUserValidated: boolean | undefined;
12931294
isDelegateAccessRestricted: boolean;
1295+
userBillingGraceEndPeriodCollection: OnyxCollection<BillingGraceEndPeriod>;
12941296
showDelegateNoAccessModal: () => void;
12951297
confirmPayment?: (paymentType: PaymentMethodType | undefined, additionalData?: Record<string, unknown>) => void;
12961298
}) {
@@ -1304,6 +1306,7 @@ function handleBulkPayItemSelected(params: {
13041306
activeAdminPolicies,
13051307
isUserValidated,
13061308
isDelegateAccessRestricted,
1309+
userBillingGraceEndPeriodCollection,
13071310
showDelegateNoAccessModal,
13081311
confirmPayment,
13091312
} = params;
@@ -1323,7 +1326,7 @@ function handleBulkPayItemSelected(params: {
13231326
return;
13241327
}
13251328

1326-
if (policy && shouldRestrictUserBillableActions(policy?.id)) {
1329+
if (policy && shouldRestrictUserBillableActions(policy?.id, userBillingGraceEndPeriodCollection)) {
13271330
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy?.id));
13281331
return;
13291332
}

src/pages/Search/SearchSelectedNarrow.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type SearchSelectedNarrowProps = {
3434

3535
function SearchSelectedNarrow({options, itemsLength, currentSelectedPolicyID, currentSelectedReportID, confirmPayment, latestBankItems}: SearchSelectedNarrowProps) {
3636
const styles = useThemeStyles();
37+
const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true});
3738
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
3839
const [selectedIouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${currentSelectedReportID}`, {canBeMissing: true});
3940
const {translate, localeCompare} = useLocalize();
@@ -95,6 +96,7 @@ function SearchSelectedNarrow({options, itemsLength, currentSelectedPolicyID, cu
9596
activeAdminPolicies,
9697
isUserValidated,
9798
isDelegateAccessRestricted,
99+
userBillingGraceEndPeriodCollection,
98100
showDelegateNoAccessModal,
99101
confirmPayment,
100102
})

0 commit comments

Comments
 (0)