From e1368c07b6572c7d0fed64dd15374909f57a2089 Mon Sep 17 00:00:00 2001 From: Ana Margarida Silva Date: Wed, 11 Oct 2023 10:13:44 +0100 Subject: [PATCH] fix: do not show submit button if total is 0 --- src/components/MoneyReportHeader.js | 2 +- src/components/ReportActionItem/ReportPreview.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyReportHeader.js b/src/components/MoneyReportHeader.js index fbd686fac692..6b2b4e16db65 100644 --- a/src/components/MoneyReportHeader.js +++ b/src/components/MoneyReportHeader.js @@ -80,7 +80,7 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report } return isManager && !isDraft && !isApproved && !isSettled; }, [policyType, isManager, isDraft, isApproved, isSettled]); - const shouldShowSubmitButton = isDraft; + const shouldShowSubmitButton = isDraft && reportTotal !== 0; const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton; const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport); const formattedAmount = CurrencyUtils.convertToDisplayString(reportTotal, moneyRequestReport.currency); diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js index d89d1e02d7a9..f9001ed51258 100644 --- a/src/components/ReportActionItem/ReportPreview.js +++ b/src/components/ReportActionItem/ReportPreview.js @@ -136,6 +136,8 @@ function ReportPreview(props) { scanningReceipts: numberOfScanningReceipts, }); + const shouldShowSubmitButton = isReportDraft && reportTotal !== 0; + const getDisplayAmount = () => { if (reportTotal) { return CurrencyUtils.convertToDisplayString(reportTotal, props.iouReport.currency); @@ -242,7 +244,7 @@ function ReportPreview(props) { }} /> )} - {isReportDraft && ( + {shouldShowSubmitButton && (