diff --git a/src/common/pages/RegisterNew/index.js b/src/common/pages/RegisterNew/index.js index 4c0d465..f797c71 100644 --- a/src/common/pages/RegisterNew/index.js +++ b/src/common/pages/RegisterNew/index.js @@ -46,6 +46,8 @@ class RegisterPage extends React.Component { email_exists: '', phone_exists: '', referal_not_found: '', + no_ktp: '', + no_rekening: '' }, // form @@ -55,6 +57,7 @@ class RegisterPage extends React.Component { password: "", full_name: "", no_ktp: '', + no_rekening: '', upload_ktp: '', upload_photo: '', address: '', @@ -116,6 +119,16 @@ class RegisterPage extends React.Component { }; 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({ [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 }); let data = { @@ -181,7 +204,9 @@ class RegisterPage extends React.Component { // subdistrict_id: this.state.subdistrict, // zip_code: this.state.zip_code, referal: this.state.query.referal, - additional_data: {} + additional_data: { + no_rekening : this.state.no_rekening + } }; this.authStore.register(data).then(res => { //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"} variant="outlined" fullWidth + error={!!this.state.errors.no_ktp} + helperText={this.state.errors.no_ktp} /> @@ -569,6 +596,26 @@ class RegisterPage extends React.Component { {/**/} + + { + 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" + /> +