Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
BANK_ACCOUNT: 'bank-account',
BANK_ACCOUNT_WITH_STEP_TO_OPEN: 'bank-account/:stepToOpen?',
BANK_ACCOUNT_PERSONAL: 'bank-account/personal',
getBankAccountRoute: (stepToOpen = '') => `bank-account/${stepToOpen}`,
getBankAccountRoute: (stepToOpen = '', policyID = '') => `bank-account/${stepToOpen}?policyID=${policyID}`,
HOME: '',
SETTINGS: 'settings',
SETTINGS_PROFILE: 'settings/profile',
Expand Down
6 changes: 4 additions & 2 deletions src/libs/actions/ReimbursementAccount/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ function goToWithdrawalAccountSetupStep(stepID, newAchData) {

/**
* Navigate to the correct bank account route based on the bank account state and type
*
* @param {String} policyId
*/
function navigateToBankAccountRoute() {
Navigation.navigate(ROUTES.getBankAccountRoute());
function navigateToBankAccountRoute(policyId) {
Navigation.navigate(ROUTES.getBankAccountRoute('', policyId));
}

export {
Expand Down
5 changes: 5 additions & 0 deletions src/pages/ReimbursementAccount/BankAccountStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ const propTypes = {
/** Is the user account validated? */
validated: PropTypes.bool,
}),

/* The workspace name */
policyName: PropTypes.string,
};

const defaultProps = {
receivedRedirectURI: null,
plaidLinkOAuthToken: '',
user: {},
policyName: '',
};

const BankAccountStep = (props) => {
Expand Down Expand Up @@ -88,6 +92,7 @@ const BankAccountStep = (props) => {
<View style={[styles.flex1, styles.justifyContentBetween]}>
<HeaderWithCloseButton
title={props.translate('workspace.common.bankAccount')}
subtitle={props.policyName}
stepCounter={subStep ? {step: 1, total: 5} : undefined}
onCloseButtonPress={Navigation.dismissModal}
onBackButtonPress={props.onBackButtonPress}
Expand Down
9 changes: 7 additions & 2 deletions src/pages/ReimbursementAccount/ContinueBankAccountSetup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React from 'react';
import {ScrollView} from 'react-native';
Expand Down Expand Up @@ -37,15 +36,20 @@ const propTypes = {
name: PropTypes.string,
}).isRequired,

/* The workspace name */
policyName: PropTypes.string,

...withLocalizePropTypes,
};

const defaultProps = {policyName: ''};

const ContinueBankAccountSetup = props => (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
<FullPageNotFoundView shouldShow={_.isEmpty(props.policy)}>
<HeaderWithCloseButton
title={props.translate('workspace.common.bankAccount')}
subtitle={lodashGet(props.policy, 'name')}
subtitle={props.policyName}
onCloseButtonPress={Navigation.dismissModal}
onBackButtonPress={Navigation.goBack}
shouldShowGetAssistanceButton
Expand Down Expand Up @@ -91,6 +95,7 @@ const ContinueBankAccountSetup = props => (
);

ContinueBankAccountSetup.propTypes = propTypes;
ContinueBankAccountSetup.defaultProps = defaultProps;
ContinueBankAccountSetup.displayName = 'ContinueBankAccountSetup';

export default compose(
Expand Down
7 changes: 7 additions & 0 deletions src/pages/ReimbursementAccount/EnableStep.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import {ScrollView} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';
import styles from '../../styles/styles';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
Expand Down Expand Up @@ -31,8 +32,12 @@ const propTypes = {
/* Onyx Props */
user: userPropTypes.isRequired,

/* The workspace name */
policyName: PropTypes.string,

...withLocalizePropTypes,
};
const defaultProps = {policyName: ''};

const EnableStep = (props) => {
const isUsingExpensifyCard = props.user.isUsingExpensifyCard;
Expand All @@ -49,6 +54,7 @@ const EnableStep = (props) => {
<ScreenWrapper style={[styles.flex1, styles.justifyContentBetween]} includeSafeAreaPaddingBottom={false}>
<HeaderWithCloseButton
title={props.translate('workspace.common.bankAccount')}
subtitle={props.policyName}
onCloseButtonPress={Navigation.dismissModal}
shouldShowGetAssistanceButton
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT}
Expand Down Expand Up @@ -114,6 +120,7 @@ const EnableStep = (props) => {

EnableStep.displayName = 'EnableStep';
EnableStep.propTypes = propTypes;
EnableStep.defaultProps = defaultProps;

export default compose(
withLocalize,
Expand Down
14 changes: 12 additions & 2 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
import * as ReimbursementAccountProps from './reimbursementAccountPropTypes';
import reimbursementAccountDraftPropTypes from './ReimbursementAccountDraftPropTypes';
import * as ReimbursementAccountUtils from '../../libs/ReimbursementAccountUtils';
import withPolicy from '../workspace/withPolicy';

const propTypes = {
/** Plaid SDK token to use to initialize the widget */
Expand Down Expand Up @@ -60,6 +61,7 @@ const propTypes = {
params: PropTypes.shape({
/** A step to navigate to if we need to drop the user into a specific point in the flow */
stepToOpen: PropTypes.string,
policyID: PropTypes.string,
}),
}),

Expand All @@ -74,6 +76,7 @@ const defaultProps = {
route: {
params: {
stepToOpen: '',
policyID: '',
},
},
};
Expand Down Expand Up @@ -110,7 +113,9 @@ class ReimbursementAccountPage extends React.Component {
// the route params when the component first mounts to jump to a specific route instead of picking up where the
// user left off in the flow.
BankAccounts.hideBankAccountErrors();
Navigation.navigate(ROUTES.getBankAccountRoute(this.getRouteForCurrentStep(currentStep)));
Navigation.navigate(ROUTES.getBankAccountRoute(
this.getRouteForCurrentStep(currentStep), lodashGet(this.props.route.params, 'policyID'),
));
}

/**
Expand Down Expand Up @@ -247,6 +252,7 @@ class ReimbursementAccountPage extends React.Component {
// next step.
const achData = lodashGet(this.props.reimbursementAccount, 'achData', {});
const currentStep = achData.currentStep || CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT;
const policyName = lodashGet(this.props.policy, 'name');

// Don't show the loading indicator if we're offline and restarted the bank account setup process
if (this.props.reimbursementAccount.isLoading && !(this.props.network.isOffline && currentStep === CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT)) {
Expand Down Expand Up @@ -278,6 +284,7 @@ class ReimbursementAccountPage extends React.Component {
reimbursementAccount={this.props.reimbursementAccount}
continue={this.continue}
startOver={() => this.setState({shouldHideContinueSetupButton: true})}
policyName={policyName}
/>
);
}
Expand Down Expand Up @@ -310,6 +317,7 @@ class ReimbursementAccountPage extends React.Component {
<HeaderWithCloseButton
title={this.props.translate('workspace.common.bankAccount')}
onCloseButtonPress={Navigation.dismissModal}
subtitle={policyName}
/>
{errorComponent}
</ScreenWrapper>
Expand All @@ -325,6 +333,7 @@ class ReimbursementAccountPage extends React.Component {
receivedRedirectURI={getPlaidOAuthReceivedRedirectURI()}
plaidLinkOAuthToken={this.props.plaidLinkToken}
getDefaultStateForField={this.getDefaultStateForField}
policyName={policyName}
/>
);
}
Expand Down Expand Up @@ -376,7 +385,7 @@ class ReimbursementAccountPage extends React.Component {

if (currentStep === CONST.BANK_ACCOUNT.STEP.ENABLE) {
return (
<EnableStep reimbursementAccount={this.props.reimbursementAccount} />
<EnableStep reimbursementAccount={this.props.reimbursementAccount} policyName={policyName} />
);
}
}
Expand Down Expand Up @@ -405,4 +414,5 @@ export default compose(
},
}),
withLocalize,
withPolicy,
)(ReimbursementAccountPage);