diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index ad8b60700e39..68b3bd047ad8 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -260,6 +260,7 @@ const ONYXKEYS = { TRANSACTION: 'transactions_', SPLIT_TRANSACTION_DRAFT: 'splitTransactionDraft_', PRIVATE_NOTES_DRAFT: 'privateNotesDraft_', + NEXT_STEP: 'reportNextStep_', // Manual request tab selector SELECTED_TAB: 'selectedTab_', diff --git a/src/components/MoneyReportHeader.js b/src/components/MoneyReportHeader.js index 49681f396181..8ae4672e758e 100644 --- a/src/components/MoneyReportHeader.js +++ b/src/components/MoneyReportHeader.js @@ -1,4 +1,5 @@ import React, {useMemo} from 'react'; +import _ from 'underscore'; import {withOnyx} from 'react-native-onyx'; import {View} from 'react-native'; import PropTypes from 'prop-types'; @@ -15,11 +16,13 @@ import Navigation from '../libs/Navigation/Navigation'; import ROUTES from '../ROUTES'; import ONYXKEYS from '../ONYXKEYS'; import CONST from '../CONST'; +import MoneyReportHeaderStatusBar from './MoneyReportHeaderStatusBar'; import SettlementButton from './SettlementButton'; import Button from './Button'; import * as IOU from '../libs/actions/IOU'; import * as CurrencyUtils from '../libs/CurrencyUtils'; import reportPropTypes from '../pages/reportPropTypes'; +import nextStepPropTypes from '../pages/nextStepPropTypes'; const propTypes = { /** The report currently being looked at */ @@ -40,6 +43,9 @@ const propTypes = { /** The chat report this report is linked to */ chatReport: reportPropTypes, + /** The next step for the report */ + nextStep: nextStepPropTypes, + /** Personal details so we can get the ones for the report participants */ personalDetails: PropTypes.objectOf(participantPropTypes).isRequired, @@ -54,13 +60,14 @@ const propTypes = { const defaultProps = { chatReport: {}, + nextStep: {}, session: { email: null, }, policy: {}, }; -function MoneyReportHeader({session, personalDetails, policy, chatReport, report: moneyRequestReport, isSmallScreenWidth}) { +function MoneyReportHeader({session, personalDetails, policy, chatReport, nextStep, report: moneyRequestReport, isSmallScreenWidth}) { const {translate} = useLocalize(); const reimbursableTotal = ReportUtils.getMoneyRequestReimbursableTotal(moneyRequestReport); const isApproved = ReportUtils.isReportApproved(moneyRequestReport); @@ -81,9 +88,11 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report return isManager && !isDraft && !isApproved && !isSettled; }, [policyType, isManager, isDraft, isApproved, isSettled]); const shouldShowSubmitButton = isDraft && reimbursableTotal !== 0; - const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton; + const shouldShowNextSteps = isDraft && nextStep && (!_.isEmpty(nextStep.message) || !_.isEmpty(nextStep.expenseMessage)); + const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextSteps; const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport); const formattedAmount = CurrencyUtils.convertToDisplayString(reimbursableTotal, moneyRequestReport.currency); + const isMoreContentShown = shouldShowNextSteps || (shouldShowAnyButton && isSmallScreenWidth); return ( @@ -96,7 +105,8 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report personalDetails={personalDetails} shouldShowBackButton={isSmallScreenWidth} onBackButtonPress={() => Navigation.goBack(ROUTES.HOME, false, true)} - shouldShowBorderBottom={!shouldShowAnyButton || !isSmallScreenWidth} + // Shows border if no buttons or next steps are showing below the header + shouldShowBorderBottom={!(shouldShowAnyButton && isSmallScreenWidth) && !(shouldShowNextSteps && !isSmallScreenWidth)} > {shouldShowSettlementButton && !isSmallScreenWidth && ( @@ -141,43 +151,50 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report )} - {shouldShowSettlementButton && isSmallScreenWidth && ( - - IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport)} - enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS} - addBankAccountRoute={bankAccountRoute} - shouldShowPaymentOptions - formattedAmount={formattedAmount} - /> - - )} - {shouldShowApproveButton && isSmallScreenWidth && ( - -