Skip to content

Commit

Permalink
fix: do not show submit button if total is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
BeeMargarida committed Oct 11, 2023
1 parent 771b8c5 commit e1368c0
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 e1368c0

Please sign in to comment.