Skip to content

Commit

Permalink
Merge pull request #42661 from gijoe0295/gijoe/41771
Browse files Browse the repository at this point in the history
  • Loading branch information
cead22 authored May 30, 2024
2 parents 16bbf46 + 0061773 commit f6aa6c2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,15 @@ function MoneyRequestView({

const shouldShowMapOrReceipt = showMapAsImage || hasReceipt;
const shouldShowReceiptEmptyState = !hasReceipt && !isInvoice && (canEditReceipt || isAdmin || isApprover);
const noticeTypeViolations = transactionViolations?.filter((violation) => violation.type === 'notice').map((v) => ViolationsUtils.getViolationTranslation(v, translate)) ?? [];
const receiptViolationNames: OnyxTypes.ViolationName[] = [
CONST.VIOLATIONS.RECEIPT_REQUIRED,
CONST.VIOLATIONS.RECEIPT_NOT_SMART_SCANNED,
CONST.VIOLATIONS.MODIFIED_DATE,
CONST.VIOLATIONS.CASH_EXPENSE_WITH_NO_RECEIPT,
CONST.VIOLATIONS.SMARTSCAN_FAILED,
];
const receiptViolations =
transactionViolations?.filter((violation) => receiptViolationNames.includes(violation.name)).map((violation) => ViolationsUtils.getViolationTranslation(violation, translate)) ?? [];
const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report);

return (
Expand All @@ -324,7 +332,7 @@ function MoneyRequestView({
<>
{!isInvoice && (
<ReceiptAuditHeader
notes={noticeTypeViolations}
notes={receiptViolations}
shouldShowAuditMessage={Boolean(shouldShowNotesViolations && didRceiptScanSucceed)}
/>
)}
Expand Down Expand Up @@ -379,8 +387,7 @@ function MoneyRequestView({
/>
)}
{!shouldShowReceiptEmptyState && !shouldShowMapOrReceipt && <View style={{marginVertical: 6}} />}
{shouldShowNotesViolations && <ReceiptAuditMessages notes={noticeTypeViolations} />}
{canUseViolations && <ViolationMessages violations={getViolationsForField('receipt')} />}
{shouldShowNotesViolations && <ReceiptAuditMessages notes={receiptViolations} />}
<OfflineWithFeedback pendingAction={getPendingFieldAction('amount')}>
<MenuItemWithTopDescription
title={amountTitle}
Expand Down

0 comments on commit f6aa6c2

Please sign in to comment.