update : register add new field(no_rekening)

This commit is contained in:
enggar_ganteng 2019-02-25 14:56:52 +07:00
parent 0c0e321b05
commit 50a12fe2fd

View File

@ -46,6 +46,8 @@ class RegisterPage extends React.Component {
email_exists: '', email_exists: '',
phone_exists: '', phone_exists: '',
referal_not_found: '', referal_not_found: '',
no_ktp: '',
no_rekening: ''
}, },
// form // form
@ -55,6 +57,7 @@ class RegisterPage extends React.Component {
password: "", password: "",
full_name: "", full_name: "",
no_ktp: '', no_ktp: '',
no_rekening: '',
upload_ktp: '', upload_ktp: '',
upload_photo: '', upload_photo: '',
address: '', address: '',
@ -116,6 +119,16 @@ class RegisterPage extends React.Component {
}; };
handleChange = name => event => { handleChange = name => event => {
if((name === 'no_ktp' || name === 'no_rekening') && (this.state.errors.no_ktp !== '' && this.state.errors.no_rekening !== '')){
this.setState({
errors:{
...this.state.errors,
no_ktp: '',
no_rekening: ''
}
});
}
this.setState({ this.setState({
[name]: event.target.value, [name]: event.target.value,
}); });
@ -164,6 +177,16 @@ class RegisterPage extends React.Component {
}) })
} }
if(this.state.no_ktp === '' && this.state.no_rekening === ''){
return this.setState({
errors: {
...this.state.errors,
no_ktp: 'Salah satu harus diisi',
no_rekening: 'Salah satu harus diisi'
}
})
}
this.setState({ isLoading: true }); this.setState({ isLoading: true });
let data = { let data = {
@ -181,7 +204,9 @@ class RegisterPage extends React.Component {
// subdistrict_id: this.state.subdistrict, // subdistrict_id: this.state.subdistrict,
// zip_code: this.state.zip_code, // zip_code: this.state.zip_code,
referal: this.state.query.referal, referal: this.state.query.referal,
additional_data: {} additional_data: {
no_rekening : this.state.no_rekening
}
}; };
this.authStore.register(data).then(res => { this.authStore.register(data).then(res => {
//message.success("Please check your email to confirm your account");this.props.history.push(LINKS.LOGIN); //message.success("Please check your email to confirm your account");this.props.history.push(LINKS.LOGIN);
@ -413,6 +438,8 @@ class RegisterPage extends React.Component {
type={"number"} type={"number"}
variant="outlined" variant="outlined"
fullWidth fullWidth
error={!!this.state.errors.no_ktp}
helperText={this.state.errors.no_ktp}
/> />
</Grid> </Grid>
@ -569,6 +596,26 @@ class RegisterPage extends React.Component {
{/*</Grid>*/} {/*</Grid>*/}
</Grid> </Grid>
</div> </div>
<Grid item xs={12} sm={12} md={12}>
<TextField
label="Nomor Rekening"
value={this.state.no_rekening}
onChange={event => {
this.setState({
query: {
...this.state.query,
no_rekening: event.target.value
}
})
}}
margin="normal"
type={"text"}
fullWidth
error={!!this.state.errors.no_rekening}
helperText={this.state.errors.no_rekening}
variant="outlined"
/>
</Grid>
<Grid item xs={12} sm={12} md={12}> <Grid item xs={12} sm={12} md={12}>
<TextField <TextField