Commit 9d02f0da authored by Trisno's avatar Trisno

update fixing bug shopping cart

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