Skip to content

Commit

Permalink
handling archive booking
Browse files Browse the repository at this point in the history
  • Loading branch information
rlinoz committed Aug 2, 2024
1 parent d4b3a47 commit f7d8ab1
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions assets/images/box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -212,6 +213,7 @@ export {
Bell,
BellSlash,
Bolt,
Box,
Briefcase,
Bug,
Building,
Expand Down
6 changes: 5 additions & 1 deletion src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down Expand Up @@ -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};
Expand Down
6 changes: 5 additions & 1 deletion src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')};
Expand Down
4 changes: 4 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2806,7 +2806,7 @@ function canEditMoneyRequest(reportAction: OnyxInputOrEntry<ReportAction<typeof
return true;
}

return !isReportApproved(moneyRequestReport) && !isSettled(moneyRequestReport?.reportID) && isRequestor;
return !isReportApproved(moneyRequestReport) && !isSettled(moneyRequestReport?.reportID) && !isClosedReport(moneyRequestReport) && isRequestor;
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/libs/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ function isCardTransaction(transaction: OnyxEntry<Transaction>): boolean {
* Check if the transaction status is set to Pending.
*/
function isPending(transaction: OnyxEntry<Transaction>): boolean {
return true;
if (!transaction?.status) {
return false;
}
Expand Down

0 comments on commit f7d8ab1

Please sign in to comment.