Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6313f33
added Accounting section
s77rt Jun 20, 2025
fd2bd4a
lock accounting section behind email check
s77rt Jun 20, 2025
c01c955
added accounting unapproved menu items
s77rt Jun 20, 2025
dc5eda2
simplify should show suggestions logic
s77rt Jun 21, 2025
b50b507
add group by filter
s77rt Jun 21, 2025
3015760
rename ReportListItem to TransactionGroupListItem
s77rt Jun 21, 2025
85f8bc8
replace ReportListItemType with TransactionGroupListItemType and prep…
s77rt Jun 21, 2025
ae1c39c
lint
s77rt Jun 21, 2025
704c714
spell check
s77rt Jun 21, 2025
737d018
rename ReportListItemProps to TransactionGroupListItemProps
s77rt Jun 21, 2025
bd8c14a
added TransactionReportGroupListItemType and TransactionMemberGroupLi…
s77rt Jun 21, 2025
dfd08e3
better types + lint
s77rt Jun 21, 2025
56fd3cf
added MemberListItemHeader
s77rt Jun 21, 2025
8663dc8
lint
s77rt Jun 21, 2025
b23016a
better type-safe headers
s77rt Jun 22, 2025
74c96b6
lint
s77rt Jun 22, 2025
c753b3a
implemented SearchDatePresetFilterBase (most of it)
s77rt Jun 22, 2025
6997ee3
added presets prop to SearchDatePresetFilterBase
s77rt Jun 22, 2025
281e3ea
use SearchDatePresetFilterBase in SearchFiltersExportedPage
s77rt Jun 22, 2025
3292eff
correctly build date filter values that use preset
s77rt Jun 22, 2025
e98d77a
lint
s77rt Jun 22, 2025
8162eba
show group by filter only if supported
s77rt Jun 22, 2025
857b45d
add missing return
s77rt Jun 22, 2025
6ddff02
mark groupBy filter as supported in type expense and trip
s77rt Jun 22, 2025
825ee6f
display group by filter in top bar only if supported
s77rt Jun 22, 2025
cb1c37f
resolve circular dependency
s77rt Jun 23, 2025
3ea586c
add groupBy advanced filter page
s77rt Jun 23, 2025
5040ae0
show company card accural based solely on card feed
s77rt Jun 23, 2025
d2d794b
fix reset SingleSelectPopup
s77rt Jun 23, 2025
3775d70
exclude unreported expenses if grouping by reports or members
s77rt Jun 23, 2025
cb727cb
remove common.never translation
s77rt Jun 23, 2025
3f21063
fix tests and spellcheck
s77rt Jun 23, 2025
b79d1c9
lint
s77rt Jun 23, 2025
c22ded3
remove common.never from italian translation file
s77rt Jun 23, 2025
e0474c2
translate
s77rt Jun 23, 2025
315659e
lock changes behind DEV
s77rt Jun 23, 2025
c48b5c2
use correct icon
s77rt Jun 23, 2025
57ec706
lint
s77rt Jun 23, 2025
f61f567
merge main
s77rt Jun 23, 2025
47ab609
spanish translation for groupBy
s77rt Jun 24, 2025
7de91e4
remove unnecessary unknown casting
s77rt Jun 24, 2025
240367f
clean up date filters build logic
s77rt Jun 24, 2025
7ac4ed7
better comment
s77rt Jun 24, 2025
61dd158
pass hasCardFeed instead of allCards to createTypeMenuSections
s77rt Jun 24, 2025
e03626b
move isSearchDatePreset and isFilterSupported to SearchQueryUtils
s77rt Jun 24, 2025
a7725ee
add missing key to loop-rendered views
s77rt Jun 24, 2025
6aa5cf9
merge main
s77rt Jun 24, 2025
a562a12
ts
s77rt Jun 24, 2025
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
13 changes: 13 additions & 0 deletions assets/images/money-hourglass.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 130 additions & 1 deletion src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6547,7 +6547,6 @@ const CONST = {
},

SEARCH: {
NEVER: 'never',
RESULTS_PAGE_SIZE: 50,
DATA_TYPES: {
EXPENSE: 'expense',
Expand Down Expand Up @@ -6586,6 +6585,7 @@ const CONST = {
},
GROUP_BY: {
REPORTS: 'reports',
MEMBERS: 'members',
},
BOOLEAN: {
YES: 'yes',
Expand Down Expand Up @@ -6742,6 +6742,10 @@ const CONST = {
AFTER: 'After',
ON: 'On',
},
DATE_PRESETS: {
NEVER: 'never',
LAST_MONTH: 'last-month',
},
SNAPSHOT_ONYX_KEYS: [
ONYXKEYS.COLLECTION.REPORT,
ONYXKEYS.COLLECTION.POLICY,
Expand All @@ -6753,6 +6757,131 @@ const CONST = {
],
},

/**
* SEARCH_TYPE_FILTERS_KEYS is an object keyed by the different search types.
* Each value is then an array of arrays where each inner array is a separate section in the UI.
*/
get SEARCH_TYPE_FILTERS_KEYS() {
return {
[this.SEARCH.DATA_TYPES.EXPENSE]: [
[
this.SEARCH.SYNTAX_FILTER_KEYS.TYPE,
this.SEARCH.SYNTAX_FILTER_KEYS.FROM,
this.SEARCH.SYNTAX_FILTER_KEYS.TO,
this.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD,
this.SEARCH.SYNTAX_FILTER_KEYS.STATUS,
this.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID,
this.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY,
],
[
this.SEARCH.SYNTAX_FILTER_KEYS.EXPENSE_TYPE,
this.SEARCH.SYNTAX_FILTER_KEYS.MERCHANT,
this.SEARCH.SYNTAX_FILTER_KEYS.DATE,
this.SEARCH.SYNTAX_FILTER_KEYS.AMOUNT,
this.SEARCH.SYNTAX_FILTER_KEYS.CURRENCY,
this.SEARCH.SYNTAX_FILTER_KEYS.CATEGORY,
this.SEARCH.SYNTAX_FILTER_KEYS.TAG,
this.SEARCH.SYNTAX_FILTER_KEYS.DESCRIPTION,
this.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID,
this.SEARCH.SYNTAX_FILTER_KEYS.POSTED,
this.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE,
this.SEARCH.SYNTAX_FILTER_KEYS.REIMBURSABLE,
this.SEARCH.SYNTAX_FILTER_KEYS.BILLABLE,
],
[
this.SEARCH.SYNTAX_FILTER_KEYS.REPORT_ID,
this.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED,
this.SEARCH.SYNTAX_FILTER_KEYS.APPROVED,
this.SEARCH.SYNTAX_FILTER_KEYS.PAID,
this.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED,
],
],
[this.SEARCH.DATA_TYPES.INVOICE]: [
[
this.SEARCH.SYNTAX_FILTER_KEYS.TYPE,
this.SEARCH.SYNTAX_FILTER_KEYS.FROM,
this.SEARCH.SYNTAX_FILTER_KEYS.TO,
this.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD,
this.SEARCH.SYNTAX_FILTER_KEYS.STATUS,
this.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID,
],
[
this.SEARCH.SYNTAX_FILTER_KEYS.MERCHANT,
this.SEARCH.SYNTAX_FILTER_KEYS.DATE,
this.SEARCH.SYNTAX_FILTER_KEYS.AMOUNT,
this.SEARCH.SYNTAX_FILTER_KEYS.CURRENCY,
this.SEARCH.SYNTAX_FILTER_KEYS.CATEGORY,
this.SEARCH.SYNTAX_FILTER_KEYS.TAG,
this.SEARCH.SYNTAX_FILTER_KEYS.DESCRIPTION,
this.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID,
this.SEARCH.SYNTAX_FILTER_KEYS.POSTED,
this.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE,
],
[
this.SEARCH.SYNTAX_FILTER_KEYS.REPORT_ID,
this.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED,
this.SEARCH.SYNTAX_FILTER_KEYS.APPROVED,
this.SEARCH.SYNTAX_FILTER_KEYS.PAID,
this.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED,
],
],
[this.SEARCH.DATA_TYPES.TRIP]: [
[
this.SEARCH.SYNTAX_FILTER_KEYS.TYPE,
this.SEARCH.SYNTAX_FILTER_KEYS.FROM,
this.SEARCH.SYNTAX_FILTER_KEYS.TO,
this.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD,
this.SEARCH.SYNTAX_FILTER_KEYS.STATUS,
this.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID,
this.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY,
],
[
this.SEARCH.SYNTAX_FILTER_KEYS.MERCHANT,
this.SEARCH.SYNTAX_FILTER_KEYS.DATE,
this.SEARCH.SYNTAX_FILTER_KEYS.AMOUNT,
this.SEARCH.SYNTAX_FILTER_KEYS.CURRENCY,
this.SEARCH.SYNTAX_FILTER_KEYS.CATEGORY,
this.SEARCH.SYNTAX_FILTER_KEYS.TAG,
this.SEARCH.SYNTAX_FILTER_KEYS.DESCRIPTION,
this.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID,
this.SEARCH.SYNTAX_FILTER_KEYS.POSTED,
this.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE,
],
[
this.SEARCH.SYNTAX_FILTER_KEYS.REPORT_ID,
this.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED,
this.SEARCH.SYNTAX_FILTER_KEYS.APPROVED,
this.SEARCH.SYNTAX_FILTER_KEYS.PAID,
this.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED,
],
],
[this.SEARCH.DATA_TYPES.CHAT]: [
[
this.SEARCH.SYNTAX_FILTER_KEYS.TYPE,
this.SEARCH.SYNTAX_FILTER_KEYS.FROM,
this.SEARCH.SYNTAX_FILTER_KEYS.TO,
this.SEARCH.SYNTAX_FILTER_KEYS.IN,
this.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD,
this.SEARCH.SYNTAX_FILTER_KEYS.STATUS,
this.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID,
this.SEARCH.SYNTAX_FILTER_KEYS.DATE,
],
],
[this.SEARCH.DATA_TYPES.TASK]: [
[
this.SEARCH.SYNTAX_FILTER_KEYS.TYPE,
this.SEARCH.SYNTAX_FILTER_KEYS.TITLE,
this.SEARCH.SYNTAX_FILTER_KEYS.DESCRIPTION,
this.SEARCH.SYNTAX_FILTER_KEYS.IN,
this.SEARCH.SYNTAX_FILTER_KEYS.FROM,
this.SEARCH.SYNTAX_FILTER_KEYS.ASSIGNEE,
this.SEARCH.SYNTAX_FILTER_KEYS.STATUS,
this.SEARCH.SYNTAX_FILTER_KEYS.DATE,
],
],
} as const;
},

EXPENSE: {
TYPE: {
CASH_CARD_NAME: 'Cash Expense',
Expand Down
1 change: 1 addition & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const ROUTES = {
},
SEARCH_ADVANCED_FILTERS: 'search/filters',
SEARCH_ADVANCED_FILTERS_TYPE: 'search/filters/type',
SEARCH_ADVANCED_FILTERS_GROUP_BY: 'search/filters/groupBy',
SEARCH_ADVANCED_FILTERS_STATUS: 'search/filters/status',
SEARCH_ADVANCED_FILTERS_DATE: 'search/filters/date',
SEARCH_ADVANCED_FILTERS_CURRENCY: 'search/filters/currency',
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const SCREENS = {
REPORT_RHP: 'Search_Report_RHP',
ADVANCED_FILTERS_RHP: 'Search_Advanced_Filters_RHP',
ADVANCED_FILTERS_TYPE_RHP: 'Search_Advanced_Filters_Type_RHP',
ADVANCED_FILTERS_GROUP_BY_RHP: 'Search_Advanced_Filters_GroupBy_RHP',
ADVANCED_FILTERS_STATUS_RHP: 'Search_Advanced_Filters_Status_RHP',
ADVANCED_FILTERS_DATE_RHP: 'Search_Advanced_Filters_Date_RHP',
ADVANCED_FILTERS_SUBMITTED_RHP: 'Search_Advanced_Filters_Submitted_RHP',
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ import Meter from '@assets/images/meter.svg';
import Minus from '@assets/images/minus.svg';
import MoneyBag from '@assets/images/money-bag.svg';
import MoneyCircle from '@assets/images/money-circle.svg';
import MoneyHourglass from '@assets/images/money-hourglass.svg';
import MoneySearch from '@assets/images/money-search.svg';
import MoneyWaving from '@assets/images/money-waving.svg';
import Monitor from '@assets/images/monitor.svg';
Expand Down Expand Up @@ -361,6 +362,7 @@ export {
MoneyCircle,
MoneySearch,
MoneyWaving,
MoneyHourglass,
Monitor,
Mute,
ExpensifyLogoNew,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Search/FilterDropdowns/SingleSelectPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ function SingleSelectPopup<T extends string>({label, value, items, closeOverlay,
}, [closeOverlay, onChange, selectedItem]);

const resetChanges = useCallback(() => {
Comment thread
JS00001 marked this conversation as resolved.
Resolved
onChange(items.at(0) ?? null);
onChange(null);
closeOverlay();
}, [closeOverlay, items, onChange]);
}, [closeOverlay, onChange]);

return (
<View style={[!isSmallScreenWidth && styles.pv4, styles.gap2]}>
Expand Down
11 changes: 9 additions & 2 deletions src/components/Search/SearchContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useCallback, useContext, useMemo, useRef, useState} from 'react';
import {isMoneyRequestReport} from '@libs/ReportUtils';
import {isReportListItemType, isTransactionListItemType} from '@libs/SearchUIUtils';
import {isTransactionListItemType, isTransactionMemberGroupListItemType, isTransactionReportGroupListItemType} from '@libs/SearchUIUtils';
import CONST from '@src/CONST';
import type ChildrenProps from '@src/types/utils/ChildrenProps';
import type {SearchContext, SearchContextData} from './types';
Expand Down Expand Up @@ -63,12 +63,19 @@ function SearchContextProvider({children}: ChildrenProps) {
// When selecting transactions, we also need to manage the reports to which these transactions belong. This is done to ensure proper exporting to CSV.
let selectedReports: SearchContext['selectedReports'] = [];

if (data.length && data.every(isReportListItemType)) {
if (data.length && data.every(isTransactionReportGroupListItemType)) {
selectedReports = data
.filter((item) => isMoneyRequestReport(item) && item.transactions.every(({keyForList}) => selectedTransactions[keyForList]?.isSelected))
.map(({reportID, action = CONST.SEARCH.ACTION_TYPES.VIEW, total = CONST.DEFAULT_NUMBER_ID, policyID}) => ({reportID, action, total, policyID}));
}

if (data.length && data.every(isTransactionMemberGroupListItemType)) {
selectedReports = data
.flatMap((item) => item.transactions)
.filter(({keyForList}) => !!keyForList && selectedTransactions[keyForList]?.isSelected)
.map(({reportID, action = CONST.SEARCH.ACTION_TYPES.VIEW, amount: total = CONST.DEFAULT_NUMBER_ID, policyID}) => ({reportID, action, total, policyID}));
}

if (data.length && data.every(isTransactionListItemType)) {
selectedReports = data
.filter(({keyForList}) => !!keyForList && selectedTransactions[keyForList]?.isSelected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type CalendarViewProps = {
};

function SearchDateFilterBaseCalendarView({view, value, navigateBack, setValue}: CalendarViewProps) {
const initialValue = value === CONST.SEARCH.NEVER ? null : value;
const initialValue = value === CONST.SEARCH.DATE_PRESETS.NEVER ? null : value;

const styles = useThemeStyles();
const {translate} = useLocalize();
Expand Down
4 changes: 2 additions & 2 deletions src/components/Search/SearchDateFilterBase/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function SearchDateFilterBase({dateKey, titleKey}: SearchDateFilterBaseProps) {
const setDateValue = (key: SearchDateModifier, dateValue: string | null) => {
setLocalDateValues((currentValue) => {
// If we are setting the 'on' to 'never', reset the other dates
if (key === CONST.SEARCH.DATE_MODIFIERS.ON && dateValue === CONST.SEARCH.NEVER) {
if (key === CONST.SEARCH.DATE_MODIFIERS.ON && dateValue === CONST.SEARCH.DATE_PRESETS.NEVER) {
return {
[CONST.SEARCH.DATE_MODIFIERS.ON]: dateValue,
[CONST.SEARCH.DATE_MODIFIERS.AFTER]: null,
Expand All @@ -43,7 +43,7 @@ function SearchDateFilterBase({dateKey, titleKey}: SearchDateFilterBaseProps) {
}

// If we are setting any other value while 'on' is set to 'never', reset 'on' to null
if (key !== CONST.SEARCH.DATE_MODIFIERS.ON && currentValue?.[CONST.SEARCH.DATE_MODIFIERS.ON] === CONST.SEARCH.NEVER) {
if (key !== CONST.SEARCH.DATE_MODIFIERS.ON && currentValue?.[CONST.SEARCH.DATE_MODIFIERS.ON] === CONST.SEARCH.DATE_PRESETS.NEVER) {
return {
...currentValue,
[key]: dateValue,
Expand Down
Loading