Commit 69843ec3 authored by Trisno's avatar Trisno
parents bfa4ef51 7b019082
......@@ -38,7 +38,8 @@ const ActionType = {
SET_TRANS_ID:'SET_TRANS_ID',
CHANGE_TO_CHART:'CHANGE_TO_CHART',
SET_VOUCHER:'SET_VOUCHER',
SET_EDIT_NOTE:'SET_EDIT_NOTE'
SET_EDIT_NOTE:'SET_EDIT_NOTE',
SET_HOME_ADDRESS:'SET_HOME_ADDRESS'
}
export default ActionType;
\ No newline at end of file
......@@ -82,7 +82,9 @@ const globalState = {
long: '',
voucher: [],
value_voucher: ''
value_voucher: '',
home_address:'',
outlet_detailadress: ''
}
......@@ -273,7 +275,8 @@ const rootReducer = (state = globalState, action) => {
return {
...state,
outlet_id: action.data.outlet_id,
name_outlet: action.data.name_outlet
name_outlet: action.data.name_outlet,
outlet_detailadress: action.data.outlet_detailadress
}
}
......@@ -286,7 +289,8 @@ const rootReducer = (state = globalState, action) => {
return {
...state,
address: action.data.address,
addressId: action.data.addressId
addressId: action.data.addressId,
home_address: action.data.home_address
}
}
case ActionType.SET_TRANS_ID: {
......
......@@ -9,6 +9,7 @@ import { connect } from 'react-redux';
import Axios from 'axios';
import Spinner from 'react-native-loading-spinner-overlay';
import { MaterialCommunityIcons, Ionicons } from '@expo/vector-icons';
import ActionType from '../redux/globalActionType';
class AddreesDetail extends React.Component {
......@@ -134,6 +135,7 @@ class AddreesDetail extends React.Component {
this.setState({
spinner: false,
})
this.props.navigation.goBack()
this.props.route.params.onChangeAddress({ example: 'wakwaw' })
......@@ -221,7 +223,7 @@ class AddreesDetail extends React.Component {
</View>
<View style={styles.field_name_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c",textAlign:'center',fontSize:18 }}>Nama</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c",textAlign:'center',fontSize:18 }}>Label</Text>
<TextInput style={{ height: 40, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey' }} onChangeText={(name) => this.setState({ name })} />
</View>
......@@ -236,7 +238,7 @@ class AddreesDetail extends React.Component {
<View style={{ margin: 50, justifyContent: 'center' }}>
<TouchableOpacity onPress={() => this.saveAddress()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', justifyContent: 'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center' }}>+ Tambah Alamat</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center' }}> Tambah Alamat</Text>
</View>
</TouchableOpacity>
</View>
......@@ -312,6 +314,7 @@ const mapStateToProps = (state) => {
}
}
export default connect(mapStateToProps)(AddreesDetail)
// <TextInput style={{ height: 40, borderWidth: 1, padding: 5, margin: 10,borderRadius:5 }} onChangeText={(address) => this.setState({ address })} />
\ No newline at end of file
......@@ -12,6 +12,7 @@ class DeliveryAddrees extends React.Component {
constructor(props) {
super(props)
this.state = {
address_name: [],
data: [],
data_before_search: [],
search: '',
......@@ -49,6 +50,14 @@ class DeliveryAddrees extends React.Component {
data: address,
data_before_search: dataAlamat,
})
let data_alamat = []
this.state.data.map(item => {
let b = item.name
data_alamat.push(b)
})
}).catch(error => {
let response = error.response.data;
Alert.alert(
......@@ -132,14 +141,17 @@ class DeliveryAddrees extends React.Component {
}
onSave(address, id) {
onSave(address, id, name) {
let setDataAddress = {
address: address,
addressId: id
addressId: id,
home_address: name
}
this.props.setAddress(setDataAddress);
let params = {
session_id: this.props.session_id,
address_id: id,
......@@ -208,7 +220,7 @@ class DeliveryAddrees extends React.Component {
renderItem = ({ item }) => {
return (
<View style={styles.list_addrees}>
<TouchableOpacity onPress={() => this.onSave(item.address, item.id)}>
<TouchableOpacity onPress={() => this.onSave(item.address, item.id , item.name)}>
<View style={{ flex: 1, flexDirection: 'row', margin: 5, }}>
<View style={{ flex: 1, marginBottom: 10, justifyContent: 'center' }}>
<View>
......@@ -221,7 +233,7 @@ class DeliveryAddrees extends React.Component {
/>
</View>
<View>
<Text style={{textAlign:'center', color: '#ccb46c', fontFamily: 'Gotham-Light' ,marginRight:20}}>PILIH</Text>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light', marginRight: 20 }}>PILIH</Text>
</View>
</View>
......@@ -243,7 +255,7 @@ class DeliveryAddrees extends React.Component {
return (
<View style={styles.container}>
<View style={{ height: 45, borderRadius: 10, borderColor: '#ccb46c', borderWidth: 1, flexDirection: 'row', marginTop: 15, marginLeft: 20, marginRight: 20 }}>
<View style={{ flex: 1,top:5 }}>
<View style={{ flex: 1, top: 5 }}>
<MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
</View>
<View style={{ flex: 6 }}>
......@@ -337,7 +349,8 @@ const mapDispatchToProps = (dispacth) => {
data: {
address: setDataAddress.address,
addressId: setDataAddress.addressId
addressId: setDataAddress.addressId,
home_address: setDataAddress.home_address
}
}),
......
......@@ -64,11 +64,12 @@ class PickupName extends React.Component {
this.getOutlet()
}
getOutletDetail(id, name) {
getOutletDetail(id, name,address) {
let OutletChange = {
outlet_id: id,
name_outlet: name,
outlet_detailadress: address
}
// let recalculateProps = {
......@@ -201,7 +202,7 @@ class PickupName extends React.Component {
<View>
{item.can_accept_order == true ? (
<View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name,item.full_address)}>
<View style={{ flexDirection: 'row', flex: 1 }}>
<View style={{top:10}}>
<MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
......@@ -351,6 +352,7 @@ const mapDispatchToProps = (dispacth) => {
outlet_id: OutletChange.outlet_id,
name_outlet: OutletChange.name_outlet,
outlet_detailadress: OutletChange.outlet_detailadress
}
}),
......@@ -379,6 +381,7 @@ const mapStateToProps = (state) => {
session_id: state.session_id,
outlet_id: state.outlet_id,
name_outlet: state.name_outlet,
outlet_detailadress: state.outlet_detailadress
}
}
......
......@@ -45,7 +45,7 @@ class ShoppingCart extends React.Component {
componentDidMount() {
// console.log(this.props.voucher)
console.log(this.props.home_address)
// console.log('INI VALUE : ' + this.props.value_voucher)
if (!this.props.type_pickup) {
this.getRate()
......@@ -446,11 +446,13 @@ class ShoppingCart extends React.Component {
<View style={{ margin: 5, padding: 10 }}>
<Text style={{ textAlign: 'center', fontFamily: 'Gotham-Black', fontSize: 12, color: 'grey' }}>YOU WILL PICKUP YOUR ORDER AT</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: 'grey' }}>Excelso {this.props.name_outlet}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: 'grey' }}>Excelso {this.props.outlet_detailadress}</Text>
</View>
) : (
<View style={{ margin: 5, padding: 10 }}>
<Text style={{ textAlign: 'center', fontFamily: 'Gotham-Black', fontSize: 12, color: 'grey' }}>OUR DRIVER WILL DELIVER YOUR ORDER TO</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.props.address}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.props.home_address}</Text>
</View>
)
}
......@@ -983,6 +985,8 @@ const mapDispatchToProps = (dispacth) => {
const mapStateToProps = (state) => {
return {
outlet_detailadress: state.outlet_detailadress,
home_address: state.home_address,
type_pickup: state.type_pickup,
value_voucher: state.value_voucher,
voucher: state.voucher,
......
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