Commit 49b76933 authored by Trisno's avatar Trisno

fix issue tidak bisa pilih outlet saat menggunakan voucher

parent e60f9689
......@@ -28,7 +28,7 @@ class PickupName extends React.Component {
data_before_search: [],
spinner: false,
indicator: true,
caretHidden:true
caretHidden: true
}
}
......@@ -60,7 +60,7 @@ class PickupName extends React.Component {
reward_id: this.props.voucher.id,
delivery_charge: this.props.grabamount,
}
// MULAI DISINI PEMANGGILAN API DI MULAI, KALAU BERHASIL SET VALUE VOUCHER NYA DAN SPINER DIMATIKAN, KALAU GAGAL CABUT SESSION VOUCHER DAN SPINNER DI MATIKAN
Axios.post(this.props.BASE_URL + 'crm/v2/reward/get_value', params).then(res => {
......@@ -69,20 +69,21 @@ class PickupName extends React.Component {
state_add_remove_voucher: false
})
this.props.removeVoucher()
} else{
} else {
let voucherProps = {
value_voucher: res.data.reward,
voucher: res.data.reward
}
this.props.setVoucher(voucherProps);
}
this.setState({
spinner: false,
})
}).catch(error => {
console.log(error)
try {
let response = error.response.data
Alert.alert("", response.msg)
......@@ -130,30 +131,29 @@ class PickupName extends React.Component {
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
}else{
let OutletChange = {
outlet_id: id,
name_outlet: name,
outlet_detailadress: address
}
this.props.setChangeOutletProps(OutletChange);
this.props.setTypePickup(true);
if (this.props.route.params.from == 'shoppingCart') {
this.props.navigation.navigate('Shopping Cart', { outlet_change: true, outlet_id: id })
} else {
this.props.navigation.navigate('Home', {
screen: 'MENU',
params: { user: 'jane' },
})
}
}
let OutletChange = {
outlet_id: id,
name_outlet: name,
outlet_detailadress: address
}
this.props.setChangeOutletProps(OutletChange);
this.props.setTypePickup(true);
if (this.props.route.params.from == 'shoppingCart') {
this.props.navigation.navigate('Shopping Cart', { outlet_change: true, outlet_id: id })
} else {
this.props.navigation.navigate('Home', {
screen: 'MENU',
params: { user: 'jane' },
})
}
}
getOutlet() {
this.setState({
spinner: true,
......@@ -162,7 +162,7 @@ class PickupName extends React.Component {
session_id: this.props.session_id
}
Axios.post(this.props.BASE_URL+"crm/v2/outlet/get_list", params).then(res => {
Axios.post(this.props.BASE_URL + "crm/v2/outlet/get_list", params).then(res => {
let dataOutlets = res.data.outlets;
// console.log("INI ADALAH DATA OUTLETS : " + JSON.stringify(dataOutlets))
for (let i = 0; i < dataOutlets.length; i++) {
......@@ -250,13 +250,13 @@ class PickupName extends React.Component {
}
select(item) {
let OutletChange = {
outlet_id: item.id,
name_outlet: item.name,
}
this.props.setChangeOutletProps(OutletChange)
let OutletChange = {
outlet_id: item.id,
name_outlet: item.name,
}
this.props.setChangeOutletProps(OutletChange)
this.props.navigation.navigate('Home', { screen: 'MENU' });
}
......@@ -278,10 +278,10 @@ class PickupName extends React.Component {
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text>
<View style={{ flexDirection: 'row' }}>
{item.can_accept_order == true ? (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c", top: 5 }}>{i18n.t('open')} </Text>)
: (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c" }}>{i18n.t('closed')} </Text>)}
: (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c" }}>{i18n.t('closed')} </Text>)}
</View>
</View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368' }}>{i18n.t('openinghours')} : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, fontFamily: 'Gotham-Light', color: '#CFB368' }}>{i18n.t('openinghours')} : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, color: '#b1b1b2', fontFamily: 'Gotham-Light' }}>
{item.full_address}
</Text>
......@@ -364,9 +364,9 @@ class PickupName extends React.Component {
<TextInput style={{ height: 45 }} placeholder={i18n.t('searchpickups')}
onChangeText={text => this.filterData(text)}
onClear={text => this.filterData('')}
value={this.state.search}
value={this.state.search}
caretHidden={this.state.caretHidden}
onFocus={() => this.setState({caretHidden: false})}></TextInput>
onFocus={() => this.setState({ caretHidden: false })}></TextInput>
</View>
<View style={{ flex: 1, margin: 5 }}>
<Ionicons name="ios-search" size={32} color="#ccb46c" />
......@@ -454,6 +454,15 @@ const mapDispatchToProps = (dispacth) => {
removeVoucher: () => dispacth({
type: ActionType.REMOVE_VOUCHER
}),
setVoucher: (voucherProps) => dispacth({
type: ActionType.SET_VOUCHER,
data: {
voucher: voucherProps.voucher,
value_voucher: voucherProps.value_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