Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7619,6 +7619,7 @@ const CONST = {
STATEMENTS: 'statements',
UNAPPROVED_CASH: 'unapprovedCash',
UNAPPROVED_CARD: 'unapprovedCard',
EXPENSIFY_CARD: 'expensifyCard',
RECONCILIATION: 'reconciliation',
TOP_SPENDERS: 'topSpenders',
TOP_CATEGORIES: 'topCategories',
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useSearchShouldCalculateTotals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function useSearchShouldCalculateTotals(searchKey: SearchKey | undefined, search
CONST.SEARCH.SEARCH_KEYS.STATEMENTS,
CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CASH,
CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CARD,
CONST.SEARCH.SEARCH_KEYS.EXPENSIFY_CARD,
CONST.SEARCH.SEARCH_KEYS.RECONCILIATION,
];

Expand Down
2 changes: 2 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7099,6 +7099,8 @@ Fordern Sie Spesendetails wie Belege und Beschreibungen an, legen Sie Limits und
groupColumns: 'Spalten gruppieren',
expenseColumns: 'Spalten für Ausgaben',
statements: 'Abrechnungen',
cardStatements: 'Kartenabrechnungen',
monthlyAccrual: 'Monatliche Abgrenzung',
unapprovedCash: 'Nicht genehmigtes Bargeld',
unapprovedCard: 'Nicht genehmigte Karte',
reconciliation: 'Abstimmung',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7050,6 +7050,8 @@ const translations = {
groupColumns: 'Group columns',
expenseColumns: 'Expense Columns',
statements: 'Statements',
cardStatements: 'Card statements',
monthlyAccrual: 'Monthly accrual',
unapprovedCash: 'Unapproved cash',
unapprovedCard: 'Unapproved card',
reconciliation: 'Reconciliation',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6907,6 +6907,8 @@ ${amount} para ${merchant} - ${date}`,
groupColumns: 'Columnas de grupo',
expenseColumns: 'Columnas de gastos',
statements: 'Extractos',
cardStatements: 'Extractos de tarjeta',
monthlyAccrual: 'Devengo mensual',
unapprovedCash: 'Efectivo no aprobado',
unapprovedCard: 'Tarjeta no aprobada',
reconciliation: 'Conciliación',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7120,6 +7120,8 @@ Rendez obligatoires des informations de dépense comme les reçus et les descrip
groupColumns: 'Regrouper les colonnes',
expenseColumns: 'Colonnes de dépenses',
statements: 'Relevés',
cardStatements: 'Relevés de carte',
monthlyAccrual: 'Régularisation mensuelle',
unapprovedCash: 'Espèces non approuvées',
unapprovedCard: 'Carte non approuvée',
reconciliation: 'Rapprochement',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7085,6 +7085,8 @@ Richiedi dettagli sulle spese come ricevute e descrizioni, imposta limiti e valo
groupColumns: 'Raggruppa colonne',
expenseColumns: 'Colonne spese',
statements: 'Estratti conto',
cardStatements: 'Estratti carta',
monthlyAccrual: 'Rateo mensile',
unapprovedCash: 'Contanti non approvati',
unapprovedCard: 'Carta non approvata',
reconciliation: 'Riconciliazione',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7012,6 +7012,8 @@ ${reportName}
groupColumns: '列をグループ化',
expenseColumns: '経費列',
statements: 'ステートメント',
cardStatements: 'カード明細',
monthlyAccrual: '月次発生',
unapprovedCash: '未承認の現金',
unapprovedCard: '未承認のカード',
reconciliation: '照合',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7064,6 +7064,8 @@ Vereis onkostendetails zoals bonnen en beschrijvingen, stel limieten en standaar
groupColumns: 'Kolommen groeperen',
expenseColumns: 'Onkostencolommen',
statements: 'Afschriften',
cardStatements: 'Kaartafschriften',
monthlyAccrual: 'Maandelijkse opbouw',
unapprovedCash: 'Niet-goedgekeurde contante uitgaven',
unapprovedCard: 'Niet-goedgekeurde kaart',
reconciliation: 'Afstemming',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7052,6 +7052,8 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i
groupColumns: 'Grupuj kolumny',
expenseColumns: 'Kolumny wydatków',
statements: 'Wyciągi',
cardStatements: 'Wyciągi kartowe',
monthlyAccrual: 'Miesięczne rozliczenie',
unapprovedCash: 'Niezaakceptowana gotówka',
unapprovedCard: 'Niezaakceptowana karta',
reconciliation: 'Uzgodnienie',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7056,6 +7056,8 @@ Exija dados de despesas como recibos e descrições, defina limites e padrões e
groupColumns: 'Agrupar colunas',
expenseColumns: 'Colunas de despesas',
statements: 'Extratos',
cardStatements: 'Extratos de cartão',
monthlyAccrual: 'Acréscimo mensal',
unapprovedCash: 'Dinheiro não aprovado',
unapprovedCard: 'Cartão não aprovado',
reconciliation: 'Conciliação',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6900,6 +6900,8 @@ ${reportName}
groupColumns: '分组列',
expenseColumns: '报销列',
statements: '对账单',
cardStatements: '卡对账单',
monthlyAccrual: '月度计提',
unapprovedCash: '未批准现金',
unapprovedCard: '未批准的卡片',
reconciliation: '对账',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/SearchQueryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function getQueryHashes(query: SearchQueryJSON): {primaryHash: number; recentSea

// Certain filters' values are significant in deciding which search we are on, so we want to include
// their value when computing the similarSearchHash
const similarSearchValueBasedFilters = new Set<SearchFilterKey>([CONST.SEARCH.SYNTAX_FILTER_KEYS.ACTION]);
const similarSearchValueBasedFilters = new Set<SearchFilterKey>([CONST.SEARCH.SYNTAX_FILTER_KEYS.ACTION, CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_TYPE]);

const flatFilters = query.flatFilters
.map((filter) => {
Expand Down
122 changes: 92 additions & 30 deletions src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ function getSuggestedSearches(
},
[CONST.SEARCH.SEARCH_KEYS.STATEMENTS]: {
key: CONST.SEARCH.SEARCH_KEYS.STATEMENTS,
translationPath: 'search.statements',
translationPath: 'search.cardStatements',
type: CONST.SEARCH.DATA_TYPES.EXPENSE,
icon: 'CreditCard',
searchQuery: buildQueryStringFromFilterFormValues({
Expand Down Expand Up @@ -743,17 +743,52 @@ function getSuggestedSearches(
return this.searchQueryJSON?.similarSearchHash ?? CONST.DEFAULT_NUMBER_ID;
},
},
[CONST.SEARCH.SEARCH_KEYS.EXPENSIFY_CARD]: {
key: CONST.SEARCH.SEARCH_KEYS.EXPENSIFY_CARD,
translationPath: 'workspace.common.expensifyCard',
type: CONST.SEARCH.DATA_TYPES.EXPENSE,
icon: 'CreditCard',
searchQuery: buildQueryStringFromFilterFormValues(
{
type: CONST.SEARCH.DATA_TYPES.EXPENSE,
withdrawalType: CONST.SEARCH.WITHDRAWAL_TYPE.EXPENSIFY_CARD,
withdrawnOn: CONST.SEARCH.DATE_PRESETS.LAST_MONTH,
groupBy: CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID,
view: CONST.SEARCH.VIEW.TABLE,
},
{
sortBy: CONST.SEARCH.TABLE_COLUMNS.GROUP_WITHDRAWN,
sortOrder: CONST.SEARCH.SORT_ORDER.DESC,
},
),
get searchQueryJSON() {
return buildSearchQueryJSON(this.searchQuery);
},
get hash() {
return this.searchQueryJSON?.hash ?? CONST.DEFAULT_NUMBER_ID;
},
get similarSearchHash() {
return this.searchQueryJSON?.similarSearchHash ?? CONST.DEFAULT_NUMBER_ID;
},
},
[CONST.SEARCH.SEARCH_KEYS.RECONCILIATION]: {
key: CONST.SEARCH.SEARCH_KEYS.RECONCILIATION,
translationPath: 'search.reconciliation',
translationPath: 'workspace.common.reimburse',
type: CONST.SEARCH.DATA_TYPES.EXPENSE,
icon: 'Bank',
searchQuery: buildQueryStringFromFilterFormValues({
type: CONST.SEARCH.DATA_TYPES.EXPENSE,
withdrawalType: CONST.SEARCH.WITHDRAWAL_TYPE.REIMBURSEMENT,
withdrawnOn: CONST.SEARCH.DATE_PRESETS.LAST_MONTH,
groupBy: CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID,
}),
searchQuery: buildQueryStringFromFilterFormValues(
{
type: CONST.SEARCH.DATA_TYPES.EXPENSE,
withdrawalType: CONST.SEARCH.WITHDRAWAL_TYPE.REIMBURSEMENT,
withdrawnOn: CONST.SEARCH.DATE_PRESETS.LAST_MONTH,
groupBy: CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID,
view: CONST.SEARCH.VIEW.TABLE,
},
{
sortBy: CONST.SEARCH.TABLE_COLUMNS.GROUP_WITHDRAWN,
sortOrder: CONST.SEARCH.SORT_ORDER.DESC,
},
),
get searchQueryJSON() {
return buildSearchQueryJSON(this.searchQuery);
},
Expand Down Expand Up @@ -868,7 +903,8 @@ function getSuggestedSearchesVisibility(
let shouldShowStatementsSuggestion = false;
let shouldShowUnapprovedCashSuggestion = false;
let shouldShowUnapprovedCardSuggestion = false;
let shouldShowReconciliationSuggestion = false;
let shouldShowExpensifyCardSuggestion = false;
let shouldShowReimbursementsSuggestion = false;
let shouldShowTopSpendersSuggestion = false;
let shouldShowTopCategoriesSuggestion = false;
let shouldShowTopMerchantsSuggestion = false;
Expand Down Expand Up @@ -907,7 +943,8 @@ function getSuggestedSearchesVisibility(
const isEligibleForStatementsSuggestion = isPaidPolicy && !!policy.areCompanyCardsEnabled && hasCardFeed;
const isEligibleForUnapprovedCashSuggestion = isPaidPolicy && isAdmin && isApprovalEnabled && isPaymentEnabled;
const isEligibleForUnapprovedCardSuggestion = isPaidPolicy && isAdmin && isApprovalEnabled && (hasCardFeed || !!defaultExpensifyCard);
const isEligibleForReconciliationSuggestion = isPaidPolicy && isAdmin && ((isPaymentEnabled && hasVBBA && hasReimburser) || isECardEnabled);
const isEligibleForExpensifyCardSuggestion = isPaidPolicy && isAdmin && isECardEnabled;
const isEligibleForReimbursementsSuggestion = isPaidPolicy && isAdmin && isPaymentEnabled && hasVBBA && hasReimburser;
const isAuditor = policy.role === CONST.POLICY.ROLE.AUDITOR;
const isEligibleForTopSpendersSuggestion = isPaidPolicy && (isAdmin || isAuditor || isApprover);
const isEligibleForTopCategoriesSuggestion = isPaidPolicy && policy.areCategoriesEnabled === true;
Expand All @@ -921,7 +958,8 @@ function getSuggestedSearchesVisibility(
shouldShowStatementsSuggestion ||= isEligibleForStatementsSuggestion;
shouldShowUnapprovedCashSuggestion ||= isEligibleForUnapprovedCashSuggestion;
shouldShowUnapprovedCardSuggestion ||= isEligibleForUnapprovedCardSuggestion;
shouldShowReconciliationSuggestion ||= isEligibleForReconciliationSuggestion;
shouldShowExpensifyCardSuggestion ||= isEligibleForExpensifyCardSuggestion;
shouldShowReimbursementsSuggestion ||= isEligibleForReimbursementsSuggestion;
shouldShowTopSpendersSuggestion ||= isEligibleForTopSpendersSuggestion;
shouldShowTopCategoriesSuggestion ||= isEligibleForTopCategoriesSuggestion;
shouldShowTopMerchantsSuggestion ||= isEligibleForTopMerchantsSuggestion;
Expand All @@ -942,7 +980,8 @@ function getSuggestedSearchesVisibility(
shouldShowStatementsSuggestion &&
shouldShowUnapprovedCashSuggestion &&
shouldShowUnapprovedCardSuggestion &&
shouldShowReconciliationSuggestion &&
shouldShowExpensifyCardSuggestion &&
shouldShowReimbursementsSuggestion &&
shouldShowTopSpendersSuggestion &&
shouldShowTopCategoriesSuggestion &&
shouldShowTopMerchantsSuggestion &&
Expand All @@ -962,7 +1001,8 @@ function getSuggestedSearchesVisibility(
[CONST.SEARCH.SEARCH_KEYS.STATEMENTS]: shouldShowStatementsSuggestion,
[CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CASH]: shouldShowUnapprovedCashSuggestion,
[CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CARD]: shouldShowUnapprovedCardSuggestion,
[CONST.SEARCH.SEARCH_KEYS.RECONCILIATION]: shouldShowReconciliationSuggestion,
[CONST.SEARCH.SEARCH_KEYS.EXPENSIFY_CARD]: shouldShowExpensifyCardSuggestion,
[CONST.SEARCH.SEARCH_KEYS.RECONCILIATION]: shouldShowReimbursementsSuggestion,
[CONST.SEARCH.SEARCH_KEYS.TOP_SPENDERS]: shouldShowTopSpendersSuggestion,
[CONST.SEARCH.SEARCH_KEYS.TOP_CATEGORIES]: shouldShowTopCategoriesSuggestion,
[CONST.SEARCH.SEARCH_KEYS.TOP_MERCHANTS]: shouldShowTopMerchantsSuggestion,
Expand Down Expand Up @@ -3520,24 +3560,15 @@ function createTypeMenuSections(
}
}

// Accounting section
// Monthly accrual section
{
const accountingSection: SearchTypeMenuSection = {
translationPath: 'workspace.common.accounting',
const monthlyAccrualSection: SearchTypeMenuSection = {
translationPath: 'search.monthlyAccrual',
menuItems: [],
};

if (suggestedSearchesVisibility[CONST.SEARCH.SEARCH_KEYS.STATEMENTS]) {
accountingSection.menuItems.push({
...suggestedSearches[CONST.SEARCH.SEARCH_KEYS.STATEMENTS],
emptyState: {
title: 'search.searchResults.emptyStatementsResults.title',
subtitle: 'search.searchResults.emptyStatementsResults.subtitle',
},
});
}
if (suggestedSearchesVisibility[CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CASH]) {
accountingSection.menuItems.push({
monthlyAccrualSection.menuItems.push({
...suggestedSearches[CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CASH],
emptyState: {
title: 'search.searchResults.emptyUnapprovedResults.title',
Expand All @@ -3546,16 +3577,47 @@ function createTypeMenuSections(
});
}
if (suggestedSearchesVisibility[CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CARD]) {
accountingSection.menuItems.push({
monthlyAccrualSection.menuItems.push({
...suggestedSearches[CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CARD],
emptyState: {
title: 'search.searchResults.emptyUnapprovedResults.title',
subtitle: 'search.searchResults.emptyUnapprovedResults.subtitle',
},
});
}

if (monthlyAccrualSection.menuItems.length > 0) {
typeMenuSections.push(monthlyAccrualSection);
}
}

// Reconciliation section
{
const reconciliationSection: SearchTypeMenuSection = {
translationPath: 'search.reconciliation',
menuItems: [],
};

if (suggestedSearchesVisibility[CONST.SEARCH.SEARCH_KEYS.STATEMENTS]) {
reconciliationSection.menuItems.push({
...suggestedSearches[CONST.SEARCH.SEARCH_KEYS.STATEMENTS],
emptyState: {
title: 'search.searchResults.emptyStatementsResults.title',
subtitle: 'search.searchResults.emptyStatementsResults.subtitle',
},
});
}
if (suggestedSearchesVisibility[CONST.SEARCH.SEARCH_KEYS.EXPENSIFY_CARD]) {
reconciliationSection.menuItems.push({
...suggestedSearches[CONST.SEARCH.SEARCH_KEYS.EXPENSIFY_CARD],
emptyState: {
title: 'search.searchResults.emptyStatementsResults.title',
subtitle: 'search.searchResults.emptyStatementsResults.subtitle',
},
});
}
if (suggestedSearchesVisibility[CONST.SEARCH.SEARCH_KEYS.RECONCILIATION]) {
accountingSection.menuItems.push({
reconciliationSection.menuItems.push({
...suggestedSearches[CONST.SEARCH.SEARCH_KEYS.RECONCILIATION],
emptyState: {
title: 'search.searchResults.emptyStatementsResults.title',
Expand All @@ -3564,8 +3626,8 @@ function createTypeMenuSections(
});
}

if (accountingSection.menuItems.length > 0) {
typeMenuSections.push(accountingSection);
if (reconciliationSection.menuItems.length > 0) {
typeMenuSections.push(reconciliationSection);
}
}

Expand Down
Loading
Loading