diff --git a/src/components/Search/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader.tsx index 414068c26a0e..eeae0aa63736 100644 --- a/src/components/Search/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader.tsx @@ -171,8 +171,11 @@ function SearchPageHeader({queryJSON, hash}: SearchPageHeaderProps) { } const options: Array> = []; + const isAnyTransactionOnHold = Object.values(selectedTransactions).some((transaction) => transaction.isHeld); + const shouldShowApproveOption = !isOffline && + !isAnyTransactionOnHold && (selectedReports.length ? selectedReports.every((report) => report.action === CONST.SEARCH.ACTION_TYPES.APPROVE) : selectedTransactionsKeys.every((id) => selectedTransactions[id].action === CONST.SEARCH.ACTION_TYPES.APPROVE)); @@ -200,6 +203,7 @@ function SearchPageHeader({queryJSON, hash}: SearchPageHeaderProps) { const shouldShowPayOption = !isOffline && + // !isAnyTransactionOnHold && (selectedReports.length ? selectedReports.every((report) => report.action === CONST.SEARCH.ACTION_TYPES.PAY && report.policyID && lastPaymentMethods[report.policyID]) : selectedTransactionsKeys.every( diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 22c5d5b46699..ea712ddaafd6 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -24,6 +24,7 @@ import isSearchTopmostCentralPane from '@libs/Navigation/isSearchTopmostCentralP import * as ReportUtils from '@libs/ReportUtils'; import * as SearchQueryUtils from '@libs/SearchQueryUtils'; import * as SearchUIUtils from '@libs/SearchUIUtils'; +import * as TransactionUtils from '@libs/TransactionUtils'; import Navigation from '@navigation/Navigation'; import type {AuthScreensParamList} from '@navigation/types'; import EmptySearchView from '@pages/Search/EmptySearchView'; @@ -55,6 +56,7 @@ function mapTransactionItemToSelectedEntry(item: TransactionListItemType): [stri isSelected: true, canDelete: item.canDelete, canHold: item.canHold, + isHeld: TransactionUtils.isOnHold(item), canUnhold: item.canUnhold, action: item.action, reportID: item.reportID, @@ -101,6 +103,7 @@ function prepareTransactionsList(item: TransactionListItemType, selectedTransact isSelected: true, canDelete: item.canDelete, canHold: item.canHold, + isHeld: TransactionUtils.isOnHold(item), canUnhold: item.canUnhold, action: item.action, reportID: item.reportID, @@ -249,6 +252,7 @@ function Search({queryJSON, onSearchListScroll, isSearchScreenFocused, contentCo newTransactionList[transaction.transactionID] = { action: transaction.action, canHold: transaction.canHold, + isHeld: TransactionUtils.isOnHold(transaction), canUnhold: transaction.canUnhold, isSelected: selectedTransactions[transaction.transactionID].isSelected, canDelete: transaction.canDelete, @@ -269,6 +273,7 @@ function Search({queryJSON, onSearchListScroll, isSearchScreenFocused, contentCo newTransactionList[transaction.transactionID] = { action: transaction.action, canHold: transaction.canHold, + isHeld: TransactionUtils.isOnHold(transaction), canUnhold: transaction.canUnhold, isSelected: selectedTransactions[transaction.transactionID].isSelected, canDelete: transaction.canDelete, diff --git a/src/components/Search/types.ts b/src/components/Search/types.ts index e5774d073561..af72b7f6bcc1 100644 --- a/src/components/Search/types.ts +++ b/src/components/Search/types.ts @@ -14,6 +14,9 @@ type SelectedTransactionInfo = { /** If the transaction can be put on hold */ canHold: boolean; + /** Whether the transaction is currently held */ + isHeld: boolean; + /** If the transaction can be removed from hold */ canUnhold: boolean;