From 45f9fd667e9481568d2284fc4922d38e5767e03f Mon Sep 17 00:00:00 2001 From: Ana Margarida Silva Date: Fri, 6 Oct 2023 11:25:48 +0100 Subject: [PATCH 1/5] feat: show submit button in MoneyReportHeader when report is in draft/open state --- src/components/MoneyReportHeader.js | 32 +++++++++++++++++++++++++---- src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/libs/ReportUtils.js | 9 ++++++++ src/libs/actions/IOU.js | 5 +++++ 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/components/MoneyReportHeader.js b/src/components/MoneyReportHeader.js index dded77d5e30f..65f2732adbcd 100644 --- a/src/components/MoneyReportHeader.js +++ b/src/components/MoneyReportHeader.js @@ -69,16 +69,18 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report const isPolicyAdmin = policyType !== CONST.POLICY.TYPE.PERSONAL && lodashGet(policy, 'role') === CONST.POLICY.ROLE.ADMIN; const isManager = ReportUtils.isMoneyRequestReport(moneyRequestReport) && lodashGet(session, 'accountID', null) === moneyRequestReport.managerID; const isPayer = policyType === CONST.POLICY.TYPE.CORPORATE ? isPolicyAdmin && isApproved : isPolicyAdmin || (ReportUtils.isMoneyRequestReport(moneyRequestReport) && isManager); + const isDraft = ReportUtils.isReportDraft(moneyRequestReport); const shouldShowSettlementButton = useMemo( - () => isPayer && !isSettled && !moneyRequestReport.isWaitingOnBankAccount && reportTotal !== 0 && !ReportUtils.isArchivedRoom(chatReport), - [isPayer, isSettled, moneyRequestReport, reportTotal, chatReport], + () => isPayer && !isDraft && !isSettled && !moneyRequestReport.isWaitingOnBankAccount && reportTotal !== 0 && !ReportUtils.isArchivedRoom(chatReport), + [isPayer, isDraft, isSettled, moneyRequestReport, reportTotal, chatReport], ); const shouldShowApproveButton = useMemo(() => { if (policyType !== CONST.POLICY.TYPE.CORPORATE) { return false; } - return isManager && !isApproved && !isSettled; - }, [policyType, isManager, isApproved, isSettled]); + return isManager && !isDraft && !isApproved && !isSettled; + }, [policyType, isManager, isDraft, isApproved, isSettled]); + const shouldShowSubmitButton = isDraft; const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport); const formattedAmount = CurrencyUtils.convertToDisplayString(reportTotal, moneyRequestReport.currency); @@ -126,6 +128,17 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report /> )} + {shouldShowSubmitButton && !isSmallScreenWidth && ( + +