Commit e744b1a7 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

benerin kalau voucher expired hilang di shoping cart

parent f8afd3ef
......@@ -41,7 +41,7 @@ class ShoppingCart extends React.Component {
my_long: 0,
indicator: true,
spinner: false,
state_add_remove_voucher:false
state_add_remove_voucher: false
// dummyBalance : 155000,
// dummyPoint : 20000
......@@ -79,18 +79,31 @@ class ShoppingCart extends React.Component {
}
}
});
if (this.props.value_voucher !== "") {
this.checkExpiredReward()
}
}
componentWillUnmount() {
this._unsubscribe();
}
checkExpiredReward() {
let date_time_now = new Date()
console.log(date_time_now)
console.log(this.props.value_voucher.expire_time)
if (date_time_now > this.props.value_voucher.expire_time) {
this.props.removeVoucher()
}
}
checkChangeTrans(val) {
if (val == 'delivery') {
// let typeProps = {
// type_pickup: false,
// }
// this.props.setTypePickup(typeProps);
this.setState({
checkedBalance: false,
checkedPoint: false,
......@@ -99,20 +112,20 @@ class ShoppingCart extends React.Component {
balanceused: 0
})
let typeProps = {
type_pickup: false,
}
this.props.setTypePickup(typeProps);
}
this.props.setTypePickup(typeProps);
this.props.navigation.navigate("Delivery Address", { from: 'shoppingCart' })
} else {
let typeProps = {
type_pickup: true,
type_pickup: true,
}
this.props.setTypePickup(typeProps);
this.setState({
checkedBalance: false,
checkedPoint: false,
......@@ -120,13 +133,10 @@ class ShoppingCart extends React.Component {
pointsused: 0,
balanceused: 0
})
this.props.navigation.navigate('Pickup Name', { from: 'shoppingCart' })
}
}
// BY WAHYU ADJIE PRASETYO
// FUNGSI INI DI PANGGIL DI SETIAP INPUT DI SHOPING CART
......@@ -161,7 +171,7 @@ class ShoppingCart extends React.Component {
this.setState({
spinner: false,
})
} else{
} else {
let voucherProps = {
value_voucher: res.data.reward,
voucher: res.data.reward
......@@ -171,7 +181,7 @@ class ShoppingCart extends React.Component {
spinner: false,
})
}
this.setState({
spinner: false,
})
......@@ -179,7 +189,7 @@ class ShoppingCart extends React.Component {
}).catch(error => {
try {
let response = error.response.data
console.log("RESPONSE : "+ response)
console.log("RESPONSE : " + response)
// Alert.alert("", response.msg)
// this.setState({
// spinner: false,
......@@ -670,6 +680,7 @@ class ShoppingCart extends React.Component {
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: '#CFB368' }}>{i18n.t('addVoucher')}</Text>
</TouchableOpacity>
) : (
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between' }}>
<View style={{ flex: 0.5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#838383' }}>{this.props.voucher.reward.title}</Text>
......
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