Commit c494cd05 authored by Trisno's avatar Trisno

update jenis transaksi dine in

parent dbbc3b2f
...@@ -40,7 +40,7 @@ class OrderDetail extends React.Component { ...@@ -40,7 +40,7 @@ class OrderDetail extends React.Component {
componentDidMount() { componentDidMount() {
// console.log("INI URL NYA : " + this.props.BASE_URL ) // console.log("INI URL NYA : " + this.props.BASE_URL )
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick); BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
this.getDetailTrans() this.getDetailTrans()
...@@ -92,7 +92,7 @@ class OrderDetail extends React.Component { ...@@ -92,7 +92,7 @@ class OrderDetail extends React.Component {
reason: "Cancelled By User" reason: "Cancelled By User"
} }
// console.log(params) // console.log(params)
Axios.post(this.props.BASE_URL+'crm/v2/transaction/cancel', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/transaction/cancel', params).then(res => {
let respon = res.data.status let respon = res.data.status
Alert.alert(respon, 'Order was canceled') Alert.alert(respon, 'Order was canceled')
this.props.navigation.navigate('Home', { screen: 'ORDER' }); this.props.navigation.navigate('Home', { screen: 'ORDER' });
...@@ -112,7 +112,7 @@ class OrderDetail extends React.Component { ...@@ -112,7 +112,7 @@ class OrderDetail extends React.Component {
transaction_id: this.props.route.params.idTrans transaction_id: this.props.route.params.idTrans
} }
// console.log("PARAMETER : " + JSON.stringify(params)) // console.log("PARAMETER : " + JSON.stringify(params))
Axios.post(this.props.BASE_URL+'crm/v2/transaction/detail', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/transaction/detail', params).then(res => {
let data = res.data let data = res.data
// console.log(data) // console.log(data)
if (data.trans_status_display == 'On Queue') { if (data.trans_status_display == 'On Queue') {
...@@ -153,6 +153,7 @@ class OrderDetail extends React.Component { ...@@ -153,6 +153,7 @@ class OrderDetail extends React.Component {
cancelled_reason: data.cancelled_reason cancelled_reason: data.cancelled_reason
}) })
console.log(this.state.detail_trans)
}).catch(error => { }).catch(error => {
let response = error.response.data; let response = error.response.data;
Alert.alert(error, response.msg); Alert.alert(error, response.msg);
...@@ -243,125 +244,178 @@ class OrderDetail extends React.Component { ...@@ -243,125 +244,178 @@ class OrderDetail extends React.Component {
{ {
this.state.detail_trans.trans_type_display == 'Pick Up' ? ( this.state.detail_trans.trans_type == 1 ? (
<View style={{ flex: 1, flexDirection: 'row', borderBottomWidth: 1, borderColor: 'grey', marginHorizontal: 10, padding: 10 }}> <View style={{ flex: 1, flexDirection: 'row', borderBottomWidth: 1, borderColor: 'grey', marginHorizontal: 10, padding: 10 }}>
<View style={{ flex: 0.1, justifyContent: 'center' }}> <View style={{ flex: 0.1, justifyContent: 'center' }}>
<FontAwesome name="map-marker" size={24} color="#d34343" /> <FontAwesome name="map-marker" size={24} color="#d34343" />
</View> </View>
{ {
this.state.detail_trans.trans_type_display == 'Pick Up' ? ( this.state.detail_trans.trans_type == 1 ? (
<View style={{ flex: 0.6, justifyContent: 'center' }}> <View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.outlet}</Text> <Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.outlet}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet_address}</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet_address}</Text>
</View> </View>
) : this.state.detail_trans.trans_type == 2 ? (
<View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.recipient_address_name}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.recipient_address}</Text>
</View>
) : ( ) : (
<View style={{ flex: 0.6, justifyContent: 'center' }}> <View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.recipient_address_name}</Text> <Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.outlet}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.recipient_address}</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet_address}</Text>
</View> </View>
)
)
} }
{ {
this.state.detail_trans.trans_type_display == 'Pick Up' ? ( this.state.detail_trans.trans_type == 1 ? (
<View style={{ flex: 0.3, justifyContent: 'center' }}> <View style={{ flex: 0.3, justifyContent: 'center' }}>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('pickup')}</Text> <Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('pickup')}</Text>
</View> </View>
) : this.state.detail_trans.trans_type == 2 ? (
<View style={{ flex: 0.3, justifyContent: 'center' }}>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('delivery')}</Text>
</View>
) : ( ) : (
<View style={{ flex: 0.3, justifyContent: 'center' }}>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>DINE IN</Text>
</View>
)
}
</View>
) : this.state.detail_trans.trans_type == 2 ? (
<View style={{ flex: 2 }}>
<View style={{ flex: 1, flexDirection: 'row', borderColor: 'grey', marginHorizontal: 10, padding: 10 }}>
<View style={{ flex: 0.1, justifyContent: 'center', alignItems: 'center' }}>
<FontAwesome name="map-marker" size={24} color="#d34343" />
</View>
{
this.state.detail_trans.trans_type_display == 'Pick Up' ? (
<View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.outlet}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet_address}</Text>
</View>
) : (
<View style={{ flex: 0.6, justifyContent: 'center', paddingLeft: 10 }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.recipient_address_name}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.recipient_address}</Text>
</View>
)
}
{
this.state.detail_trans.trans_type_display == 'Pick Up' ? (
<View style={{ flex: 0.3, justifyContent: 'center' }}> <View style={{ flex: 0.3, justifyContent: 'center' }}>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('delivery')}</Text> <Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('pickup')}</Text>
</View> </View>
) : (
<View style={{ flex: 0.3, justifyContent: 'center' }}>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('delivery')}</Text>
</View>
) )
} }
</View>
<View style={{ flex: 1, flexDirection: 'row', borderBottomWidth: 1, borderColor: 'grey', marginHorizontal: 10, padding: 10 }}>
<View style={{ flex: 0.1, justifyContent: 'center' }}>
<Image source={require('../assets/grab-logo.png')} style={{ height: 32, width: 32, borderRadius: 5, }} />
</View>
{
this.state.detail_trans.grab_driver_name == '' ? (
<View style={{ flex: 0.6, justifyContent: 'center', paddingLeft: 10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-SemiBoldItalic', color: 'grey' }}>{i18n.t('lookingForDriver')}</Text>
</View>
) : (
<View style={{ flex: 0.6, justifyContent: 'center', paddingLeft: 10 }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.grab_driver_name}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.grab_driver_phone}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.grab_driver_license_plate}</Text>
</View>
)
}
{
this.state.detail_trans.grab_driver_name == '' ? (
null
) : (
this.state.trans_status == 4 || this.state.trans_status == -1 ? (
null
) : (
<View style={{ flex: 0.3, justifyContent: 'space-between', alignItems: 'center', flexDirection: 'row' }}>
<View style={{ paddingLeft: 30 }}>
<TouchableOpacity onPress={() => { Linking.openURL('tel:' + this.state.detail_trans.grab_driver_phone) }}>
<Icon
name='ios-call'
type='ionicon'
color='#838383'
size={30}
/>
</TouchableOpacity>
</View>
<View>
<TouchableOpacity onPress={() => { Linking.openURL('whatsapp://send?text=say something&phone=' + this.state.detail_trans.grab_driver_phone) }}>
<Icon
name='whatsapp'
type='font-awesome'
color='green'
size={30}
/>
</TouchableOpacity>
</View>
</View>
)
)
}
</View>
</View> </View>
) : ( ) : (
<View style={{ flex: 1, flexDirection: 'row', borderBottomWidth: 1, borderColor: 'grey', marginHorizontal: 10, padding: 10 }}>
<View style={{ flex: 2 }}> <View style={{ flex: 0.1, justifyContent: 'center' }}>
<View style={{ flex: 1, flexDirection: 'row', borderColor: 'grey', marginHorizontal: 10, padding: 10 }}>
<View style={{ flex: 0.1, justifyContent: 'center', alignItems: 'center' }}>
<FontAwesome name="map-marker" size={24} color="#d34343" /> <FontAwesome name="map-marker" size={24} color="#d34343" />
</View> </View>
{ {
this.state.detail_trans.trans_type_display == 'Pick Up' ? ( this.state.detail_trans.trans_type == 1 ? (
<View style={{ flex: 0.6, justifyContent: 'center' }}> <View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.outlet}</Text> <Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.outlet}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet_address}</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet_address}</Text>
</View> </View>
) : this.state.detail_trans.trans_type == 2 ? (
<View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.recipient_address_name}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.recipient_address}</Text>
</View>
) : ( ) : (
<View style={{ flex: 0.6, justifyContent: 'center', paddingLeft: 10 }}> <View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.recipient_address_name}</Text> <Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.outlet}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.recipient_address}</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet_address}</Text>
</View> </View>
)
)
} }
{ {
this.state.detail_trans.trans_type_display == 'Pick Up' ? ( this.state.detail_trans.trans_type == 1 ? (
<View style={{ flex: 0.3, justifyContent: 'center' }}> <View style={{ flex: 0.3, justifyContent: 'center' }}>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('pickup')}</Text> <Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('pickup')}</Text>
</View> </View>
) : ( ) : this.state.detail_trans.trans_type == 2 ? (
<View style={{ flex: 0.3, justifyContent: 'center' }}> <View style={{ flex: 0.3, justifyContent: 'center' }}>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('delivery')}</Text> <Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('delivery')}</Text>
</View>
)
}
</View>
<View style={{ flex: 1, flexDirection: 'row', borderBottomWidth: 1, borderColor: 'grey', marginHorizontal: 10, padding: 10 }}>
<View style={{ flex: 0.1, justifyContent: 'center' }}>
<Image source={require('../assets/grab-logo.png')} style={{ height: 32, width: 32, borderRadius: 5, }} />
</View>
{
this.state.detail_trans.grab_driver_name == '' ? (
<View style={{ flex: 0.6, justifyContent: 'center', paddingLeft: 10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-SemiBoldItalic', color: 'grey' }}>{i18n.t('lookingForDriver')}</Text>
</View> </View>
) : ( ) : (
<View style={{ flex: 0.6, justifyContent: 'center', paddingLeft: 10 }}> <View style={{ flex: 0.3, justifyContent: 'center' }}>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Black', color: 'grey' }}>{this.state.detail_trans.grab_driver_name}</Text> <Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>DINE IN</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.grab_driver_phone}</Text> </View>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.grab_driver_license_plate}</Text> )
</View>
)
}
{
this.state.detail_trans.grab_driver_name == '' ? (
null
) : (
this.state.trans_status == 4 || this.state.trans_status == -1 ? (
null
) : (
<View style={{ flex: 0.3, justifyContent: 'space-between', alignItems: 'center', flexDirection: 'row' }}>
<View style={{ paddingLeft: 30 }}>
<TouchableOpacity onPress={() => { Linking.openURL('tel:' + this.state.detail_trans.grab_driver_phone) }}>
<Icon
name='ios-call'
type='ionicon'
color='#838383'
size={30}
/>
</TouchableOpacity>
</View>
<View>
<TouchableOpacity onPress={() => { Linking.openURL('whatsapp://send?text=say something&phone=' + this.state.detail_trans.grab_driver_phone) }}>
<Icon
name='whatsapp'
type='font-awesome'
color='green'
size={30}
/>
</TouchableOpacity>
</View>
</View>
)
)
} }
</View> </View>
</View> )
)
} }
...@@ -455,16 +509,34 @@ class OrderDetail extends React.Component { ...@@ -455,16 +509,34 @@ class OrderDetail extends React.Component {
</View> </View>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}> <View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{this.state.detail_trans.point_booked}</Text> */} {/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{this.state.detail_trans.point_booked}</Text> */}
<NumberFormat decimalScale={0} value={this.state.detail_trans.point_booked} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={this.state.detail_trans.kaspro_point_reduce} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View> </View>
</View> </View>
{/* Non Balance untuk Dine In */}
{
this.state.detail_trans.trans_type == 3 ? (
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginHorizontal: 10 }}>
<View style={{ flex: 0.5, marginLeft: 20, marginVertical: 5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Non Balance</Text>
</View>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{this.state.detail_trans.point_booked}</Text> */}
<NumberFormat decimalScale={0} value={parseInt(this.state.detail_trans.trans_total) - (parseInt(this.state.detail_trans.point_reduce) + parseInt(this.state.detail_trans.kaspro_point_reduce))} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
</View>
) : null
}
<View style={{ marginTop: 5, borderTopWidth: 1, borderColor: 'grey', marginHorizontal: 10, flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}> <View style={{ marginTop: 5, borderTopWidth: 1, borderColor: 'grey', marginHorizontal: 10, flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}>
<View style={{ flex: 0.5, marginLeft: 10, marginVertical: 5 }}> <View style={{ flex: 0.5, marginLeft: 10, marginVertical: 5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('price')}</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('price')}</Text>
</View> </View>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}> <View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'right' }}>{this.state.detail_trans.trans_subtotal}</Text> */} {/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'right' }}>{this.state.detail_trans.trans_subtotal}</Text> */}
<NumberFormat decimalScale={0} value={this.state.detail_trans.trans_subtotal} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', textAlign: 'right' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={this.state.detail_trans.trans_total} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', textAlign: 'right' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View> </View>
</View> </View>
{ {
...@@ -512,7 +584,7 @@ class OrderDetail extends React.Component { ...@@ -512,7 +584,7 @@ class OrderDetail extends React.Component {
</View> </View>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}> <View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}>
{/* <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>{this.state.detail_trans.trans_total}</Text> */} {/* <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>{this.state.detail_trans.trans_total}</Text> */}
<NumberFormat decimalScale={0} value={this.state.detail_trans.point_reduce} renderText={value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={this.state.detail_trans.trans_total} renderText={value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View> </View>
</View> </View>
...@@ -656,7 +728,7 @@ const mapStateToProps = (state) => { ...@@ -656,7 +728,7 @@ const mapStateToProps = (state) => {
trans_id: state.trans_id, trans_id: state.trans_id,
lat: state.lat, lat: state.lat,
long: state.long, long: state.long,
BASE_URL : state.BASE_URL BASE_URL: state.BASE_URL
} }
} }
......
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