From f7d8ab13d07652a66495c16287e38f5807836501 Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Fri, 2 Aug 2024 12:58:45 -0300 Subject: [PATCH] handling archive booking --- assets/images/box.svg | 3 +++ src/components/Icon/Expensicons.ts | 2 ++ src/components/MoneyReportHeader.tsx | 6 +++++- src/components/ReportActionItem/ReportPreview.tsx | 6 +++++- src/languages/en.ts | 4 ++++ src/languages/es.ts | 4 ++++ src/libs/ReportUtils.ts | 2 +- src/libs/TransactionUtils.ts | 1 - 8 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 assets/images/box.svg diff --git a/assets/images/box.svg b/assets/images/box.svg new file mode 100644 index 000000000000..261e9d71aba6 --- /dev/null +++ b/assets/images/box.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/Icon/Expensicons.ts b/src/components/Icon/Expensicons.ts index a3fd1c93a261..bc1657292da5 100644 --- a/src/components/Icon/Expensicons.ts +++ b/src/components/Icon/Expensicons.ts @@ -24,6 +24,7 @@ import Bell from '@assets/images/bell.svg'; import BellSlash from '@assets/images/bellSlash.svg'; import Bill from '@assets/images/bill.svg'; import Bolt from '@assets/images/bolt.svg'; +import Box from '@assets/images/box.svg'; import Briefcase from '@assets/images/briefcase.svg'; import Bug from '@assets/images/bug.svg'; import Building from '@assets/images/building.svg'; @@ -212,6 +213,7 @@ export { Bell, BellSlash, Bolt, + Box, Briefcase, Bug, Building, diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 9752346de69d..56e6d90354c0 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -109,6 +109,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea const allHavePendingRTERViolation = TransactionUtils.allHavePendingRTERViolation(transactionIDs); const hasOnlyHeldExpenses = ReportUtils.hasOnlyHeldExpenses(moneyRequestReport.reportID); const isPayAtEndExpense = TransactionUtils.isPayAtEndExpense(transaction); + const isArchivedReport = ReportUtils.isArchivedRoom(moneyRequestReport); const shouldShowPayButton = useMemo(() => IOU.canIOUBePaid(moneyRequestReport, chatReport, policy), [moneyRequestReport, chatReport, policy]); @@ -198,7 +199,10 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea const getStatusBarProps: () => MoneyRequestHeaderStatusBarProps | undefined = () => { if (isPayAtEndExpense) { - return {title: getStatusIcon(Expensicons.Building), description: 'Pending payment.'}; + if (isArchivedReport) { + return {title: getStatusIcon(Expensicons.Box), description: translate('iou.bookingArchivedDescription')}; + } + return {title: getStatusIcon(Expensicons.Hourglass), description: translate('iou.bookingPendingDescription')}; } if (hasOnlyHeldExpenses) { return {title: translate('violations.hold'), description: translate('iou.expensesOnHold'), danger: true}; diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index 147b61faa1a7..f4ed6c1cf4b1 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -310,10 +310,14 @@ function ReportPreview({ const shouldShowScanningSubtitle = numberOfScanningReceipts === 1 && numberOfRequests === 1; const shouldShowPendingSubtitle = numberOfPendingRequests === 1 && numberOfRequests === 1; const isFutureTravelExpense = ReportUtils.isPayAtEndExpenseReport(iouReportID); + const isArchivedReport = ReportUtils.isArchivedRoomWithID(iouReportID); const getPendingMessageProps: () => PendingMessageProps = () => { if (isFutureTravelExpense) { - return {shouldShow: true, messageIcon: Expensicons.Building, messageDescription: 'Pending payment.'}; + if (isArchivedReport) { + return {shouldShow: true, messageIcon: Expensicons.Box, messageDescription: translate('iou.bookingArchived')}; + } + return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('iou.bookingPending')}; } if (shouldShowScanningSubtitle) { return {shouldShow: true, messageIcon: Expensicons.ReceiptScan, messageDescription: translate('iou.receiptScanInProgress')}; diff --git a/src/languages/en.ts b/src/languages/en.ts index f6c2b8f29de1..c4aade4ed500 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -842,6 +842,10 @@ export default { `This report has already been exported to ${accountingIntegration}. Changes to this report in Expensify may lead to data discrepancies and Expensify Card reconciliation issues. Are you sure you want to unapprove this report?`, reimbursable: 'reimbursable', nonReimbursable: 'non-reimbursable', + bookingPending: 'This booking is pending', + bookingPendingDescription: "This booking is pending because it hasn't been paid yet.", + bookingArchived: 'This booking is archived', + bookingArchivedDescription: 'This booking is archived because the trip date has passed. Add an expense for the final amount if needed.', }, notificationPreferencesPage: { header: 'Notification preferences', diff --git a/src/languages/es.ts b/src/languages/es.ts index 431a9553a9a0..2adeb3c29d76 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -848,6 +848,10 @@ export default { `Este informe ya se ha exportado a ${accountingIntegration}. Los cambios realizados en este informe en Expensify pueden provocar discrepancias en los datos y problemas de conciliación de la tarjeta Expensify. ¿Está seguro de que desea anular la aprobación de este informe?`, reimbursable: 'reembolsable', nonReimbursable: 'no reembolsable', + bookingPending: 'Esta reserva está pendiente', + bookingPendingDescription: 'Esta reserva está pendiente porque aún no se ha pagado.', + bookingArchived: 'Esta reserva está archivada', + bookingArchivedDescription: 'Esta reserva está archivada porque la fecha del viaje ha pasado. Agregue un gasto por el monto final si es necesario.', }, notificationPreferencesPage: { header: 'Preferencias de avisos', diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 42c5110b0830..8a8c6787ebc8 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2806,7 +2806,7 @@ function canEditMoneyRequest(reportAction: OnyxInputOrEntry): boolean { * Check if the transaction status is set to Pending. */ function isPending(transaction: OnyxEntry): boolean { - return true; if (!transaction?.status) { return false; }