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 {
}
if (this.props.value_voucher !== "") {
if(this.props.value_voucher.reward.type == 'percentage' ) {
this.handleVoucherSelect()
}
}
}).catch(error => {
let response = error.response.data;
......
......@@ -319,8 +319,10 @@ class MenuSelection extends React.Component {
let res = this.props.addToChart(order_item)
if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
// console.log('After add : ' + JSON.stringify(res))
// const list_order_item = this.props.order_item;
......@@ -378,9 +380,11 @@ class MenuSelection extends React.Component {
}
}
if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
}
scrollToIndex = (item) => {
// let start = new Date()
......
......@@ -123,8 +123,10 @@ class PickupName extends React.Component {
getOutletDetail(id, name, address) {
if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
let OutletChange = {
outlet_id: id,
......
......@@ -120,12 +120,12 @@ class ShoppingCart extends React.Component {
let date_time_now = new Date()
let exp_time = new Date(this.props.value_voucher.expire_time)
console.log(date_time_now)
console.log(exp_time)
// console.log(date_time_now)
// console.log(exp_time)
// console.log(date_time_now > exp_time)
// console.log(this.props.value_voucher)
if (date_time_now > exp_time) {
console.log('tes kepanggil')
// console.log('tes kepanggil')
this.props.removeVoucher()
}
......@@ -262,6 +262,7 @@ class ShoppingCart extends React.Component {
}
handleRemoveVoucher() {
// console.log(this.state.state_add_remove_voucher)
//panggil spiner
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
......@@ -269,6 +270,7 @@ class ShoppingCart extends React.Component {
state_add_remove_voucher: true
})
}
this.setState({
checkedBalance: false,
checkedPoint: false,
......@@ -282,8 +284,10 @@ class ShoppingCart extends React.Component {
handleAddVoucher() {
if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
this.setState({
checkedBalance: false,
......@@ -330,8 +334,10 @@ class ShoppingCart extends React.Component {
this.props.reduceQuantityItem(order_item)
if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
if (is_xist.quantity == 0) {
const order_item = {
......@@ -356,11 +362,13 @@ class ShoppingCart extends React.Component {
} else {
this.props.reduceQuantityItem(order_item)
if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
}
}
}
}
......@@ -394,8 +402,10 @@ class ShoppingCart extends React.Component {
}
if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
}
......@@ -641,8 +651,10 @@ class ShoppingCart extends React.Component {
addItem() {
if (this.props.value_voucher !== "") {
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
this.props.navigation.goBack()
}
......@@ -1014,7 +1026,8 @@ class ShoppingCart extends React.Component {
) : (
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<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 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={''} />
......
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