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
2 changes: 2 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6696,6 +6696,7 @@ const CONST = {
TO: this.TABLE_COLUMNS.TO,
CATEGORY: this.TABLE_COLUMNS.CATEGORY,
TAG: this.TABLE_COLUMNS.TAG,
ORIGINAL_AMOUNT: this.TABLE_COLUMNS.ORIGINAL_AMOUNT,
REPORT_ID: this.TABLE_COLUMNS.REPORT_ID,
BASE_62_REPORT_ID: this.TABLE_COLUMNS.BASE_62_REPORT_ID,
REIMBURSABLE: this.TABLE_COLUMNS.REIMBURSABLE,
Expand Down Expand Up @@ -6796,6 +6797,7 @@ const CONST = {
TO: 'to',
CATEGORY: 'category',
TAG: 'tag',
ORIGINAL_AMOUNT: 'originalamount',
Comment thread
luacmartins marked this conversation as resolved.
REIMBURSABLE: 'reimbursable',
BILLABLE: 'billable',
TOTAL_AMOUNT: 'amount',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [
translationKey: 'common.tag',
canBeMissing: true,
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT,
translationKey: 'common.originalAmount',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE,
translationKey: 'common.reimbursable',
Expand Down
6 changes: 6 additions & 0 deletions src/components/SelectionListWithSections/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ type TransactionListItemType = ListItem &
/** final and formatted "merchant" value used for displaying and sorting */
formattedMerchant: string;

/** The original amount of the transaction */
originalAmount?: number;

/** The original currency of the transaction */
originalCurrency?: string;

/** final "date" value used for sorting */
date: string;

Expand Down
16 changes: 15 additions & 1 deletion src/components/TransactionItemRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ActionCell from '@components/SelectionListWithSections/Search/ActionCell'
import DateCell from '@components/SelectionListWithSections/Search/DateCell';
import StatusCell from '@components/SelectionListWithSections/Search/StatusCell';
import TextCell from '@components/SelectionListWithSections/Search/TextCell';
import AmountCell from '@components/SelectionListWithSections/Search/TotalCell';
import UserInfoCell from '@components/SelectionListWithSections/Search/UserInfoCell';
import Text from '@components/Text';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
Expand All @@ -21,11 +22,13 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {isCategoryMissing} from '@libs/CategoryUtils';
import getBase62ReportID from '@libs/getBase62ReportID';
import {isSettled} from '@libs/ReportUtils';
import {isExpenseReport, isSettled} from '@libs/ReportUtils';
import StringUtils from '@libs/StringUtils';
import {
getDescription,
getMerchant,
getOriginalAmount,
getOriginalCurrency,
getCreated as getTransactionCreated,
hasMissingSmartscanFields,
isAmountMissing,
Expand Down Expand Up @@ -430,6 +433,17 @@ function TransactionItemRow({
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT]: (
<View
key={CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT}
style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT, undefined, isAmountColumnWide)]}
>
<AmountCell
total={isExpenseReport(transactionItem.report) ? -(transactionItem.originalAmount ?? 0) : getOriginalAmount(transactionItem)}
currency={getOriginalCurrency(transactionItem)}
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.REPORT_ID]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.REPORT_ID)]}>
<TextCell text={transactionItem.reportID === CONST.REPORT.UNREPORTED_REPORT_ID ? '' : transactionItem.reportID} />
Expand Down
1 change: 1 addition & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Aktion erforderlich',
duplicate: 'Duplizieren',
duplicated: 'Dupliziert',
originalAmount: 'Ursprünglicher Betrag',
},
supportalNoAccess: {
title: 'Nicht so schnell',
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ const translations = {
unstableInternetConnection: 'Unstable internet connection. Please check your network and try again.',
enableGlobalReimbursements: 'Enable Global Reimbursements',
purchaseAmount: 'Purchase amount',
originalAmount: 'Original amount',
frequency: 'Frequency',
link: 'Link',
pinned: 'Pinned',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ const translations: TranslationDeepObject<typeof en> = {
unstableInternetConnection: 'Conexión a internet inestable. Por favor, revisa tu red e inténtalo de nuevo.',
enableGlobalReimbursements: 'Habilitar Reembolsos Globales',
purchaseAmount: 'Importe de compra',
originalAmount: 'Importe original',
frequency: 'Frecuencia',
link: 'Enlace',
pinned: 'Fijado',
Expand Down
1 change: 1 addition & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Action requise',
duplicate: 'Dupliquer',
duplicated: 'Dupliqué',
originalAmount: 'Montant d’origine',
},
supportalNoAccess: {
title: 'Pas si vite',
Expand Down
1 change: 1 addition & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Azione richiesta',
duplicate: 'Duplica',
duplicated: 'Duplicato',
originalAmount: 'Importo originale',
},
supportalNoAccess: {
title: 'Non così in fretta',
Expand Down
1 change: 1 addition & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: '対応が必要',
duplicate: '複製',
duplicated: '重複',
originalAmount: '元の金額',
},
supportalNoAccess: {
title: 'ちょっと待ってください',
Expand Down
1 change: 1 addition & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Actie vereist',
duplicate: 'Dupliceren',
duplicated: 'Gedupliceerd',
originalAmount: 'Oorspronkelijk bedrag',
},
supportalNoAccess: {
title: 'Niet zo snel',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Wymagane działanie',
duplicate: 'Duplikat',
duplicated: 'Zduplikowano',
originalAmount: 'Kwota pierwotna',
},
supportalNoAccess: {
title: 'Nie tak szybko',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Ação necessária',
duplicate: 'Duplicar',
duplicated: 'Duplicado',
originalAmount: 'Valor original',
},
supportalNoAccess: {
title: 'Não tão rápido',
Expand Down
1 change: 1 addition & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: '需要操作',
duplicate: '复制',
duplicated: '已重复',
originalAmount: '原始金额',
},
supportalNoAccess: {
title: '先别急',
Expand Down
10 changes: 8 additions & 2 deletions src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const transactionColumnNamesToSortingProperty: TransactionSorting = {
[CONST.SEARCH.TABLE_COLUMNS.MERCHANT]: 'formattedMerchant' as const,
[CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT]: 'formattedTotal' as const,
[CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: 'category' as const,
[CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT]: 'originalAmount' as const,
[CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE]: 'reimbursable' as const,
[CONST.SEARCH.TABLE_COLUMNS.BILLABLE]: 'billable' as const,
[CONST.SEARCH.TABLE_COLUMNS.TYPE]: null,
Expand Down Expand Up @@ -1999,8 +2000,10 @@ function compareValues(a: unknown, b: unknown, sortOrder: SortOrder, sortBy: str
}

if (typeof a === 'number' && typeof b === 'number') {
const aValue = sortBy === CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT && !shouldCompareOriginalValue ? Math.abs(a) : a;
const bValue = sortBy === CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT && !shouldCompareOriginalValue ? Math.abs(b) : b;
const aValue =
(sortBy === CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT || sortBy.toLowerCase() === CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT) && !shouldCompareOriginalValue ? Math.abs(a) : a;
const bValue =
(sortBy === CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT || sortBy.toLowerCase() === CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT) && !shouldCompareOriginalValue ? Math.abs(b) : b;
return isAsc ? aValue - bValue : bValue - aValue;
}

Expand Down Expand Up @@ -2303,6 +2306,8 @@ function getSearchColumnTranslationKey(columnId: SearchCustomColumnIds): Transla
return 'common.receipt';
case CONST.SEARCH.TABLE_COLUMNS.TAG:
return 'common.tag';
case CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT:
return 'common.originalAmount';
case CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE:
return 'common.reimbursable';
case CONST.SEARCH.TABLE_COLUMNS.BILLABLE:
Expand Down Expand Up @@ -2781,6 +2786,7 @@ function getColumnsToShow(
[CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE]: false,
[CONST.SEARCH.TABLE_COLUMNS.BILLABLE]: false,
[CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: false,
[CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT]: false,
[CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT]: true,
[CONST.SEARCH.TABLE_COLUMNS.BASE_62_REPORT_ID]: false,
[CONST.SEARCH.TABLE_COLUMNS.REPORT_ID]: false,
Expand Down
1 change: 1 addition & 0 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
case CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT:
columnWidth = {...getWidthStyle(isTaxAmountColumnWide ? variables.w130 : variables.w96), ...styles.alignItemsEnd};
break;
case CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT:
case CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT:
case CONST.SEARCH.TABLE_COLUMNS.TOTAL:
columnWidth = {...getWidthStyle(isAmountColumnWide ? variables.w130 : variables.w96), ...styles.flex1, ...styles.alignItemsEnd};
Expand Down
Loading