Commit b231ac43 authored by Trisno's avatar Trisno

pengecekan untuk pemanggilan API get value hanya untuk reward percentage

parent 9b3d5ea8
......@@ -201,7 +201,9 @@ class DeliveryAddrees extends React.Component {
}
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
if(this.props.value_voucher.reward.type == 'percentage' ) {
this.handleVoucherSelect()
}
}
}).catch(error => {
......
......@@ -243,15 +243,15 @@ class MenuSelection extends React.Component {
// 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 => {
let voucherProps = {
value_voucher: res.data.reward,
voucher: res.data.reward
}
let voucherProps = {
value_voucher: res.data.reward,
voucher: res.data.reward
}
this.props.setVoucher(voucherProps);
this.setState({
spinner: false,
})
this.props.setVoucher(voucherProps);
this.setState({
spinner: false,
})
}).catch(error => {
try {
let response = error.response.data
......@@ -319,7 +319,9 @@ class MenuSelection extends React.Component {
let res = this.props.addToChart(order_item)
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
// console.log('After add : ' + JSON.stringify(res))
......@@ -378,7 +380,9 @@ class MenuSelection extends React.Component {
}
}
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
}
......
......@@ -123,7 +123,9 @@ class PickupName extends React.Component {
getOutletDetail(id, name, address) {
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
let OutletChange = {
......
......@@ -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,7 +284,9 @@ class ShoppingCart extends React.Component {
handleAddVoucher() {
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
this.setState({
......@@ -330,7 +334,9 @@ class ShoppingCart extends React.Component {
this.props.reduceQuantityItem(order_item)
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
if (is_xist.quantity == 0) {
......@@ -356,7 +362,9 @@ class ShoppingCart extends React.Component {
} else {
this.props.reduceQuantityItem(order_item)
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
}
}
......@@ -394,7 +402,9 @@ class ShoppingCart extends React.Component {
}
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
if (this.props.value_voucher.reward.type == 'percentage') {
this.handleVoucherSelect()
}
}
}
......@@ -641,7 +651,9 @@ class ShoppingCart extends React.Component {
addItem() {
if (this.props.value_voucher !== "") {
this.handleVoucherSelect()
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