diff --git a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx index 8c1c1287d77b..33c0a59dbcd9 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx @@ -8,8 +8,7 @@ import {useOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; import Button from '@components/Button'; import Icon from '@components/Icon'; -import * as Expensicons from '@components/Icon/Expensicons'; -import {ReceiptScan} from '@components/Icon/Expensicons'; +import {Checkmark, DotIndicator, Folder, Hourglass, Tag} from '@components/Icon/Expensicons'; import MoneyRequestSkeletonView from '@components/MoneyRequestSkeletonView'; import MultipleAvatars from '@components/MultipleAvatars'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; @@ -51,7 +50,7 @@ import { getTransactionViolations, hasMissingSmartscanFields, hasNoticeTypeViolation as hasNoticeTypeViolationTransactionUtils, - hasPendingUI, + hasPendingRTERViolation, hasReceipt as hasReceiptTransactionUtils, hasViolation as hasViolationTransactionUtils, hasWarningTypeViolation as hasWarningTypeViolationTransactionUtils, @@ -234,6 +233,14 @@ function MoneyRequestPreviewContent({ message = translate('iou.split'); } + if (isPending(transaction)) { + message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.pending')}`; + } + + if (hasPendingRTERViolation(getTransactionViolations(transactionID, transactionViolations))) { + message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.pendingMatch')}`; + } + if (isSettled && !iouReport?.isCancelledIOU && !isPartialHold) { message += ` ${CONST.DOT_SEPARATOR} ${getSettledMessage()}`; return message; @@ -278,17 +285,8 @@ function MoneyRequestPreviewContent({ }; const getPendingMessageProps: () => PendingMessageProps = () => { - if (isScanning) { - return {shouldShow: true, messageIcon: ReceiptScan, messageDescription: translate('iou.receiptScanInProgress')}; - } - if (isPending(transaction)) { - return {shouldShow: true, messageIcon: Expensicons.CreditCardHourglass, messageDescription: translate('iou.transactionPending')}; - } if (shouldShowBrokenConnectionViolation(transaction ? [transaction.transactionID] : [], iouReport, policy)) { - return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('violations.brokenConnection530Error')}; - } - if (hasPendingUI(transaction, getTransactionViolations(transaction?.transactionID, transactionViolations))) { - return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('iou.pendingMatchWithCreditCard')}; + return {shouldShow: true, messageIcon: Hourglass, messageDescription: translate('violations.brokenConnection530Error')}; } return {shouldShow: false}; }; @@ -297,7 +295,7 @@ function MoneyRequestPreviewContent({ const getDisplayAmountText = (): string => { if (isScanning) { - return translate('iou.receiptScanning', {count: 1}); + return translate('iou.receiptStatusTitle'); } if (isFetchingWaypointsFromServer && !requestAmount) { @@ -393,8 +391,9 @@ function MoneyRequestPreviewContent({ {getPreviewHeaderText()} {!isSettled && shouldShowRBR && ( )} @@ -420,7 +419,7 @@ function MoneyRequestPreviewContent({ {isSettledReportUtils(iouReport?.reportID) && !isPartialHold && !isBillSplit && ( @@ -479,7 +478,7 @@ function MoneyRequestPreviewContent({ ]} > { if (isScanning) { - return translate('common.receipt'); + return totalDisplaySpend ? `${translate('common.receipt')} ${CONST.DOT_SEPARATOR} ${translate('common.scanning')}` : `${translate('common.receipt')}`; + } + if (numberOfPendingRequests === 1 && numberOfRequests === 1) { + return `${translate('common.receipt')} ${CONST.DOT_SEPARATOR} ${translate('iou.pending')}`; + } + if (showRTERViolationMessage) { + return `${translate('common.receipt')} ${CONST.DOT_SEPARATOR} ${translate('iou.pendingMatch')}`; } let payerOrApproverName; @@ -392,6 +398,9 @@ function ReportPreview({ return translate(paymentVerb, {payer: payerOrApproverName}); }, [ isScanning, + numberOfPendingRequests, + numberOfRequests, + showRTERViolationMessage, isPolicyExpenseChat, isTripRoom, isInvoiceRoom, @@ -400,6 +409,7 @@ function ReportPreview({ iouReport?.isWaitingOnBankAccount, hasNonReimbursableTransactions, translate, + totalDisplaySpend, chatReport, policy, invoiceReceiverPolicy, @@ -425,8 +435,6 @@ function ReportPreview({ const shouldShowSingleRequestMerchantOrDescription = numberOfRequests === 1 && (!!formattedMerchant || !!formattedDescription) && !(hasOnlyTransactionsWithPendingRoutes && !totalDisplaySpend); const shouldShowSubtitle = !isScanning && (shouldShowSingleRequestMerchantOrDescription || numberOfRequests > 1) && !isDisplayAmountZero(getDisplayAmount()); - const shouldShowScanningSubtitle = (numberOfScanningReceipts === 1 && numberOfRequests === 1) || (numberOfScanningReceipts >= 1 && Number(nonHeldAmount) === 0); - const shouldShowPendingSubtitle = numberOfPendingRequests === 1 && numberOfRequests === 1; const isPayAtEndExpense = isPayAtEndExpenseReport(iouReportID, transactions); const [archiveReason] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, {selector: getArchiveReason}); @@ -444,18 +452,9 @@ function ReportPreview({ }; } } - if (shouldShowScanningSubtitle) { - return {shouldShow: true, messageIcon: Expensicons.ReceiptScan, messageDescription: translate('iou.receiptScanInProgress')}; - } - if (shouldShowPendingSubtitle) { - return {shouldShow: true, messageIcon: Expensicons.CreditCardHourglass, messageDescription: translate('iou.transactionPending')}; - } if (shouldShowBrokenConnectionViolation) { return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('violations.brokenConnection530Error')}; } - if (showRTERViolationMessage) { - return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('iou.pendingMatchWithCreditCard')}; - } return {shouldShow: false}; }; diff --git a/src/languages/en.ts b/src/languages/en.ts index 1667f328a60f..f1659b037296 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -278,6 +278,7 @@ const translations = { continue: 'Continue', firstName: 'First name', lastName: 'Last name', + scanning: 'Scanning', addCardTermsOfService: 'Expensify Terms of Service', perPerson: 'per person', phone: 'Phone', @@ -887,6 +888,7 @@ const translations = { deleteReceipt: 'Delete receipt', deletedTransaction: ({amount, merchant}: DeleteTransactionParams) => `deleted an expense on this report, ${merchant} - ${amount}`, pendingMatchWithCreditCard: 'Receipt pending match with card transaction', + pendingMatch: 'Pending match', pendingMatchWithCreditCardDescription: 'Receipt pending match with card transaction. Mark as cash to cancel.', markAsCash: 'Mark as cash', routePending: 'Route pending...', diff --git a/src/languages/es.ts b/src/languages/es.ts index f4b309b48224..8aa78f4b20e5 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -272,6 +272,7 @@ const translations = { continue: 'Continuar', firstName: 'Nombre', lastName: 'Apellidos', + scanning: 'Escaneando', phone: 'Teléfono', phoneNumber: 'Número de teléfono', phoneNumberPlaceholder: '(xxx) xxx-xxxx', @@ -880,6 +881,7 @@ const translations = { canceled: 'Canceló', posted: 'Contabilizado', deleteReceipt: 'Eliminar recibo', + pendingMatch: 'Pendiente de coincidencia', pendingMatchWithCreditCard: 'Recibo pendiente de adjuntar con la transacción de la tarjeta', pendingMatchWithCreditCardDescription: 'Recibo pendiente de adjuntar con la transacción de la tarjeta. Márcalo como efectivo para cancelar.', markAsCash: 'Marcar como efectivo',