App: [Violations - Pending Receipts] Display the `rter` Violation with the Pending Pattern

Design Doc: https://docs.google.com/document/d/1zJqlTe_RajuBtfQYvbMx8PpXgA9CEnUGVyuqZihQ-ok/edit Tracking GH: https://github.com/Expensify/Expensify/issues/372206

HOLD ON https://github.com/Expensify/Expensify/issues/384996


Similar to how we have TransactionUtils.isPending and TransactionUtils.isReceiptBeingScanned in NewDot to help us with other pending UI flows, we’ll add a new method: TransactionUtils.hasPendingRTERViolation:

TransactionUtils.hasPendingRTERViolation

This will have a similar structure to the current TransactionUtils methods that check for / retrieve violations.

  • Params:
    • transactionID: string
    • transactionViolations: TransactionViolation[] - the set of violations for that specific transaction. For components where we are subscribing to all violations we can use the output of TransactionUtils.getTransactionViolations
  • Returns:
    • A boolean: If any of the violations for that transactionID in Onyx are the rter violation, with pendingPattern set to true

Additionally, because this will be called frequently with TransactionUtils.isPending and TransactionUtils.isReceiptBeingScanned let’s also make and utilize a method that returns true if any of those return true: hasPendingUI()

We’ll outline this in further detail below, but we’ll call this method in:

  1. MoneyRequestPreviewContent.tsx
  2. ReportPreview.tsx
  3. MoneyRequestHeader.tsx

The first two already have access to the transactionViolations onyx collection key. However, we will need to add it to MoneyRequestHeader.tsx.

Updates to ReportActionItems: MoneyRequestPreview / ReportPreview

Now that we know if our transaction has the “7-Day Hold” rter violation, we can adjust the UI to reflect that it’s “Pending”. For ReportActionItem rows, we will do the same thing that was outlined for pending transactions and scanning receipts in the Update how we display / report expenses doc. Screenshot 2024-04-03 at 11 27 42 AM

We will show the “pending” hover/message/icon UI for these two cases:

Updates to MoneyReportHeader

Similar to what we’re doing for the Report Preview above, if the report contains only transactions with the rter violation (which again, we’ll alias as hasPendingRTERViolation) we’ll show the Next Steps banner indicating that the receipts are pending match with a credit card.

We’ll also hide the Submit/Approve/Pay buttons in this case as well (i.e. all transactions are pending).

In the case of the “One-Expense” Chat, we’ll use the same pattern as the MoneyRequestHeader as described below.

Updates to MoneyRequestHeader

If hasPendingRTERViolation is true, we’ll show a MoneyRequestHeaderStatusBar in the MoneyRequestHeader here. This will be similar to what we already do for isPending and isScanning. The message will utilize the same hourglass icon and have the copy as seen below.

Let’s also refactor this to be a bit less repetitive. We can create a getPendingType() method that checks if the transaction is RTER vs SCANNING vs PENDING and returns the translations keyed by that type.

Screenshot 2024-04-03 at 11 34 09 AM

“Mark as cash” Button

This will be covered in a separate issue

Issue OwnerCurrent Issue Owner: @smelaa

About this issue

  • Original URL
  • State: open
  • Created 3 months ago
  • Comments: 33 (26 by maintainers)

Most upvoted comments

We are OOO till Monday due to a national holiday. The PR is almost ready, it just needs to be checked whether everything is in line with the design. I will do this first thing on Monday, is it okay?

Thanks Yuwen!

Yeah we definitely want the little pending status at the bottom of the report preview. (I can’t speak to how we should accomplish that from a technical standpoint.)

And can we double check the sizes and spacings of the little statuses? It looks like maybe some of them are not quite right.

Here’s a mockup to check out: image

And here are the specs for that little status: image

Hi, thank you for all the information! The PR is in draft but I still need to:

  • handle “One-Expense” Chat case,
  • mock the data and test whether the implemented logic is correct,
  • and finally once everything work as intended I will need to refactor the code a bit.

I will be back on Tuesday so in case you need something before that date please ping @BrtqKr, as he is familiar with this issue as well.