diff --git a/src/CONST.ts b/src/CONST.ts index 268657bf35b3..dce070a7480b 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -5964,6 +5964,9 @@ const CONST = { ACTION_TYPES: { VIEW: 'view', REVIEW: 'review', + SUBMIT: 'submit', + APPROVE: 'approve', + PAY: 'pay', DONE: 'done', PAID: 'paid', }, diff --git a/src/components/Search/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader.tsx index 1c3370cd72d5..d7b679f21891 100644 --- a/src/components/Search/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader.tsx @@ -182,7 +182,7 @@ function SearchPageHeader({queryJSON, hash}: SearchPageHeaderProps) { return; } - const reportIDList = (selectedReports?.filter((report) => !!report) as string[]) ?? []; + const reportIDList = selectedReports?.filter((report) => !!report) ?? []; SearchActions.exportSearchItemsToCSV( {query: status, jsonQuery: JSON.stringify(queryJSON), reportIDList, transactionIDList: selectedTransactionsKeys, policyIDs: [activeWorkspaceID ?? '']}, () => { diff --git a/src/components/Search/types.ts b/src/components/Search/types.ts index 74bf7b16d020..130ad7ae6f6e 100644 --- a/src/components/Search/types.ts +++ b/src/components/Search/types.ts @@ -24,6 +24,13 @@ type SelectedTransactionInfo = { /** Model of selected results */ type SelectedTransactions = Record; +/** Model of payment data used by Search bulk actions */ +type PaymentData = { + reportID: string; + amount: number; + paymentType: ValueOf; +}; + type SortOrder = ValueOf; type SearchColumnType = ValueOf; type ExpenseSearchStatus = ValueOf; @@ -117,5 +124,6 @@ export type { TripSearchStatus, ChatSearchStatus, SearchAutocompleteResult, + PaymentData, SearchAutocompleteQueryRange, }; diff --git a/src/components/SelectionList/Search/ActionCell.tsx b/src/components/SelectionList/Search/ActionCell.tsx index faafa6159dc1..0a360a96e7c7 100644 --- a/src/components/SelectionList/Search/ActionCell.tsx +++ b/src/components/SelectionList/Search/ActionCell.tsx @@ -4,6 +4,7 @@ import Badge from '@components/Badge'; import Button from '@components/Button'; import * as Expensicons from '@components/Icon/Expensicons'; import useLocalize from '@hooks/useLocalize'; +import useNetwork from '@hooks/useNetwork'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -15,6 +16,9 @@ import type {SearchTransactionAction} from '@src/types/onyx/SearchResults'; const actionTranslationsMap: Record = { view: 'common.view', review: 'common.review', + submit: 'common.submit', + approve: 'iou.approve', + pay: 'iou.pay', done: 'common.done', paid: 'iou.settledExpensify', }; @@ -26,13 +30,23 @@ type ActionCellProps = { goToItem: () => void; isChildListItem?: boolean; parentAction?: string; + isLoading?: boolean; }; -function ActionCell({action = CONST.SEARCH.ACTION_TYPES.VIEW, isLargeScreenWidth = true, isSelected = false, goToItem, isChildListItem = false, parentAction = ''}: ActionCellProps) { +function ActionCell({ + action = CONST.SEARCH.ACTION_TYPES.VIEW, + isLargeScreenWidth = true, + isSelected = false, + goToItem, + isChildListItem = false, + parentAction = '', + isLoading = false, +}: ActionCellProps) { const {translate} = useLocalize(); const theme = useTheme(); const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); + const {isOffline} = useNetwork(); const text = translate(actionTranslationsMap[action]); @@ -61,9 +75,8 @@ function ActionCell({action = CONST.SEARCH.ACTION_TYPES.VIEW, isLargeScreenWidth ); } - const buttonInnerStyles = isSelected ? styles.buttonDefaultHovered : {}; - if (action === CONST.SEARCH.ACTION_TYPES.VIEW || shouldUseViewAction) { + const buttonInnerStyles = isSelected ? styles.buttonDefaultHovered : {}; return isLargeScreenWidth ? (