Skip to content
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

fix: Scanning expense displays 0.00 in Total column and the Merchant column is blank #44190

Merged
merged 10 commits into from
Jun 25, 2024
17 changes: 15 additions & 2 deletions src/components/SelectionList/Search/TransactionListItemRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,37 @@

function MerchantCell({transactionItem, showTooltip, isLargeScreenWidth}: TransactionCellProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();

Check failure on line 109 in src/components/SelectionList/Search/TransactionListItemRow.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe call of an `any` typed value

Check failure on line 109 in src/components/SelectionList/Search/TransactionListItemRow.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Cannot find name 'useLocalize'.
const description = TransactionUtils.getDescription(transactionItem);
let merchant = transactionItem.shouldShowMerchant ? transactionItem.formattedMerchant : description;

if (TransactionUtils.hasReceipt(transactionItem) && TransactionUtils.isReceiptBeingScanned(transactionItem)) {
merchant = translate('iou.receiptStatusTitle');

Check failure on line 114 in src/components/SelectionList/Search/TransactionListItemRow.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe call of an `any` typed value
}

return (
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={transactionItem.shouldShowMerchant ? transactionItem.formattedMerchant : description}
text={merchant}
style={[isLargeScreenWidth ? styles.lineHeightLarge : styles.lh20, styles.pre, styles.justifyContentCenter]}
/>
);
}

function TotalCell({showTooltip, isLargeScreenWidth, transactionItem}: TotalCellProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();

Check failure on line 128 in src/components/SelectionList/Search/TransactionListItemRow.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe call of an `any` typed value

Check failure on line 128 in src/components/SelectionList/Search/TransactionListItemRow.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Cannot find name 'useLocalize'.
const currency = TransactionUtils.getCurrency(transactionItem);
let amount = CurrencyUtils.convertToDisplayString(transactionItem.formattedTotal, currency);

if (TransactionUtils.hasReceipt(transactionItem) && TransactionUtils.isReceiptBeingScanned(transactionItem)) {
amount = translate('iou.receiptStatusTitle');

Check failure on line 133 in src/components/SelectionList/Search/TransactionListItemRow.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe call of an `any` typed value
}

return (
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={CurrencyUtils.convertToDisplayString(transactionItem.formattedTotal, currency)}
text={amount}
style={[styles.optionDisplayName, styles.justifyContentCenter, isLargeScreenWidth ? undefined : styles.textAlignRight]}
/>
);
Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/SearchResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ type SearchTransaction = {
receipt?: {
/** Source of the receipt */
source?: string;

/** State of the receipt */
state?: ValueOf<typeof CONST.IOU.RECEIPT_STATE>;
};

/** The transaction tag */
Expand Down
Loading