Commit 7f8fc28c authored by Trisno's avatar Trisno

fix recalculate, cek menu,balance, verifikasi sebelum checkout

parent 501fb054
......@@ -16,8 +16,8 @@ class ShoppingCart extends React.Component {
constructor(props) {
super(props)
this.state = {
kasproBalance: '',
kasproPoint: '',
kasproBalance: 0,
kasproPoint: 0,
checkedBalance: false,
checkedPoint: false,
checkedBalancePoint: false,
......@@ -106,6 +106,13 @@ class ShoppingCart extends React.Component {
}
handleMin(item, index) {
this.setState({
checkedBalance: false,
checkedPoint: false,
checkedBalancePoint: false,
pointsused: 0,
balanceused: 0
})
// console.log("hai")
const list_order_item = this.props.order_item;
// console.log('wakwaw')
......@@ -152,7 +159,13 @@ class ShoppingCart extends React.Component {
}
handleAdd(item, index) {
this.setState({
checkedBalance: false,
checkedPoint: false,
checkedBalancePoint: false,
pointsused: 0,
balanceused: 0
})
const order_item = {
id: item.id,
code: item.code,
......@@ -291,7 +304,9 @@ class ShoppingCart extends React.Component {
checkOut() {
if (this.state.checkedBalance == false && this.state.checkedPoint == false && this.state.checkedBalancePoint == false) {
if (this.props.order_item.length == 0){
Alert.alert('Error', 'Please choose your order first')
} else if (this.state.checkedBalance == false && this.state.checkedPoint == false && this.state.checkedBalancePoint == false){
Alert.alert('Error', 'Please insert payment methods')
} else {
this.props.navigation.navigate('Confirm Your Order', { balanceUsed: this.state.balanceused, pointused: this.state.pointsused })
......@@ -306,8 +321,8 @@ class ShoppingCart extends React.Component {
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
const { kaspro_balance, kaspro_point } = res.data
this.setState({
kasproBalance: kaspro_balance,
kasproPoint: kaspro_point
kasproBalance: kaspro_balance.replace(/,/g, ''),
kasproPoint: kaspro_point.replace(/,/g, '')
})
// console.log(this.state.kasproBalance, this.state.kasproPoint)
......@@ -317,6 +332,10 @@ class ShoppingCart extends React.Component {
}
render() {
// console.log('496000'.replace(/,/g, ''))
// console.log(this.state.kasproBalance)
// console.log(this.props.order_total)
// console.log(this.props.order_item.length)
return (
<ScrollView style={styles.container}>
<View style={{ flexDirection: 'row', justifyContent: 'center' }}>
......
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