|
|
@@ -61,16 +61,14 @@ class AddressEnter extends Component<Props> { |
|
|
|
super(props); |
|
|
|
this.handleBackButtonClick = this.handleBackButtonClick.bind(this); |
|
|
|
this.state = { |
|
|
|
customer_name: "", |
|
|
|
phone_number: "", |
|
|
|
email: "", |
|
|
|
password: "", |
|
|
|
blood_group: "", |
|
|
|
address: "", |
|
|
|
|
|
|
|
|
|
|
|
validation: true, |
|
|
|
blood_group_list: [], |
|
|
|
fcm_token: global.fcm_token, |
|
|
|
country: "", |
|
|
|
region: "", |
|
|
|
// region: "", |
|
|
|
latitude: "", |
|
|
|
longitude: "", |
|
|
|
coords: "", |
|
|
@@ -125,40 +123,41 @@ class AddressEnter extends Component<Props> { |
|
|
|
|
|
|
|
|
|
|
|
handleUserNavigation = async () => { |
|
|
|
Geolocation.getCurrentPosition((info) => { |
|
|
|
this.setState({ |
|
|
|
latitude: info.coords.latitude, |
|
|
|
longitude: info.coords.longitude, |
|
|
|
coords: info.coords, |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(info); |
|
|
|
try{ |
|
|
|
await Geolocation.getCurrentPosition((info) => { |
|
|
|
this.setState({ |
|
|
|
latitude: info.coords.latitude, |
|
|
|
longitude: info.coords.longitude, |
|
|
|
coords: info.coords, |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(info); |
|
|
|
})} |
|
|
|
catch(error){alert(error)} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
register = async () => { |
|
|
|
this.handleUserNavigation(); |
|
|
|
// Keyboard.dismiss(); |
|
|
|
Keyboard.dismiss(); |
|
|
|
// await this.checkValidate(); |
|
|
|
// if (this.state.validation) |
|
|
|
// this.props.serviceActionPending(); |
|
|
|
let countries = Country.getAllCountries(); |
|
|
|
console.log(countries[0].name); |
|
|
|
// let countries = Country.getAllCountries(); |
|
|
|
// console.log(countries[0].name); |
|
|
|
await axios |
|
|
|
.post( |
|
|
|
`${api_url1}/clients/address/add`, |
|
|
|
|
|
|
|
{ |
|
|
|
addressLine1: this.state.customer_name, |
|
|
|
addressLine2: '', |
|
|
|
addressLine1: this.state.address, |
|
|
|
pincode: this.state.pincode, |
|
|
|
city: this.state.city, |
|
|
|
state: this.state.State, |
|
|
|
country: this.state.country, |
|
|
|
latitude: this.state.latitude, |
|
|
|
latitude:this.state.latitude, |
|
|
|
longitude: this.state.longitude, |
|
|
|
}, |
|
|
|
{ headers: { Authorization: `Bearer ${global.fcm_token}` } } |
|
|
@@ -214,21 +213,23 @@ class AddressEnter extends Component<Props> { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
checkValidate() { |
|
|
|
if ( |
|
|
|
this.state.email == "" || |
|
|
|
this.state.phone_number == "" || |
|
|
|
this.state.password == "" || |
|
|
|
// this.state.blood_group == "" || |
|
|
|
this.state.customer_name == "" |
|
|
|
checkValidate=()=> { |
|
|
|
if( |
|
|
|
this.state.address == "" || |
|
|
|
this.state.pincode == "" || |
|
|
|
this.state.city == "" || |
|
|
|
this.state.country == "" || |
|
|
|
this.state.State == "" || |
|
|
|
this.state.latitude == "" || |
|
|
|
this.state.longitude=="" |
|
|
|
) { |
|
|
|
this.state.validation = false; |
|
|
|
this.showSnackbar("Please fill all the fields."); |
|
|
|
return true; |
|
|
|
// this.state.validation = false; |
|
|
|
alert("Please fill all the fields."); |
|
|
|
// return true; |
|
|
|
} else { |
|
|
|
this.state.validation = true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
// this.state.validation = true; |
|
|
|
// return true; |
|
|
|
this.register(); } |
|
|
|
} |
|
|
|
|
|
|
|
select_blood_group = (value) => { |
|
|
@@ -309,7 +310,7 @@ class AddressEnter extends Component<Props> { |
|
|
|
<Image style={{ width: 22, height: 22 }} source={person} /> |
|
|
|
} |
|
|
|
onChangeText={(TextInputValue) => |
|
|
|
this.setState({ customer_name: TextInputValue }) |
|
|
|
this.setState({ address: TextInputValue }) |
|
|
|
} |
|
|
|
/> |
|
|
|
</View> |
|
|
@@ -335,7 +336,7 @@ class AddressEnter extends Component<Props> { |
|
|
|
// } |
|
|
|
keyboardType="phone-pad" |
|
|
|
onChangeText={(TextInputValue) => |
|
|
|
this.setState({ phone_number: TextInputValue }) |
|
|
|
this.setState({ pincode: TextInputValue }) |
|
|
|
} |
|
|
|
/> |
|
|
|
</View> |
|
|
@@ -363,7 +364,7 @@ class AddressEnter extends Component<Props> { |
|
|
|
// } |
|
|
|
keyboardType="email-address" |
|
|
|
onChangeText={(TextInputValue) => |
|
|
|
this.setState({ email: TextInputValue }) |
|
|
|
this.setState({ city: TextInputValue }) |
|
|
|
} |
|
|
|
/> |
|
|
|
</View> |
|
|
@@ -392,7 +393,7 @@ class AddressEnter extends Component<Props> { |
|
|
|
// } |
|
|
|
// secureTextEntry={true} |
|
|
|
onChangeText={(TextInputValue) => |
|
|
|
this.setState({ password: TextInputValue }) |
|
|
|
this.setState({ State: TextInputValue }) |
|
|
|
} |
|
|
|
/> |
|
|
|
</View> |
|
|
@@ -417,7 +418,9 @@ class AddressEnter extends Component<Props> { |
|
|
|
} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
|
|
|
|
<Text> |
|
|
|
{/* {this.state.country} */} |
|
|
|
</Text> |
|
|
|
<Text |
|
|
|
style={styles.reg_style13} |
|
|
|
> |
|
|
@@ -444,7 +447,7 @@ class AddressEnter extends Component<Props> { |
|
|
|
</View> */} |
|
|
|
<View style={styles.reg_style30} /> |
|
|
|
<View style={styles.reg_style31}> |
|
|
|
<Button block style={styles.reg_style32} onPress={this.register}> |
|
|
|
<Button block style={styles.reg_style32} onPress={this.checkValidate}> |
|
|
|
<Text style={styles.reg_style33}>SUBMIT</Text> |
|
|
|
</Button> |
|
|
|
</View> |
|
|
|