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