-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add view transactions cta to Expensify card and company cards page #55095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
cc64293
e474137
936ddc7
4bda948
0f925fb
2b5511c
90ea140
ab09dbb
3453dca
6e9621c
4a800f6
84fbd33
d7e8ca2
bbb8385
3238b9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -615,14 +615,22 @@ function buildCannedSearchQuery({ | |
type = CONST.SEARCH.DATA_TYPES.EXPENSE, | ||
status = CONST.SEARCH.STATUS.EXPENSE.ALL, | ||
policyID, | ||
cardID, | ||
}: { | ||
type?: SearchDataTypes; | ||
status?: SearchStatus; | ||
policyID?: string; | ||
cardID?: string; | ||
} = {}): SearchQueryString { | ||
const queryString = policyID | ||
? `type:${type} status:${Array.isArray(status) ? status.join(',') : status} policyID:${policyID}` | ||
: `type:${type} status:${Array.isArray(status) ? status.join(',') : status}`; | ||
let queryString = `type:${type} status:${Array.isArray(status) ? status.join(',') : status}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you try to mock some transaction data and see if we get the search results ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same as before. I haven't tested this part. Did you notice any issues? |
||
|
||
if (policyID) { | ||
queryString = `type:${type} status:${Array.isArray(status) ? status.join(',') : status} policyID:${policyID}`; | ||
} | ||
|
||
if (cardID) { | ||
queryString = `type:${type} status:${Array.isArray(status) ? status.join(',') : status} expense-type:card card:${cardID}`; | ||
} | ||
|
||
// Parse the query to fill all default query fields with values | ||
const normalizedQueryJSON = buildSearchQueryJSON(queryString); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,18 +17,19 @@ | |
import usePolicy from '@hooks/usePolicy'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as CardUtils from '@libs/CardUtils'; | ||
Check failure on line 20 in src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx
|
||
import * as ErrorUtils from '@libs/ErrorUtils'; | ||
Check failure on line 21 in src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx
|
||
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; | ||
import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; | ||
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; | ||
Check failure on line 24 in src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx
|
||
import * as PolicyUtils from '@libs/PolicyUtils'; | ||
Check failure on line 25 in src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx
|
||
import {getConnectedIntegration} from '@libs/PolicyUtils'; | ||
import * as SearchQueryUtils from '@libs/SearchQueryUtils'; | ||
Check failure on line 27 in src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx
|
||
import Navigation from '@navigation/Navigation'; | ||
import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; | ||
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
import variables from '@styles/variables'; | ||
import * as CompanyCards from '@userActions/CompanyCards'; | ||
Check failure on line 32 in src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx
|
||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import ROUTES from '@src/ROUTES'; | ||
|
@@ -169,6 +170,17 @@ | |
title={card?.scrapeMinDate ? format(parseISO(card.scrapeMinDate), CONST.DATE.FNS_FORMAT_STRING) : ''} | ||
interactive={false} | ||
/> | ||
<MenuItem | ||
icon={Expensicons.MoneySearch} | ||
title={translate('workspace.common.viewTransactions')} | ||
onPress={() => { | ||
Navigation.navigate( | ||
ROUTES.SEARCH_CENTRAL_PANE.getRoute({ | ||
query: SearchQueryUtils.buildCannedSearchQuery({type: CONST.SEARCH.DATA_TYPES.EXPENSE, status: CONST.SEARCH.STATUS.EXPENSE.ALL, cardID}), | ||
}), | ||
); | ||
}} | ||
/> | ||
<OfflineWithFeedback | ||
pendingAction={card?.pendingFields?.lastScrape} | ||
errorRowStyles={[styles.ph5, styles.mb3]} | ||
|
@@ -180,7 +192,6 @@ | |
disabled={isOffline || card?.isLoadingLastUpdated} | ||
iconFill={theme.success} | ||
title={translate('workspace.moreFeatures.companyCards.updateCard')} | ||
style={styles.mv1} | ||
brickRoadIndicator={card?.errorFields?.lastScrape ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} | ||
onPress={updateCard} | ||
/> | ||
|
@@ -189,7 +200,7 @@ | |
icon={Expensicons.RemoveMembers} | ||
iconFill={theme.success} | ||
title={translate('workspace.moreFeatures.companyCards.unassignCard')} | ||
style={styles.mv1} | ||
style={styles.mb1} | ||
onPress={() => setIsUnassignModalVisible(true)} | ||
/> | ||
<ConfirmModal | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,13 @@ | |
import useNetwork from '@hooks/useNetwork'; | ||
import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as CardUtils from '@libs/CardUtils'; | ||
Check failure on line 21 in src/pages/workspace/expensifyCard/WorkspaceExpensifyCardDetailsPage.tsx
|
||
import * as CurrencyUtils from '@libs/CurrencyUtils'; | ||
Check failure on line 22 in src/pages/workspace/expensifyCard/WorkspaceExpensifyCardDetailsPage.tsx
|
||
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; | ||
import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; | ||
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; | ||
Check failure on line 25 in src/pages/workspace/expensifyCard/WorkspaceExpensifyCardDetailsPage.tsx
|
||
import * as PolicyUtils from '@libs/PolicyUtils'; | ||
Check failure on line 26 in src/pages/workspace/expensifyCard/WorkspaceExpensifyCardDetailsPage.tsx
|
||
import * as SearchQueryUtils from '@libs/SearchQueryUtils'; | ||
import Navigation from '@navigation/Navigation'; | ||
import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; | ||
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
|
@@ -53,7 +54,7 @@ | |
const [cardsList, cardsListResult] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${CONST.EXPENSIFY_CARD.BANK}`); | ||
|
||
const card = cardsList?.[cardID]; | ||
const cardholder = personalDetails?.[card?.accountID ?? -1]; | ||
const cardholder = personalDetails?.[card?.accountID ?? CONST.DEFAULT_NUMBER_ID]; | ||
const isVirtual = !!card?.nameValuePairs?.isVirtual; | ||
const formattedAvailableSpendAmount = CurrencyUtils.convertToDisplayString(card?.availableSpend); | ||
const formattedLimit = CurrencyUtils.convertToDisplayString(card?.nameValuePairs?.unapprovedExpenseLimit); | ||
|
@@ -158,10 +159,21 @@ | |
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD_NAME.getRoute(policyID, cardID))} | ||
/> | ||
</OfflineWithFeedback> | ||
<MenuItem | ||
icon={Expensicons.MoneySearch} | ||
title={translate('workspace.common.viewTransactions')} | ||
onPress={() => { | ||
Navigation.navigate( | ||
ROUTES.SEARCH_CENTRAL_PANE.getRoute({ | ||
query: SearchQueryUtils.buildCannedSearchQuery({type: CONST.SEARCH.DATA_TYPES.EXPENSE, status: CONST.SEARCH.STATUS.EXPENSE.ALL, cardID}), | ||
}), | ||
); | ||
}} | ||
/> | ||
<MenuItem | ||
icon={Expensicons.Trashcan} | ||
title={translate('workspace.expensifyCard.deactivate')} | ||
style={styles.mv1} | ||
style={styles.mb1} | ||
onPress={() => (isOffline ? setIsOfflineModalVisible(true) : setIsDeactivateModalVisible(true))} | ||
/> | ||
<ConfirmModal | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we confirm this translation ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.