Skip to content

Commit

Permalink
Update src/components/EReceipt.tsx
Browse files Browse the repository at this point in the history
Co-authored-by: Aimane Chnaif <[email protected]>
  • Loading branch information
spcheema and aimane-chnaif authored Jan 21, 2024
1 parent cc41381 commit b62f7ca
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/components/EReceipt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,15 @@ function EReceipt({transaction, transactionID}: EReceiptProps) {
const {translate} = useLocalize();

// Get receipt colorway, or default to Yellow.
const colorStyles = StyleUtils.getEReceiptColorStyles(StyleUtils.getEReceiptColorCode(transaction));
const primaryColor = colorStyles?.backgroundColor;
const secondaryColor = colorStyles?.color;

const transactionDetails = ReportUtils.getTransactionDetails(transaction, CONST.DATE.MONTH_DAY_YEAR_FORMAT);
const transactionAmount = transactionDetails?.amount;
const transactionCurrency = transactionDetails?.currency ?? '';
const transactionMerchant = transactionDetails?.merchant;
const transactionDate = transactionDetails?.created;
const transactionCardID = transactionDetails?.cardID;
const {backgroundColor: primaryColor, color: secondaryColor} = StyleUtils.getEReceiptColorStyles(StyleUtils.getEReceiptColorCode(transaction)) ?? {};

const {
amount: transactionAmount,
currency: transactionCurrency = '',
merchant: transactionMerchant,
created: transactionDate,
cardID: transactionCardID,
} = ReportUtils.getTransactionDetails(transaction, CONST.DATE.MONTH_DAY_YEAR_FORMAT) ?? {};
const formattedAmount = CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency);
const currency = CurrencyUtils.getCurrencySymbol(transactionCurrency);
const amount = currency ? formattedAmount.replace(currency, '') : formattedAmount;
Expand Down

0 comments on commit b62f7ca

Please sign in to comment.