Commit b231ac43 authored by Trisno's avatar Trisno

pengecekan untuk pemanggilan API get value hanya untuk reward percentage

parent 9b3d5ea8
...@@ -201,8 +201,10 @@ class DeliveryAddrees extends React.Component { ...@@ -201,8 +201,10 @@ class DeliveryAddrees extends React.Component {
} }
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if(this.props.value_voucher.reward.type == 'percentage' ) {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
}
}).catch(error => { }).catch(error => {
let response = error.response.data; let response = error.response.data;
......
...@@ -319,8 +319,10 @@ class MenuSelection extends React.Component { ...@@ -319,8 +319,10 @@ class MenuSelection extends React.Component {
let res = this.props.addToChart(order_item) let res = this.props.addToChart(order_item)
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
}
// console.log('After add : ' + JSON.stringify(res)) // console.log('After add : ' + JSON.stringify(res))
// const list_order_item = this.props.order_item; // const list_order_item = this.props.order_item;
...@@ -378,9 +380,11 @@ class MenuSelection extends React.Component { ...@@ -378,9 +380,11 @@ class MenuSelection extends React.Component {
} }
} }
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
} }
}
scrollToIndex = (item) => { scrollToIndex = (item) => {
// let start = new Date() // let start = new Date()
......
...@@ -123,8 +123,10 @@ class PickupName extends React.Component { ...@@ -123,8 +123,10 @@ class PickupName extends React.Component {
getOutletDetail(id, name, address) { getOutletDetail(id, name, address) {
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
}
let OutletChange = { let OutletChange = {
outlet_id: id, outlet_id: id,
......
...@@ -120,12 +120,12 @@ class ShoppingCart extends React.Component { ...@@ -120,12 +120,12 @@ class ShoppingCart extends React.Component {
let date_time_now = new Date() let date_time_now = new Date()
let exp_time = new Date(this.props.value_voucher.expire_time) let exp_time = new Date(this.props.value_voucher.expire_time)
console.log(date_time_now) // console.log(date_time_now)
console.log(exp_time) // console.log(exp_time)
// console.log(date_time_now > exp_time) // console.log(date_time_now > exp_time)
// console.log(this.props.value_voucher) // console.log(this.props.value_voucher)
if (date_time_now > exp_time) { if (date_time_now > exp_time) {
console.log('tes kepanggil') // console.log('tes kepanggil')
this.props.removeVoucher() this.props.removeVoucher()
} }
...@@ -262,6 +262,7 @@ class ShoppingCart extends React.Component { ...@@ -262,6 +262,7 @@ class ShoppingCart extends React.Component {
} }
handleRemoveVoucher() { handleRemoveVoucher() {
// console.log(this.state.state_add_remove_voucher)
//panggil spiner //panggil spiner
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
this.handleVoucherSelect() this.handleVoucherSelect()
...@@ -269,6 +270,7 @@ class ShoppingCart extends React.Component { ...@@ -269,6 +270,7 @@ class ShoppingCart extends React.Component {
state_add_remove_voucher: true state_add_remove_voucher: true
}) })
} }
this.setState({ this.setState({
checkedBalance: false, checkedBalance: false,
checkedPoint: false, checkedPoint: false,
...@@ -282,8 +284,10 @@ class ShoppingCart extends React.Component { ...@@ -282,8 +284,10 @@ class ShoppingCart extends React.Component {
handleAddVoucher() { handleAddVoucher() {
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
}
this.setState({ this.setState({
checkedBalance: false, checkedBalance: false,
...@@ -330,8 +334,10 @@ class ShoppingCart extends React.Component { ...@@ -330,8 +334,10 @@ class ShoppingCart extends React.Component {
this.props.reduceQuantityItem(order_item) this.props.reduceQuantityItem(order_item)
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
}
if (is_xist.quantity == 0) { if (is_xist.quantity == 0) {
const order_item = { const order_item = {
...@@ -356,11 +362,13 @@ class ShoppingCart extends React.Component { ...@@ -356,11 +362,13 @@ class ShoppingCart extends React.Component {
} else { } else {
this.props.reduceQuantityItem(order_item) this.props.reduceQuantityItem(order_item)
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
} }
} }
} }
}
} }
...@@ -394,8 +402,10 @@ class ShoppingCart extends React.Component { ...@@ -394,8 +402,10 @@ class ShoppingCart extends React.Component {
} }
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
}
} }
...@@ -641,8 +651,10 @@ class ShoppingCart extends React.Component { ...@@ -641,8 +651,10 @@ class ShoppingCart extends React.Component {
addItem() { addItem() {
if (this.props.value_voucher !== "") { if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect() this.handleVoucherSelect()
} }
}
this.props.navigation.goBack() this.props.navigation.goBack()
} }
...@@ -1014,7 +1026,8 @@ class ShoppingCart extends React.Component { ...@@ -1014,7 +1026,8 @@ class ShoppingCart extends React.Component {
) : ( ) : (
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}> <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<View style={{ paddingLeft: 20, paddingTop: 5, }}> <View style={{ paddingLeft: 20, paddingTop: 5, }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>{i18n.t('discount')}</Text> {/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>{i18n.t('discount')}</Text> */}
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>{this.props.voucher.reward.title}</Text>
</View> </View>
<View style={{ paddingRight: 20, paddingTop: 5, alignItems: 'flex-end' }}> <View style={{ paddingRight: 20, paddingTop: 5, alignItems: 'flex-end' }}>
<NumberFormat decimalScale={0} value={this.props.voucher.reward.value} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>- Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={this.props.voucher.reward.value} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>- Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
......
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