Commit 9d02f0da authored by Trisno's avatar Trisno

update fixing bug shopping cart

parent e0fb59c8
{
"expo": {
"extra" : {
"buildNumber" : "134",
"buildNumber" : "135",
"remarks": ""
},
......
......@@ -362,10 +362,10 @@ class ShoppingCart extends React.Component {
})
}
} else {
if (this.state.kasproPoint - (Math.max(0,(parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value) + this.props.grabamount))) >= -1) {
console.log(this.state.kasproPoint - (Math.max(0,(parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value) + this.props.grabamount))))
if (this.state.kasproPoint - (Math.max(0, (parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value) + this.props.grabamount))) >= -1) {
console.log(this.state.kasproPoint - (Math.max(0, (parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value) + this.props.grabamount))))
this.setState({
pointsused: (Math.max(0,parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value) + this.props.grabamount)),
pointsused: (Math.max(0, parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value) + this.props.grabamount)),
balanceused: 0
})
} else {
......@@ -578,6 +578,9 @@ class ShoppingCart extends React.Component {
<View style={styles.payment}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: 'grey' }}>{i18n.t('paymentMethods')}</Text>
</View>
{
this.props.value_voucher == '' ? (
<>
<View style={{ alignItems: 'center' }}>
{
......@@ -697,6 +700,131 @@ class ShoppingCart extends React.Component {
)
}
</View>
</>
) : (
<>
<View style={{ alignItems: 'center' }}>
{
this.state.kasproBalance < this.props.order_total - parseInt(this.props.voucher.reward.value) + this.props.grabamount || this.props.order_total == 0 ? (
<Card style={{ margin: 5, padding: 10, backgroundColor: 'gray' }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
<View>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: 'white' }}>EXCELSO {i18n.t('balance')}</Text>
</View>
<View>
<FontAwesome name='circle-o' size={30} color={'#ccb46c'} />
</View>
</View>
</Card>
) : (
<TouchableOpacity onPress={() => {
this.checkedSelection('balance')
}}>
<Card style={{ margin: 5, padding: 10 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
<View>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: 'grey' }}>EXCELSO {i18n.t('balance')}</Text>
</View>
<View>
<CheckBox
onClick={() => {
this.checkedSelection('balance')
}}
isChecked={this.state.checkedBalance}
checkedImage={<FontAwesome name='check-circle' size={30} color={'#ccb46c'} />}
unCheckedImage={<FontAwesome name='circle-o' size={30} color={'#ccb46c'} />}
/>
</View>
</View>
</Card>
</TouchableOpacity>
)
}
</View>
<View style={{ alignItems: 'center' }}>
{
this.state.kasproPoint < this.props.order_total - parseInt(this.props.voucher.reward.value) + this.props.grabamount || this.props.order_total == 0 ? (
<Card style={{ margin: 5, padding: 10, backgroundColor: 'gray' }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
<View>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: 'white' }}>EXCELSO {i18n.t('point')}</Text>
</View>
<View>
<FontAwesome name='circle-o' size={30} color={'#ccb46c'} />
</View>
</View>
</Card>
) : (
<TouchableOpacity onPress={() => {
this.checkedSelection('point')
}}>
<Card style={{ margin: 5, padding: 10 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
<View>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: 'grey' }}>EXCELSO {i18n.t('point')}</Text>
</View>
<View>
<CheckBox
onClick={() => {
this.checkedSelection('point')
}}
isChecked={this.state.checkedPoint}
checkedImage={<FontAwesome name='check-circle' size={30} color={'#ccb46c'} />}
unCheckedImage={<FontAwesome name='circle-o' size={30} color={'#ccb46c'} />}
/>
</View>
</View>
</Card>
</TouchableOpacity>
)
}
</View>
<View style={{ alignItems: 'center' }}>
{
parseInt(this.state.kasproPoint) + parseInt(this.state.kasproBalance) >= this.props.order_total - parseInt(this.props.voucher.reward.value) + this.props.grabamount && this.state.kasproBalance != 0 && this.state.kasproPoint != 0 && this.props.order_total != 0 ? (
<TouchableOpacity onPress={() => {
this.checkedSelection('balancepoint')
}}>
<Card style={{ margin: 5, padding: 10 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
<View>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: 'grey' }}>EXCELSO {i18n.t('balance')} + {i18n.t('point')}</Text>
</View>
<View>
<CheckBox
onClick={() => {
this.checkedSelection('balancepoint')
}}
isChecked={this.state.checkedBalancePoint}
checkedImage={<FontAwesome name='check-circle' size={30} color={'#ccb46c'} />}
unCheckedImage={<FontAwesome name='circle-o' size={30} color={'#ccb46c'} />}
/>
</View>
</View>
</Card>
</TouchableOpacity>
) : (
<Card style={{ margin: 5, padding: 10, backgroundColor: 'gray' }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
<View>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: 'white' }}>EXCELSO {i18n.t('balance')} + {i18n.t('point')}</Text>
</View>
<View>
<FontAwesome name='circle-o' size={30} color={'#ccb46c'} />
</View>
</View>
</Card>
)
}
</View>
</>
)
}
<View style={{ alignItems: 'center', }}>
<Card style={{ margin: 5, padding: 10 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 5 }}>
......
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