Commit 0b39053f authored by Trisno's avatar Trisno

update

parent d5d28a34
{
"expo": {
"name": "Excelso_update v1. Sore_12.05.2020",
"name": "Excelso_update v1. 13.05.2020",
"slug": "excelso-pro",
"privacy": "public",
"sdkVersion": "36.0.0",
......
......@@ -294,7 +294,7 @@ class Home extends React.Component {
<TouchableOpacity style={styles.submitUpgradePemium} activeOpacity={.5} onPress={this.onPress}>
<Text style={{ textAlign: 'center', bottom: 5, color: 'white' }}>TOP BALANCE </Text>
</TouchableOpacity>
<Text> sore 12 May 2019 </Text>
<Text> 13 May 2020 </Text>
<View style={{ height: 60 }}></View>
</View>
</View>
......
......@@ -16,12 +16,12 @@ class MenuConfirmation extends React.Component {
ongkir: 0,
diskon: 0,
totalOrder: 0,
type:'',
type: '',
spinner: false,
}
}
componentDidMount(){
componentDidMount() {
// console.log(" DESTINASI : "+ this.props.grabdestination)
// console.log("ONGKIR"+ this.props.grabamount)
// console.log("drop off"+this.props.grabdropoff)
......@@ -30,7 +30,7 @@ class MenuConfirmation extends React.Component {
// console.log("BALANCED" +this.props.balanceUsed)
// console.log("POINT" +this.props.pointsused)
}
setOrder(is_pickup) {
......@@ -39,19 +39,19 @@ class MenuConfirmation extends React.Component {
})
if (is_pickup) {
this.setState({
type : 'Pick Up'
type: 'Pick Up'
})
} else {
this.setState({
type : 'Delivery'
type: 'Delivery'
})
}
// console.log(is_pickup)
let params = {
session_id : this.props.session_id,
outlet_id : this.props.outlet_id,
address_id : this.props.addressId,
session_id: this.props.session_id,
outlet_id: this.props.outlet_id,
address_id: this.props.addressId,
trans_type: this.state.type,
order_item: this.props.order_item,
delivery_charge: this.props.grabamount,
......@@ -69,26 +69,44 @@ class MenuConfirmation extends React.Component {
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/booking', params).then(res => {
let data_order = res.data.data.id
this.setState({
spinner: false,
})
let transIdProps = {
trans_id : data_order
}
this.props.setTransId(transIdProps);
trans_id: data_order
}
this.props.setTransId(transIdProps);
// add API use voucher here
// let param = {
// session_id: this.props.session_id,
// reward_id: this.props.voucher.id,
// lat: this.props.lat,
// long: this.props.long
// }
// add API use voucher here
// Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/reward/use_reward', param).then(res => {
// console.log(res.data)
// }).catch(error => {
// const { navigation } = this.props
// let response = error.response.data
// session(response, navigation)
// Alert.alert(response.msg);
// this.setState({
// spinner: false,
// })
// })
Alert.alert(
"Berhasil",
"Transaksi sudah berhasil, terimakasih sudah menggunakan excelso untuk ngopi",
[
{ text: "OK", onPress: () => this.orderSuccess()}
{ text: "OK", onPress: () => this.orderSuccess() }
],
{ cancelable: false }
);
);
}).catch(error => {
const { navigation } = this.props
let response = error.response.data
......@@ -102,7 +120,7 @@ class MenuConfirmation extends React.Component {
orderSuccess = () => {
this.props.setOrderFinish()
this.props.navigation.navigate('Order Detail');
this.props.navigation.navigate('Order Detail');
// this.props.navigation.reset({
// routes: [{ name: 'Home' }]
// })
......@@ -110,7 +128,7 @@ class MenuConfirmation extends React.Component {
render() {
// console.log(this.props)
console.log(this.props.long)
let total = 0
return (
<ScrollView style={styles.container}>
......@@ -121,7 +139,7 @@ class MenuConfirmation extends React.Component {
/>
{
this.props.order_item.map((item, index) => {
total = total + item.quantity * item.price
total = total + item.quantity * item.price
return (
<View style={{ margin: 10 }} key={index}>
<View style={{ flex: 1, margin: 10, flexDirection: 'row', justifyContent: 'space-around' }}>
......@@ -155,35 +173,35 @@ class MenuConfirmation extends React.Component {
</View>
<View style={{ flexDirection: 'row', margin: 10, justifyContent: 'space-between' }}>
{this.props.type_pickup == true? (
null
):(
<View>
<View style={{ margin: 10 }}>
<Text>Delivery Charge</Text>
</View>
{this.props.type_pickup == true ? (
null
) : (
<View>
<View style={{ margin: 10 }}>
<Text>Delivery Charge</Text>
</View>
<View style={{ margin: 10 }}>
<Text>{this.props.grabamount}</Text>
</View>
</View>
)}
<View style={{ margin: 10 }}>
<Text>{this.props.grabamount}</Text>
</View>
</View>
)}
</View>
<View style={{ flexDirection: 'row', margin: 10, justifyContent: 'space-between', borderTopWidth: 1 }}>
<View style={{ margin: 10 }}>
<Text>Total</Text>
</View>
{this.props.type_pickup == true? (
{this.props.type_pickup == true ? (
<View style={{ margin: 10 }}>
<Text>{ Math.max(0,this.props.order_total - this.props.voucher.reward.value)}</Text>
</View>
):(
<View style={{ margin: 10 }}>
<Text>{this.props.order_total + this.props.grabamount + this.state.diskon }</Text>
</View>
)}
<Text>{Math.max(0, this.props.order_total - this.props.voucher.reward.value)}</Text>
</View>
) : (
<View style={{ margin: 10 }}>
<Text>{this.props.order_total + this.props.grabamount + this.state.diskon}</Text>
</View>
)}
</View>
<View style={{ flexDirection: 'row', margin: 10, justifyContent: 'space-between', borderTopWidth: 1 }}>
<View style={{ margin: 10 }}>
......@@ -201,20 +219,20 @@ class MenuConfirmation extends React.Component {
<Text>{this.props.route.params.pointused}</Text>
</View>
</View>
{this.props.type_pickup == true ? (
null
):(
{this.props.type_pickup == true ? (
null
) : (
<View style={{ flexDirection: 'row', margin: 10, justifyContent: 'space-between' }}>
<View style={{ margin: 10 }}>
<Text>Delivery to</Text>
</View>
<View style={{ margin: 10 }}>
<Text>{this.props.address}</Text>
</View>
</View>
<View style={{ margin: 10 }}>
<Text>Delivery to</Text>
</View>
<View style={{ margin: 10 }}>
<Text>{this.props.address}</Text>
</View>
</View>
)}
<View style={{ margin: 10 }}>
<Button title='order' onPress={() => this.setOrder(this.props.type_pickup)}/>
<Button title='order' onPress={() => this.setOrder(this.props.type_pickup)} />
</View>
</ScrollView>
)
......@@ -254,7 +272,7 @@ const mapDispatchToProps = (dispacth) => {
setTransId: (transIdProps) => dispacth({
type: ActionType.SET_TRANS_ID,
data: {
trans_id: transIdProps.trans_id,
trans_id: transIdProps.trans_id,
}
})
}
......@@ -276,12 +294,14 @@ const mapStateToProps = (state) => {
grabtype: state.grabtype,
grabamount: state.grabamount,
grabpickup: state.grabpickup,
grabdropoff:state.grabdropoff,
grabdestination:state.grabdestination,
grabdropoff: state.grabdropoff,
grabdestination: state.grabdestination,
balanceUsed: state.balanceUsed,
pointused: state.pointused,
addressId: state.addressId
addressId: state.addressId,
lat: state.lat,
long: state.long
}
}
export default connect(mapStateToProps,mapDispatchToProps)(MenuConfirmation)
export default connect(mapStateToProps, mapDispatchToProps)(MenuConfirmation)
......@@ -438,7 +438,7 @@ class ShoppingCart extends React.Component {
</View>
<View style={styles.voucher}>
{
this.props.voucher === [] ? (
this.props.value_voucher == '' ? (
<TouchableOpacity onPress={() => this.props.navigation.navigate('Reward Select')}>
<Text style={{ color: '#ccb46c' }}>+ ADD VOUCHER</Text>
</TouchableOpacity>
......
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