-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[No QA] Add BeneficialOwnersStep (UI Only) #3585
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e984e08
add beneficial owners step
marcaaron 73ea817
fix beneficial owners list
marcaaron e9474fc
fix conflicts
marcaaron a705ca1
add the IdentityForm
marcaaron b310661
add identity form to BeneficialOwners
marcaaron 94ab19e
use state fields
marcaaron 5567976
hook up the beneficial owners step
marcaaron 03c0c4e
add default style + translation
marcaaron 4b278b7
hook up nav buttons
marcaaron 0f14350
start with empty array of owners
marcaaron 603671d
give TextLink a size micro option
marcaaron 1cdd7cf
fix conflicts
marcaaron aaa1682
pass textMicro instead
marcaaron 45a77a3
useless change
marcaaron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
import _ from 'underscore'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {ScrollView, View} from 'react-native'; | ||
import Text from '../../components/Text'; | ||
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton'; | ||
import styles from '../../styles/styles'; | ||
import CheckboxWithLabel from '../../components/CheckboxWithLabel'; | ||
import TextLink from '../../components/TextLink'; | ||
import Button from '../../components/Button'; | ||
import IdentityForm from './IdentityForm'; | ||
import FixedFooter from '../../components/FixedFooter'; | ||
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; | ||
import {goToWithdrawalAccountSetupStep, setupWithdrawalAccount} from '../../libs/actions/BankAccounts'; | ||
import Navigation from '../../libs/Navigation/Navigation'; | ||
import CONST from '../../CONST'; | ||
|
||
const propTypes = { | ||
companyName: PropTypes.string, | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
companyName: 'Company Name', | ||
}; | ||
|
||
class BeneficialOwnersStep extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.addBeneficialOwner = this.addBeneficialOwner.bind(this); | ||
this.submit = this.submit.bind(this); | ||
|
||
this.state = { | ||
ownsMoreThan25Percent: false, | ||
hasOtherBeneficialOwners: false, | ||
acceptTermsAndConditions: false, | ||
certifyTrueInformation: false, | ||
beneficialOwners: [], | ||
}; | ||
} | ||
|
||
removeBeneficialOwner(beneficialOwner) { | ||
this.setState(prevState => ({beneficialOwners: _.without(prevState.beneficialOwners, beneficialOwner)})); | ||
} | ||
|
||
addBeneficialOwner() { | ||
this.setState(prevState => ({beneficialOwners: [...prevState.beneficialOwners, {}]})); | ||
} | ||
|
||
/** | ||
* @returns {Boolean} | ||
*/ | ||
canAddMoreBeneficialOwners() { | ||
return _.size(this.state.beneficialOwners) < 3 | ||
|| (_.size(this.state.beneficialOwners) === 3 && !this.state.ownsMoreThan25Percent); | ||
} | ||
|
||
submit() { | ||
setupWithdrawalAccount({...this.state}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<> | ||
<HeaderWithCloseButton | ||
title={this.props.translate('beneficialOwnersStep.beneficialOwners')} | ||
onCloseButtonPress={Navigation.dismissModal} | ||
onBackButtonPress={() => goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.REQUESTOR)} | ||
shouldShowBackButton | ||
/> | ||
<ScrollView style={[styles.flex1, styles.w100, styles.ph5]}> | ||
<Text style={[styles.mb5]}> | ||
<Text style={[styles.textStrong]}> | ||
{`${this.props.translate('beneficialOwnersStep.additionalInformation')}: `} | ||
</Text> | ||
<Text>{this.props.translate('beneficialOwnersStep.checkAllThatApply')}</Text> | ||
</Text> | ||
<CheckboxWithLabel | ||
style={[styles.mb2, styles.mr2]} | ||
isChecked={this.state.ownsMoreThan25Percent} | ||
onPress={() => this.setState(prevState => ({ | ||
ownsMoreThan25Percent: !prevState.ownsMoreThan25Percent, | ||
}))} | ||
LabelComponent={() => ( | ||
<Text> | ||
{this.props.translate('beneficialOwnersStep.iOwnMoreThan25Percent')} | ||
<Text style={[styles.textStrong]}>{this.props.companyName}</Text> | ||
</Text> | ||
)} | ||
/> | ||
<CheckboxWithLabel | ||
style={[styles.mb2, styles.mr2]} | ||
isChecked={this.state.hasOtherBeneficialOwners} | ||
onPress={() => { | ||
this.setState((prevState) => { | ||
const hasOtherBeneficialOwners = !prevState.hasOtherBeneficialOwners; | ||
return { | ||
hasOtherBeneficialOwners, | ||
beneficialOwners: hasOtherBeneficialOwners && _.isEmpty(prevState.beneficialOwners) | ||
? [{}] | ||
: prevState.beneficialOwners, | ||
}; | ||
}); | ||
}} | ||
LabelComponent={() => ( | ||
<Text> | ||
{this.props.translate('beneficialOwnersStep.someoneOwnsMoreThan25Percent')} | ||
<Text style={[styles.textStrong]}>{this.props.companyName}</Text> | ||
</Text> | ||
)} | ||
/> | ||
{this.state.hasOtherBeneficialOwners && ( | ||
<View style={[styles.mb2]}> | ||
{_.map(this.state.beneficialOwners, (owner, index) => ( | ||
<View key={index} style={[styles.p5, styles.border, styles.mb2]}> | ||
<Text style={[styles.textStrong, styles.mb2]}> | ||
{this.props.translate('beneficialOwnersStep.additionalOwner')} | ||
</Text> | ||
<IdentityForm | ||
style={[styles.mb2]} | ||
onFieldChange={(fieldName, value) => this.setState((prevState) => { | ||
const beneficialOwners = [...prevState.beneficialOwners]; | ||
beneficialOwners[index][fieldName] = value; | ||
return {beneficialOwners}; | ||
})} | ||
values={{ | ||
firstName: owner.firstName || '', | ||
lastName: owner.lastName || '', | ||
street: owner.street || '', | ||
city: owner.city || '', | ||
state: owner.state || '', | ||
zipCode: owner.zipCode || '', | ||
dob: owner.dob || '', | ||
ssnLast4: owner.ssnLast4 || '', | ||
}} | ||
/> | ||
{this.state.beneficialOwners.length > 1 && ( | ||
<TextLink onPress={() => this.removeBeneficialOwner(owner)}> | ||
{this.props.translate('beneficialOwnersStep.removeOwner')} | ||
</TextLink> | ||
)} | ||
</View> | ||
))} | ||
{this.canAddMoreBeneficialOwners() && ( | ||
<TextLink onPress={this.addBeneficialOwner}> | ||
{this.props.translate('beneficialOwnersStep.addAnotherIndividual')} | ||
<Text style={[styles.textStrong, styles.link]}>{this.props.companyName}</Text> | ||
</TextLink> | ||
)} | ||
</View> | ||
)} | ||
<Text style={[styles.textStrong, styles.mb5]}> | ||
{this.props.translate('beneficialOwnersStep.agreement')} | ||
</Text> | ||
<CheckboxWithLabel | ||
style={[styles.mb2]} | ||
isChecked={this.state.acceptTermsAndConditions} | ||
onPress={() => this.setState(prevState => ({ | ||
acceptTermsAndConditions: !prevState.acceptTermsAndConditions, | ||
}))} | ||
LabelComponent={() => ( | ||
<View style={[styles.flexRow]}> | ||
<Text>{this.props.translate('common.iAcceptThe')}</Text> | ||
<TextLink href="https://use.expensify.com/achterms"> | ||
{`${this.props.translate('beneficialOwnersStep.termsAndConditions')}.`} | ||
</TextLink> | ||
</View> | ||
)} | ||
/> | ||
<CheckboxWithLabel | ||
style={[styles.mb2]} | ||
isChecked={this.state.certifyTrueInformation} | ||
onPress={() => this.setState(prevState => ({ | ||
certifyTrueInformation: !prevState.certifyTrueInformation, | ||
}))} | ||
LabelComponent={() => ( | ||
<Text>{this.props.translate('beneficialOwnersStep.certifyTrueAndAccurate')}</Text> | ||
)} | ||
/> | ||
</ScrollView> | ||
<FixedFooter style={[styles.mt5]}> | ||
<Button | ||
success | ||
text={this.props.translate('common.saveAndContinue')} | ||
onPress={this.submit} | ||
/> | ||
</FixedFooter> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
BeneficialOwnersStep.propTypes = propTypes; | ||
BeneficialOwnersStep.defaultProps = defaultProps; | ||
|
||
export default withLocalize(BeneficialOwnersStep); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's occurred to me that I forgot to add the requestorStep values to this file 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this left in english if this is the spanish file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are fixing that here https://expensify.slack.com/archives/C21FRDWCV/p1629825626117900
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we started this there was pressure to get it finished within 2 weeks so we moved very quickly and Spanish translations were not prioritized.