Commit c12d0dd3 authored by Trisno's avatar Trisno

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

# Conflicts:
#	view/MenuConfirmation.js
#	view/OrderDetail.js
parents fe11b661 c039fa8e
...@@ -67,7 +67,7 @@ export default function App() { ...@@ -67,7 +67,7 @@ export default function App() {
} else if (data.action_type == 'Inbox') { } else if (data.action_type == 'Inbox') {
} else if (data.action_type == 'Transaction') { } else if (data.action_type == 'Transaction') {
RootNavigation.navigate('Transaction Detail', {idTrans:data.data_id}); RootNavigation.navigate('Order Detail', {idTrans:data.data_id});
} else if (data.action_type == 'Review') { } else if (data.action_type == 'Review') {
RootNavigation.navigate('RatingOrder', {idTrans:data.data_id}); RootNavigation.navigate('RatingOrder', {idTrans:data.data_id});
} else if (data.action_type == 'WebView') { } else if (data.action_type == 'WebView') {
......
...@@ -115,14 +115,8 @@ class MenuConfirmation extends React.Component { ...@@ -115,14 +115,8 @@ class MenuConfirmation extends React.Component {
{ cancelable: false } { cancelable: false }
); );
}).catch(error => { }).catch(error => {
console.log(error.response) let response = error.response.data;
if (error.response.status <= 500) { Alert.alert('', response.msg);
let response = error.response.data;
Alert.alert('', response.msg);
} else {
let response = error.response.data;
Alert.alert('', response.msg);
}
this.setState({ this.setState({
spinner: false, spinner: false,
}) })
...@@ -190,12 +184,13 @@ class MenuConfirmation extends React.Component { ...@@ -190,12 +184,13 @@ class MenuConfirmation extends React.Component {
{ cancelable: false } { cancelable: false }
); );
}).catch(error => { }).catch(error => {
if (error.response.status <= 500) {
Alert.alert(String(error.response.status), 'Internal Server Error') let response = error.response.data;
} else { Alert.alert('', response.msg);
let response = error.response.data; this.setState({
Alert.alert('', response.msg); spinner: false,
} })
this.setState({ this.setState({
spinner: false, spinner: false,
}) })
......
...@@ -51,9 +51,24 @@ class OrderDetail extends React.Component { ...@@ -51,9 +51,24 @@ class OrderDetail extends React.Component {
} }
handleCancel() { handleCancel() {
this.setState({ // this.setState({
modalVisible: true // modalVisible: true
}) // })
Alert.alert(
"Cancel Order",
"Are you sure you want to cancel the order ?",
[
{
text: 'No',
onPress: () => console.log('Cancel Delete Item'),
style: 'cancel',
},
{
text: 'Yes', onPress: () => this.handleOrderCancel()
},
],
{ cancelable: false },
)
} }
handleBack() { handleBack() {
...@@ -63,27 +78,24 @@ class OrderDetail extends React.Component { ...@@ -63,27 +78,24 @@ class OrderDetail extends React.Component {
} }
handleOrderCancel() { handleOrderCancel() {
if (this.state.reason == '') {
Alert.alert('', 'Reason must be filled !') let params = {
} else { session_id: this.props.session_id,
let params = { transaction_id: this.props.route.params.idTrans,
session_id: this.props.session_id, reason: "Cancelled By User"
transaction_id: this.props.route.params.idTrans,
reason: this.state.reason
}
// console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/cancel', params).then(res => {
let respon = res.data.status
Alert.alert(respon, 'Order was canceled')
this.props.navigation.navigate('Home', { screen: 'ORDER' });
}).catch(error => {
let response = error.response.data;
Alert.alert('', response.msg);
})
this.setState({
modalVisible: false
})
} }
// console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/cancel', params).then(res => {
let respon = res.data.status
Alert.alert(respon, 'Order was canceled')
this.props.navigation.navigate('Home', { screen: 'ORDER' });
}).catch(error => {
let response = error.response.data;
Alert.alert('', response.msg);
})
this.setState({
modalVisible: false
})
} }
...@@ -254,7 +266,6 @@ class OrderDetail extends React.Component { ...@@ -254,7 +266,6 @@ class OrderDetail extends React.Component {
) )
} }
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', top: 10 }}>Keterangan : {item.item_note} </Text> */} {/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', top: 10 }}>Keterangan : {item.item_note} </Text> */}
</View> </View>
<View style={{ flex: 0.3, alignItems: 'flex-end', justifyContent: 'center', paddingRight: 10 }}> <View style={{ flex: 0.3, alignItems: 'flex-end', justifyContent: 'center', paddingRight: 10 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{item.item_quantity * item.item_price} </Text> */} {/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{item.item_quantity * item.item_price} </Text> */}
......
...@@ -168,12 +168,12 @@ class ShoppingCart extends React.Component { ...@@ -168,12 +168,12 @@ class ShoppingCart extends React.Component {
"Are you sure want to delete item?", "Are you sure want to delete item?",
[ [
{ {
text: 'Cancel', text: 'No',
onPress: () => console.log('Cancel Delete Item'), onPress: () => console.log('Cancel Delete Item'),
style: 'cancel', style: 'cancel',
}, },
{ {
text: 'Delete Item', onPress: () => { text: 'Yes', onPress: () => {
this.props.reduceQuantityItem(order_item) this.props.reduceQuantityItem(order_item)
if (is_xist.quantity == 0) { if (is_xist.quantity == 0) {
......
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