Commit fa14074c authored by Trisno's avatar Trisno

tampilkan dialog saat belum ada alamat

parent 83f1850c
import React from 'react'; import React from 'react';
import { View, Text, StyleSheet, Button, FlatList, Alert, TextInput, Image,ScrollView,ActivityIndicator } from 'react-native'; import { View, Text, StyleSheet, Button, FlatList, Alert, TextInput, Image, ScrollView, ActivityIndicator } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler'; import { TouchableOpacity } from 'react-native-gesture-handler';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { CheckBox, Icon } from 'react-native-elements'; import { CheckBox, Icon } from 'react-native-elements';
...@@ -41,7 +41,7 @@ class DeliveryAddrees extends React.Component { ...@@ -41,7 +41,7 @@ class DeliveryAddrees extends React.Component {
} }
// console.log(params) // console.log(params)
Axios.post(this.props.BASE_URL+'crm/v2/member/get_address', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/member/get_address', params).then(res => {
const dataAlamat = res.data.data; const dataAlamat = res.data.data;
console.log("INI DATA :" + JSON.stringify(dataAlamat)) console.log("INI DATA :" + JSON.stringify(dataAlamat))
let address = [] let address = []
...@@ -82,7 +82,7 @@ class DeliveryAddrees extends React.Component { ...@@ -82,7 +82,7 @@ class DeliveryAddrees extends React.Component {
// console.log("INI PRAMETER NYA : " + JSON.stringify(params)) // console.log("INI PRAMETER NYA : " + JSON.stringify(params))
Axios.post(this.props.BASE_URL+'crm/v2/delivery/rate', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/delivery/rate', params).then(res => {
// this.setState({ // this.setState({
// grabamount: res.data.data.amount, // grabamount: res.data.data.amount,
...@@ -162,7 +162,7 @@ class DeliveryAddrees extends React.Component { ...@@ -162,7 +162,7 @@ class DeliveryAddrees extends React.Component {
address_id: id, address_id: id,
} }
Axios.post(this.props.BASE_URL+'crm/v2/delivery/rate', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/delivery/rate', params).then(res => {
let setGrabProps = { let setGrabProps = {
// grabdestination: this.state.grabdestination, // grabdestination: this.state.grabdestination,
...@@ -222,7 +222,7 @@ class DeliveryAddrees extends React.Component { ...@@ -222,7 +222,7 @@ class DeliveryAddrees extends React.Component {
renderItem = ({ item }) => { renderItem = ({ item }) => {
return ( return (
<View style={styles.list_addrees}> <View style={styles.list_addrees}>
<TouchableOpacity onPress={() => this.onSave(item.address, item.id , item.name)}> <TouchableOpacity onPress={() => this.onSave(item.address, item.id, item.name)}>
<View style={{ flex: 1, flexDirection: 'row', margin: 5, }}> <View style={{ flex: 1, flexDirection: 'row', margin: 5, }}>
<View style={{ flex: 1, justifyContent: 'center' }}> <View style={{ flex: 1, justifyContent: 'center' }}>
<View> <View>
...@@ -241,7 +241,7 @@ class DeliveryAddrees extends React.Component { ...@@ -241,7 +241,7 @@ class DeliveryAddrees extends React.Component {
</View> </View>
<View style={{ flex: 3, justifyContent: 'center' }}> <View style={{ flex: 3, justifyContent: 'center' }}>
<View> <View>
<Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 15,margin:1 }}>{item.name}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 15, margin: 1 }}>{item.name}</Text>
</View> </View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#838383', fontSize: 15 }}>{item.address}</Text> <Text style={{ fontFamily: 'Gotham-Light', color: '#838383', fontSize: 15 }}>{item.address}</Text>
</View> </View>
...@@ -284,12 +284,18 @@ class DeliveryAddrees extends React.Component { ...@@ -284,12 +284,18 @@ class DeliveryAddrees extends React.Component {
<View style={styles.listAddress}> <View style={styles.listAddress}>
{this.state.indicator == true ? ( {this.state.indicator == true ? (
<ActivityIndicator size="large" color="#c9af6d" /> <ActivityIndicator size="large" color="#c9af6d" />
) : ( ) : (this.state.data.length ? (
<FlatList style={{marginBottom:25}} <FlatList style={{ marginBottom: 25 }}
data={this.state.data} data={this.state.data}
renderItem={this.renderItem} renderItem={this.renderItem}
keyExtractor={item => item.id} keyExtractor={item => item.id}
/> />
) : (
<View style={{ margin: 20 }}>
<Text style={{ fontFamily: 'Gotham-Light', textAlign: 'center', fontSize: 16 }}>{i18n.t('noAddressSaved')}</Text>
</View>
)
)} )}
</View> </View>
</ScrollView> </ScrollView>
...@@ -324,10 +330,10 @@ const styles = StyleSheet.create({ ...@@ -324,10 +330,10 @@ const styles = StyleSheet.create({
list_addrees: { list_addrees: {
flex: 1, flex: 1,
top:20, top: 20,
marginLeft:20, marginLeft: 20,
marginRight:20, marginRight: 20,
marginBottom:20, marginBottom: 20,
borderWidth: 1, borderWidth: 1,
borderColor: '#838383', borderColor: '#838383',
borderRadius: 10, borderRadius: 10,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment