Commit 37ecc649 authored by Trisno's avatar Trisno

add reward di shopping cart

parent 16c8be4d
......@@ -96,17 +96,17 @@ class RewardSelect extends React.Component {
<View>
<Image source={{ uri: item.reward.title_image }}
resizeMethod="resize"
resizeMode='stretch'
style={{ height: 150, width: 430 }} />
resizeMode='cover'
style={{ height: 150, width: '100%' }} />
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 10 }}>
<View style={{ flexDirection: 'row', justifyContent:'space-between', padding:10 }}>
<View>
<Text style={{ fontWeight: 'bold' }}>{item.reward.title}</Text>
<Text>{item.reward.subtitle}</Text>
<Text style={{fontWeight:'bold', textAlign:'left'}}>{item.reward.title}</Text>
<Text style={{textAlign:'left'}}>{item.reward.subtitle}</Text>
</View>
<View>
<Text style={{ textAlign: 'right' }}>Expired</Text>
<Text style={{ textAlign: 'right' }}>{item.expire_time}</Text>
<Text style={{textAlign:'right'}}>Expired</Text>
<Text style={{textAlign:'right'}}>{item.expire_time}</Text>
</View>
</View>
</Card>
......
......@@ -43,7 +43,7 @@ class ShoppingCart extends React.Component {
componentDidMount() {
console.log('INI VOUCHER : ' + this.props.voucher)
console.log(this.props.voucher)
console.log('INI VALUE : ' + this.props.value_voucher)
if (!this.props.type_pickup) {
this.getRate()
......@@ -110,7 +110,7 @@ class ShoppingCart extends React.Component {
}
onChange(params){
onChange(params) {
console.log(params);
}
......@@ -151,7 +151,7 @@ class ShoppingCart extends React.Component {
{
text: 'Delete Item', onPress: () => {
this.props.reduceQuantityItem(order_item)
if (is_xist.quantity == 0) {
const order_item = {
id: item.id,
......@@ -161,9 +161,9 @@ class ShoppingCart extends React.Component {
image: item.image,
description: item.description,
quantity: item.quantity
}
this.props.removeFromChart(order_item)
}
}
......@@ -179,7 +179,7 @@ class ShoppingCart extends React.Component {
}
deleteItem() {
}
handleAdd(item, index) {
......@@ -325,15 +325,15 @@ class ShoppingCart extends React.Component {
this.props.setOrder(setOrdersProps);
}).catch(error => {
const {navigation} = this.props
const { navigation } = this.props
let response = error.response.data
session(response,navigation)
session(response, navigation)
Alert.alert(response.msg);
})
}
onChange(){
onChange() {
this.setState({
checkedBalance: false,
checkedPoint: false,
......@@ -344,9 +344,9 @@ class ShoppingCart extends React.Component {
}
checkOut() {
if (this.props.order_item.length == 0){
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){
} 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 })
......@@ -419,7 +419,7 @@ class ShoppingCart extends React.Component {
item={item}
handleAdd={() => this.handleAdd(item, index)}
handleMin={() => this.handleMin(item, index)}
onChange={()=> this.onChange(item,index)}
onChange={() => this.onChange(item, index)}
/>
)}
keyExtractor={item => item.id}
......@@ -430,6 +430,33 @@ class ShoppingCart extends React.Component {
<Text style={{ color: '#ccb46c' }}>+ ADD VOUCHER</Text>
</TouchableOpacity>
</View>
<View style={{ alignItems: 'center' }}>
{
this.props.voucher === [] ? (
<> </>
) : (
<Card style={{ padding: 5, margin: 10 }}>
<View>
<Image source={{ uri: this.props.voucher.title_image }}
resizeMethod="resize"
resizeMode='cover'
style={{ height: 150, width: '100%' }} />
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 10 }}>
<View>
<Text style={{ fontWeight: 'bold', textAlign: 'left' }}>{this.props.voucher.title}</Text>
<Text style={{ textAlign: 'left' }}>{this.props.voucher.subtitle}</Text>
</View>
<View>
<Text style={{ textAlign: 'right' }}>Diskon</Text>
<Text style={{ textAlign: 'right' }}>{this.props.voucher.value}</Text>
</View>
</View>
</Card>
)
}
</View>
<View style={styles.payment}>
<Text>PAYMENT METHODS</Text>
</View>
......@@ -861,6 +888,8 @@ const mapStateToProps = (state) => {
session_id: state.session_id,
outlet_id: state.outlet_id,
name_outlet: state.name_outlet,
value_voucher: state.value_voucher,
voucher: state.voucher,
order_quantity: state.order_quantity,
order_total: state.order_total,
order_item: state.order_item,
......
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