Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6308,6 +6308,10 @@ const CONST = {
YES: 'yes',
NO: 'no',
},
WITHDRAWAL_TYPE: {
REIMBURSEMENT: 'reimbursement',
EXPENSIFY_CARD: 'expensify-card',
},
TABLE_COLUMN_SIZES: {
NORMAL: 'normal',
WIDE: 'wide',
Expand Down Expand Up @@ -6412,6 +6416,7 @@ const CONST = {
BILLABLE: 'billable',
POLICY_ID: 'policyID',
ACTION: 'action',
WITHDRAWAL_TYPE: 'withdrawalType',
},
TAG_EMPTY_VALUE: 'none',
CATEGORY_EMPTY_VALUE: 'none,Uncategorized',
Expand All @@ -6430,6 +6435,7 @@ const CONST = {
DATE: 'date',
AMOUNT: 'amount',
EXPENSE_TYPE: 'expense-type',
WITHDRAWAL_TYPE: 'withdrawal-type',
CURRENCY: 'currency',
MERCHANT: 'merchant',
DESCRIPTION: 'description',
Expand Down
1 change: 1 addition & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const ROUTES = {
SEARCH_ADVANCED_FILTERS_CARD: 'search/filters/card',
SEARCH_ADVANCED_FILTERS_TAX_RATE: 'search/filters/taxRate',
SEARCH_ADVANCED_FILTERS_EXPENSE_TYPE: 'search/filters/expenseType',
SEARCH_ADVANCED_FILTERS_WITHDRAWAL_TYPE: 'search/filters/withdrawalType',
SEARCH_ADVANCED_FILTERS_TAG: 'search/filters/tag',
SEARCH_ADVANCED_FILTERS_FROM: 'search/filters/from',
SEARCH_ADVANCED_FILTERS_TO: 'search/filters/to',
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const SCREENS = {
ADVANCED_FILTERS_CARD_RHP: 'Search_Advanced_Filters_Card_RHP',
ADVANCED_FILTERS_TAX_RATE_RHP: 'Search_Advanced_Filters_Tax_Rate_RHP',
ADVANCED_FILTERS_EXPENSE_TYPE_RHP: 'Search_Advanced_Filters_Expense_Type_RHP',
ADVANCED_FILTERS_WITHDRAWAL_TYPE_RHP: 'Search_Advanced_Filters_Withdrawal_Type_RHP',
ADVANCED_FILTERS_TAG_RHP: 'Search_Advanced_Filters_Tag_RHP',
ADVANCED_FILTERS_FROM_RHP: 'Search_Advanced_Filters_From_RHP',
ADVANCED_FILTERS_TO_RHP: 'Search_Advanced_Filters_To_RHP',
Expand Down
11 changes: 11 additions & 0 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
}, [autocompleteQueryValue]);

const expenseTypes = Object.values(CONST.SEARCH.TRANSACTION_TYPE);
const withdrawalTypes = Object.values(CONST.SEARCH.WITHDRAWAL_TYPE);
const booleanTypes = Object.values(CONST.SEARCH.BOOLEAN);

const cardAutocompleteList = useMemo(() => Object.values(allCards), [allCards]);
Expand Down Expand Up @@ -374,6 +375,16 @@
text: expenseType,
}));
}
case CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_TYPE: {
const filteredWithdrawalTypes = withdrawalTypes
.filter((withdrawalType) => withdrawalType.includes(autocompleteValue.toLowerCase()) && !alreadyAutocompletedKeys.includes(withdrawalType))
.sort();

return filteredWithdrawalTypes.map((withdrawalType) => ({
filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.WITHDRAWAL_TYPE,
text: withdrawalType,
}));
}
case CONST.SEARCH.SYNTAX_FILTER_KEYS.FEED: {
const filteredFeeds = feedAutoCompleteList
.filter((feed) => feed.name.toLowerCase().includes(autocompleteValue.toLowerCase()) && !alreadyAutocompletedKeys.includes(feed.name.toLowerCase()))
Expand Down Expand Up @@ -444,7 +455,7 @@
return [];
}
}
}, [

Check warning on line 458 in src/components/Search/SearchAutocompleteList.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

React Hook useMemo has a missing dependency: 'withdrawalTypes'. Either include it or remove the dependency array

Check warning on line 458 in src/components/Search/SearchAutocompleteList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useMemo has a missing dependency: 'withdrawalTypes'. Either include it or remove the dependency array
autocompleteParsedQuery,
tagAutocompleteList,
recentTagsAutocompleteList,
Expand Down
49 changes: 49 additions & 0 deletions src/components/Search/SearchPageHeader/SearchFiltersBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@
return [value, displayText];
}, [filterFormValues.postedOn, filterFormValues.postedAfter, filterFormValues.postedBefore, translate]);

const [withdrawalTypeOptions, withdrawalType] = useMemo(() => {
const options = Object.values(CONST.SEARCH.WITHDRAWAL_TYPE).map((value) => {
const getTranslationKey = () => {
switch (value) {
case CONST.SEARCH.WITHDRAWAL_TYPE.REIMBURSEMENT:
return 'search.withdrawalType.reimbursement' as const;
case CONST.SEARCH.WITHDRAWAL_TYPE.EXPENSIFY_CARD:
return 'search.withdrawalType.expensifyCard' as const;
default:
return 'search.withdrawalType.reimbursement' as const;
}
};
return {
value,
text: translate(getTranslationKey()),
};
});
const value = options.find((option) => option.value === filterFormValues.withdrawalType) ?? null;
return [options, value];
}, [filterFormValues.withdrawalType, translate]);

const updateFilterForm = useCallback(
(values: Partial<SearchAdvancedFiltersForm>) => {
const updatedFilterFormValues: Partial<SearchAdvancedFiltersForm> = {
Expand Down Expand Up @@ -221,6 +242,21 @@
[translate, groupByOptions, groupBy, updateFilterForm],
);

const withdrawalTypeComponent = useCallback(
({closeOverlay}: PopoverComponentProps) => {
return (
<SingleSelectPopup
label={translate('search.withdrawalType.title')}
items={withdrawalTypeOptions}
value={withdrawalType}
closeOverlay={closeOverlay}
onChange={(item) => updateFilterForm({withdrawalType: item?.value ?? ''})}
/>
);
},
[translate, withdrawalTypeOptions, withdrawalType, updateFilterForm],
);

const feedComponent = useCallback(
({closeOverlay}: PopoverComponentProps) => {
return (
Expand Down Expand Up @@ -331,6 +367,7 @@
const shouldDisplayGroupByFilter = isDevelopment;
const shouldDisplayFeedFilter = feedOptions.length > 1 && !!filterFormValues.feed;
const shouldDisplayPostedFilter = !!filterFormValues.feed && (!!filterFormValues.postedOn || !!filterFormValues.postedAfter || !!filterFormValues.postedBefore);
const shouldDisplayWithdrawalTypeFilter = !!filterFormValues.withdrawalType;

const filterList = [
{
Expand Down Expand Up @@ -375,6 +412,16 @@
value: status.map((option) => option.text),
filterKey: FILTER_KEYS.STATUS,
},
...(shouldDisplayWithdrawalTypeFilter
? [
{
label: translate('search.withdrawalType.title'),
PopoverComponent: withdrawalTypeComponent,
value: withdrawalType?.text ?? '',
filterKey: FILTER_KEYS.WITHDRAWAL_TYPE,
},
]
: []),
{
label: translate('common.date'),
PopoverComponent: datePickerComponent,
Expand All @@ -390,7 +437,7 @@
].filter((filterItem) => isFilterSupported(filterItem.filterKey, type?.value ?? CONST.SEARCH.DATA_TYPES.EXPENSE));

return filterList;
}, [

Check warning on line 440 in src/components/Search/SearchPageHeader/SearchFiltersBar.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

React Hook useMemo has a missing dependency: 'filterFormValues.withdrawalType'. Either include it or remove the dependency array

Check warning on line 440 in src/components/Search/SearchPageHeader/SearchFiltersBar.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useMemo has a missing dependency: 'filterFormValues.withdrawalType'. Either include it or remove the dependency array
type,
groupBy,
displayDate,
Expand All @@ -413,6 +460,8 @@
feed,
feedComponent,
feedOptions.length,
withdrawalType,
withdrawalTypeComponent,
]);

if (hasErrors) {
Expand Down
5 changes: 5 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6019,6 +6019,11 @@ const translations = {
noCategory: 'Keine Kategorie',
noTag: 'Kein Tag',
expenseType: 'Ausgabentyp',
withdrawalType: {
title: 'Auszahlungstyp',
reimbursement: 'Erstattung',
expensifyCard: 'Expensify card',
},
recentSearches: 'Letzte Suchanfragen',
recentChats: 'Letzte Chats',
searchIn: 'Suche in',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5991,6 +5991,11 @@ const translations = {
noCategory: 'No category',
noTag: 'No tag',
expenseType: 'Expense type',
withdrawalType: {
title: 'Withdrawal type',
reimbursement: 'Reimbursement',
expensifyCard: 'Expensify card',
},
recentSearches: 'Recent searches',
recentChats: 'Recent chats',
searchIn: 'Search in',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6014,6 +6014,11 @@ const translations = {
noCategory: 'Sin categoría',
noTag: 'Sin etiqueta',
expenseType: 'Tipo de gasto',
withdrawalType: {
title: 'Tipo de retiro',
reimbursement: 'Reembolso',
expensifyCard: 'Tarjeta de Expensify',
},
recentSearches: 'Búsquedas recientes',
recentChats: 'Chats recientes',
searchIn: 'Buscar en',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6033,6 +6033,11 @@ const translations = {
noCategory: 'Aucune catégorie',
noTag: 'Aucun tag',
expenseType: 'Type de dépense',
withdrawalType: {
title: 'Type de retrait',
reimbursement: 'Remboursement',
expensifyCard: 'Expensify card',
},
recentSearches: 'Recherches récentes',
recentChats: 'Discussions récentes',
searchIn: 'Rechercher dans',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6035,6 +6035,11 @@ const translations = {
noCategory: 'Nessuna categoria',
noTag: 'Nessun tag',
expenseType: 'Tipo di spesa',
withdrawalType: {
title: 'Tipo di prelievo',
reimbursement: 'Rimborso',
expensifyCard: 'Expensify card',
},
recentSearches: 'Ricerche recenti',
recentChats: 'Chat recenti',
searchIn: 'Cerca in',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5992,6 +5992,11 @@ const translations = {
noCategory: 'カテゴリなし',
noTag: 'タグなし',
expenseType: '経費タイプ',
withdrawalType: {
title: '出金タイプ',
reimbursement: '払い戻し',
expensifyCard: 'Expensify card',
},
recentSearches: '最近の検索',
recentChats: '最近のチャット',
searchIn: 'で検索',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6027,6 +6027,11 @@ const translations = {
noCategory: 'Geen categorie',
noTag: 'Geen tag',
expenseType: 'Uitgavetype',
withdrawalType: {
title: 'Type opname',
reimbursement: 'Terugbetaling',
expensifyCard: 'Expensify card',
},
recentSearches: 'Recente zoekopdrachten',
recentChats: 'Recente chats',
searchIn: 'Zoeken in',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6012,6 +6012,11 @@ const translations = {
noCategory: 'Brak kategorii',
noTag: 'Brak tagu',
expenseType: 'Typ wydatku',
withdrawalType: {
title: 'Typ wypłaty',
reimbursement: 'Zwrot',
expensifyCard: 'Expensify card',
},
recentSearches: 'Ostatnie wyszukiwania',
recentChats: 'Ostatnie czaty',
searchIn: 'Szukaj w',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6026,6 +6026,11 @@ const translations = {
noCategory: 'Sem categoria',
noTag: 'Sem etiqueta',
expenseType: 'Tipo de despesa',
withdrawalType: {
title: 'Tipo de saque',
reimbursement: 'Reembolso',
expensifyCard: 'Expensify card',
},
recentSearches: 'Pesquisas recentes',
recentChats: 'Chats recentes',
searchIn: 'Pesquisar em',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5915,6 +5915,11 @@ const translations = {
noCategory: '无类别',
noTag: '无标签',
expenseType: '费用类型',
withdrawalType: {
title: '提款类型',
reimbursement: '报销',
expensifyCard: 'Expensify card',
},
recentSearches: '最近的搜索',
recentChats: '最近的聊天记录',
searchIn: '搜索在',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ const SearchAdvancedFiltersModalStackNavigator = createModalStackNavigator<Searc
[SCREENS.SEARCH.ADVANCED_FILTERS_CARD_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersCardPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_TAX_RATE_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersTaxRatePage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_EXPENSE_TYPE_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersExpenseTypePage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_WITHDRAWAL_TYPE_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersWithdrawalTypePage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_TAG_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersTagPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_FROM_RHP]: () => require<ReactComponentModule>('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersFromPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_TO_RHP]: () => require<ReactComponentModule>('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersToPage').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const SEARCH_TO_RHP: Partial<Record<keyof SearchFullscreenNavigatorParamList, st
SCREENS.SEARCH.ADVANCED_FILTERS_KEYWORD_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_TAX_RATE_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_EXPENSE_TYPE_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_WITHDRAWAL_TYPE_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_TAG_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_FROM_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_TO_RHP,
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,7 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.SEARCH.ADVANCED_FILTERS_CARD_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_CARD,
[SCREENS.SEARCH.ADVANCED_FILTERS_TAX_RATE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_TAX_RATE,
[SCREENS.SEARCH.ADVANCED_FILTERS_EXPENSE_TYPE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_EXPENSE_TYPE,
[SCREENS.SEARCH.ADVANCED_FILTERS_WITHDRAWAL_TYPE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_WITHDRAWAL_TYPE,
[SCREENS.SEARCH.ADVANCED_FILTERS_TAG_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_TAG,
[SCREENS.SEARCH.ADVANCED_FILTERS_FROM_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_FROM,
[SCREENS.SEARCH.ADVANCED_FILTERS_TO_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_TO,
Expand Down
3 changes: 3 additions & 0 deletions src/libs/SearchAutocompleteUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function filterOutRangesWithCorrectValue(

const typeList = Object.values(CONST.SEARCH.DATA_TYPES) as string[];
const expenseTypeList = Object.values(CONST.SEARCH.TRANSACTION_TYPE) as string[];
const withdrawalTypeList = Object.values(CONST.SEARCH.WITHDRAWAL_TYPE) as string[];
const statusList = Object.values({
...CONST.SEARCH.STATUS.EXPENSE,
...CONST.SEARCH.STATUS.INVOICE,
Expand Down Expand Up @@ -157,6 +158,8 @@ function filterOutRangesWithCorrectValue(
return typeList.includes(range.value);
case CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPENSE_TYPE:
return expenseTypeList.includes(range.value);
case CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_TYPE:
return withdrawalTypeList.includes(range.value);
case CONST.SEARCH.SYNTAX_ROOT_KEYS.STATUS:
return statusList.includes(range.value);
case CONST.SEARCH.SYNTAX_FILTER_KEYS.ACTION:
Expand Down
Loading
Loading