Commit 18738d54 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

cancel order sudah di rubah dialognya jadi No / yes

parent 7332e384
......@@ -51,25 +51,38 @@ class OrderDetail extends React.Component {
}
handleCancel() {
this.setState({
modalVisible: true
})
// this.setState({
// 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() {
this.setState({
modalVisible: false
})
}
handleOrderCancel() {
if (this.state.reason == '') {
Alert.alert('', 'Reason must be filled !' )
}else{
let params = {
session_id: this.props.session_id,
transaction_id: this.props.route.params.idTrans,
reason: this.state.reason
reason: "Cancelled By User"
}
// console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/cancel', params).then(res => {
......@@ -78,12 +91,11 @@ class OrderDetail extends React.Component {
this.props.navigation.navigate('Home', { screen: 'ORDER' });
}).catch(error => {
let response = error.response.data;
Alert.alert('',response.msg);
Alert.alert('', response.msg);
})
this.setState({
modalVisible: false
})
}
}
......@@ -96,22 +108,22 @@ class OrderDetail extends React.Component {
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/detail', params).then(res => {
let data = res.data
if(data.trans_status_display == 'On Queue') {
if (data.trans_status_display == 'On Queue') {
data.trans_status_display = 'Queueing'
} else
if(data.trans_status_display == 'On Process') {
if (data.trans_status_display == 'On Process') {
data.trans_status_display = 'Processing'
} else
if(data.trans_status_display == 'Ready to Pickup') {
if (data.trans_status_display == 'Ready to Pickup') {
data.trans_status_display = 'Ready for Pickup'
} else
if(data.trans_status_display == 'On Delivery') {
if (data.trans_status_display == 'On Delivery') {
data.trans_status_display = 'Delivering'
} else
if(data.trans_status_display == 'On Completed') {
if (data.trans_status_display == 'On Completed') {
data.trans_status_display = 'Completed'
} else
if(data.trans_status_display == 'Cancelled') {
if (data.trans_status_display == 'Cancelled') {
data.trans_status_display = 'Cancelled'
}
......@@ -169,13 +181,13 @@ class OrderDetail extends React.Component {
</View>
<View>
</View>
<View style={{margin:5,flexDirection:'row'}}>
<TouchableOpacity style={{ margin:5}} onPress={() => this.handleOrderCancel()}>
<View style={{ margin: 5, flexDirection: 'row' }}>
<TouchableOpacity style={{ margin: 5 }} onPress={() => this.handleOrderCancel()}>
<View style={styles.button2}>
<Text style={{ color: 'white', fontWeight: 'bold', fontSize: 16 }}>Cancel</Text>
</View>
</TouchableOpacity>
<TouchableOpacity style={{margin:5}} onPress={() => this.handleBack()}>
<TouchableOpacity style={{ margin: 5 }} onPress={() => this.handleBack()}>
<View style={styles.button2}>
<Text style={{ color: 'white', fontWeight: 'bold', fontSize: 16 }}>Back</Text>
</View>
......@@ -245,7 +257,7 @@ class OrderDetail extends React.Component {
</View>
<View style={{ flex: 0.4, alignItems: 'baseline', justifyContent: 'center', alignItems: 'flex-start', paddingLeft: 10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{item.item_name} </Text>
<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 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> */}
......
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