Commit 37ecc649 authored by Trisno's avatar Trisno

add reward di shopping cart

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