Skip to content

Commit

Permalink
Merge pull request #29276 from BeeMargarida/fix/28766-do-not-show-sub…
Browse files Browse the repository at this point in the history
…mit-if-value-0

[NoQA] fix: do not show submit button if total is 0
  • Loading branch information
mountiny authored Oct 11, 2023
2 parents 0bc4876 + e1368c0 commit a3247b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/MoneyReportHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -242,7 +244,7 @@ function ReportPreview(props) {
}}
/>
)}
{isReportDraft && (
{shouldShowSubmitButton && (
<Button
medium
success={props.chatReport.isOwnPolicyExpenseChat}
Expand Down

0 comments on commit a3247b2

Please sign in to comment.