Commit 24404605 authored by Trisno's avatar Trisno

tambah tombol lacak grab di transaction detail

parent dec30ddb
...@@ -235,5 +235,7 @@ ...@@ -235,5 +235,7 @@
"alertemailblank":"Email cannot be empty", "alertemailblank":"Email cannot be empty",
"waCallCenter":"Hello, I have a problem with trans no", "waCallCenter":"Hello, I have a problem with trans no",
"renewal_notEnoughBalance": "You don't have enough balance" "renewal_notEnoughBalance": "You don't have enough balance",
"track":"TRACK"
} }
\ No newline at end of file
...@@ -235,5 +235,7 @@ ...@@ -235,5 +235,7 @@
"alertemailblank":"Email tidak boleh kosong", "alertemailblank":"Email tidak boleh kosong",
"waCallCenter":"Halo, saya ada masalah dengan trans no", "waCallCenter":"Halo, saya ada masalah dengan trans no",
"renewal_notEnoughBalance": "Saldo anda tidak mencukupi." "renewal_notEnoughBalance": "Saldo anda tidak mencukupi.",
"track":"LACAK"
} }
\ No newline at end of file
...@@ -86,11 +86,11 @@ class OrderDetail extends React.Component { ...@@ -86,11 +86,11 @@ class OrderDetail extends React.Component {
handleOrderCancel() { handleOrderCancel() {
let params = Object.assign(requestParams,{ let params = Object.assign(requestParams, {
session_id: this.props.session_id, session_id: this.props.session_id,
transaction_id: this.props.route.params.idTrans, transaction_id: this.props.route.params.idTrans,
reason: i18n.t('cancelByUser') reason: i18n.t('cancelByUser')
}) })
// 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
...@@ -107,14 +107,14 @@ class OrderDetail extends React.Component { ...@@ -107,14 +107,14 @@ class OrderDetail extends React.Component {
} }
getDetailTrans() { getDetailTrans() {
let params = Object.assign(requestParams,{ let params = Object.assign(requestParams, {
session_id: this.props.session_id, session_id: this.props.session_id,
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') {
data.trans_status_display = 'Queueing' data.trans_status_display = 'Queueing'
} else } else
...@@ -165,6 +165,16 @@ class OrderDetail extends React.Component { ...@@ -165,6 +165,16 @@ class OrderDetail extends React.Component {
}) })
} }
_grabTrackURL = () => {
Linking.canOpenURL(this.state.detail_trans.grab_track_url).then(supported => {
if (supported) {
Linking.openURL(this.state.detail_trans.grab_track_url);
} else {
console.log("Don't know how to open URI: " + this.state.detail_trans.grab_track_url);
}
});
}
onRefresh() { onRefresh() {
this.setState({ this.setState({
is_refreshing: true, is_refreshing: true,
...@@ -385,10 +395,10 @@ class OrderDetail extends React.Component { ...@@ -385,10 +395,10 @@ class OrderDetail extends React.Component {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View> <View>
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
Linking.openURL("whatsapp://send?phone="+this.state.detail_trans.grab_driver_phone+"&text=" ) Linking.openURL("whatsapp://send?phone=" + this.state.detail_trans.grab_driver_phone + "&text=")
}}> }}>
<Icon <Icon
name='whatsapp' name='whatsapp'
type='font-awesome' type='font-awesome'
...@@ -534,7 +544,7 @@ class OrderDetail extends React.Component { ...@@ -534,7 +544,7 @@ class OrderDetail extends React.Component {
<NumberFormat decimalScale={0} value={this.state.detail_trans.point_reduce} 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.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>
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginHorizontal: 10, display:'none' }}> <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginHorizontal: 10, display: 'none' }}>
<View style={{ flex: 0.5, marginLeft: 20, marginVertical: 5 }}> <View style={{ flex: 0.5, marginLeft: 20, marginVertical: 5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('pointUsed')}</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('pointUsed')}</Text>
</View> </View>
...@@ -584,12 +594,12 @@ class OrderDetail extends React.Component { ...@@ -584,12 +594,12 @@ class OrderDetail extends React.Component {
</View> </View>
) : ( ) : (
<View style={{ marginHorizontal: 10, flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}> <View style={{ marginHorizontal: 10, flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}>
<View style={{ flex: 0.7, marginLeft: 10, marginVertical: 5}}> <View style={{ flex: 0.7, marginLeft: 10, marginVertical: 5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('taxincluded')}</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{i18n.t('taxincluded')}</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_tax} 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_tax} 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>
) )
...@@ -605,9 +615,9 @@ class OrderDetail extends React.Component { ...@@ -605,9 +615,9 @@ 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', textAlign: 'right' }}>- {this.state.detail_trans.trans_discount}</Text> */} {/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'right' }}>- {this.state.detail_trans.trans_discount}</Text> */}
<NumberFormat decimalScale={0} <NumberFormat decimalScale={0}
value={this.state.detail_trans.trans_voucher} value={this.state.detail_trans.trans_voucher}
renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', textAlign: 'right' }}>- Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> 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>
) : (null) ) : (null)
...@@ -647,17 +657,17 @@ class OrderDetail extends React.Component { ...@@ -647,17 +657,17 @@ class OrderDetail extends React.Component {
<Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#CFB368' }}>{i18n.t('total')}</Text> <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#CFB368' }}>{i18n.t('total')}</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 }}>
<NumberFormat <NumberFormat
decimalScale={0} decimalScale={0}
value={ value={
Math.max(0, parseInt(this.state.detail_trans.trans_total) - parseInt(this.state.detail_trans.trans_voucher)) Math.max(0, parseInt(this.state.detail_trans.trans_total) - parseInt(this.state.detail_trans.trans_voucher))
} }
renderText={ renderText={
value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text> value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text>
} }
displayType={'text'} displayType={'text'}
thousandSeparator={true} thousandSeparator={true}
prefix={''} prefix={''}
/> />
</View> </View>
</View> </View>
...@@ -667,30 +677,52 @@ class OrderDetail extends React.Component { ...@@ -667,30 +677,52 @@ class OrderDetail extends React.Component {
<Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#CFB368' }}>{i18n.t('total')}</Text> <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#CFB368' }}>{i18n.t('total')}</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 }}>
<NumberFormat decimalScale={0} <NumberFormat decimalScale={0}
value={this.state.detail_trans.trans_total} value={this.state.detail_trans.trans_total}
renderText={ renderText={
value => value =>
<Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text> <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text>
} }
displayType={'text'} displayType={'text'}
thousandSeparator={true} thousandSeparator={true}
prefix={''} prefix={''}
/> />
</View> </View>
</View> </View>
)) : null )) : null
} }
<TouchableOpacity onPress={() => { {this.state.detail_trans.grab_track_url == '' ? (
Linking.openURL("whatsapp://send?phone="+this.state.detail_trans.call_center_phone+"&text="+i18n.t('waCallCenter')+" "+this.state.numberId ) null
) : (
<TouchableOpacity onPress={() => {
Linking.openURL(this.state.detail_trans.grab_track_url)
}}>
<View style={styles.button3}>
<View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
<View style={{ marginRight: 10 }}>
<Icon name='motorcycle' type='font-awesome' color='white' size={24} />
</View>
<View style={{}}>
<Text style={{ color: 'white', fontSize: 16, fontFamily: 'Gotham-Black' }}>
{i18n.t('track')}
</Text>
</View>
</View>
</View>
</TouchableOpacity>
)}
<TouchableOpacity onPress={() => {
Linking.openURL("whatsapp://send?phone=" + this.state.detail_trans.call_center_phone + "&text=" + i18n.t('waCallCenter') + " " + this.state.numberId)
}}> }}>
<View style={styles.button3}> <View style={styles.button3}>
<View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}> <View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
<View style={{ marginRight: 10 }}> <View style={{ marginRight: 10 }}>
<Icon name='whatsapp' type='font-awesome' color='white' size={24} /> <Icon name='whatsapp' type='font-awesome' color='white' size={24} />
</View> </View>
<View style={{ }}> <View style={{}}>
<Text style={{ color: 'white', fontSize: 16, fontFamily: 'Gotham-Black' }}> <Text style={{ color: 'white', fontSize: 16, fontFamily: 'Gotham-Black' }}>
{i18n.t('help')} {i18n.t('help')}
</Text> </Text>
...@@ -698,7 +730,7 @@ class OrderDetail extends React.Component { ...@@ -698,7 +730,7 @@ class OrderDetail extends React.Component {
</View> </View>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
{ {
this.state.trans_status == 0 ? (<TouchableOpacity onPress={() => this.handleCancel()}> this.state.trans_status == 0 ? (<TouchableOpacity onPress={() => this.handleCancel()}>
<View style={styles.button}> <View style={styles.button}>
......
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