-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Pay someone - Add receipt placeholder is shown when receipt is not allowed when paying someone #41635
fix: Pay someone - Add receipt placeholder is shown when receipt is not allowed when paying someone #41635
Changes from 1 commit
1ffb954
4a19ebe
f080274
2685299
503cfb9
7e2e29c
d865727
10b6fa9
467295e
922daca
8808273
71feb6b
e167f90
fa50929
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ import * as OptionsListUtils from '@libs/OptionsListUtils'; | |
import * as PolicyUtils from '@libs/PolicyUtils'; | ||
import {isTaxTrackingEnabled} from '@libs/PolicyUtils'; | ||
import * as ReceiptUtils from '@libs/ReceiptUtils'; | ||
import * as ReportActionsUtils from '@libs/ReportActionsUtils'; | ||
import * as ReportUtils from '@libs/ReportUtils'; | ||
import * as TransactionUtils from '@libs/TransactionUtils'; | ||
import ViolationsUtils from '@libs/Violations/ViolationsUtils'; | ||
|
@@ -130,6 +131,7 @@ function MoneyRequestView({ | |
const cardProgramName = isCardTransaction && transactionCardID !== undefined ? CardUtils.getCardDescription(transactionCardID) : ''; | ||
const isApproved = ReportUtils.isReportApproved(moneyRequestReport); | ||
const isInvoice = ReportUtils.isInvoiceReport(moneyRequestReport); | ||
const isPayReport = ReportActionsUtils.isPayAction(parentReportAction); | ||
const taxRates = policy?.taxRates; | ||
const formattedTaxAmount = CurrencyUtils.convertToDisplayString(transactionTaxAmount, transactionCurrency); | ||
|
||
|
@@ -328,15 +330,16 @@ function MoneyRequestView({ | |
); | ||
|
||
const shouldShowMapOrReceipt = showMapAsImage || hasReceipt; | ||
const shouldShowReceiptEmptyState = !hasReceipt && !isInvoice && (canEditReceipt || isAdmin || isApprover); | ||
const isReceiptAllowed = !isPayReport && !isInvoice; | ||
const shouldShowReceiptEmptyState = isReceiptAllowed && !hasReceipt && !isApproved && !isSettled && (canEditReceipt || isAdmin || isApprover); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Krishna2323 I believe we should show Receipt Header and Empty state only for paid polices as we are doing the same in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sobitneupane, sorry for delay, I think the empty state should be shown for unpaid policy but Receipt Header should be hidden. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Krishna2323 Can the receipt be edited by the other user(in P2P IOU) or admin in unpaid policy? If yes, we should leave the show empty state? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bump @Krishna2323 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sobitneupane, the receipt can't be edited/added by other user(in P2P IOU) or admin in unpaid policy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, I don't think we should show empty state as we are going to use it to allow user to add receipt. To be fair, the thumbnail represents Add Receipt not Empty Receipt. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree with that, I will update the code if required and test accordingly today. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sobitneupane, code is updated. |
||
const noticeTypeViolations = transactionViolations?.filter((violation) => violation.type === 'notice').map((v) => ViolationsUtils.getViolationTranslation(v, translate)) ?? []; | ||
const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report); | ||
|
||
return ( | ||
<View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth, true, shouldShowAnimatedBackground)]}> | ||
{shouldShowAnimatedBackground && <AnimatedEmptyStateBackground />} | ||
<View style={shouldShowAnimatedBackground && [StyleUtils.getReportWelcomeTopMarginStyle(isSmallScreenWidth, true)]}> | ||
{!isInvoice && ( | ||
{isReceiptAllowed && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should show Receipt Audit Header only if the receipt is present of if we are showing receipt empty state. I reckon there will be the cases where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree on hiding the header, updating and pushing the code in few minutes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated. |
||
<ReceiptAuditHeader | ||
notes={noticeTypeViolations} | ||
shouldShowAuditMessage={Boolean(shouldShowNotesViolations && didRceiptScanSucceed)} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to
isPaidReport
and merged main.