Commit ffb55903 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

Merge branch 'master' of ssh://repo.cs.co.id:2222/wahyu/bahanoprek

# Conflicts:
#	view/ShoppingCart.js
parents 5161e829 37ecc649
...@@ -43,7 +43,7 @@ class ShoppingCart extends React.Component { ...@@ -43,7 +43,7 @@ class ShoppingCart extends React.Component {
componentDidMount() { componentDidMount() {
console.log('INI VOUCHER : ' + JSON.stringify(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);
} }
...@@ -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