Commit f1248101 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

account , outlet

parent 7b1339f6
...@@ -232,7 +232,7 @@ class AddreesDetail extends React.Component { ...@@ -232,7 +232,7 @@ class AddreesDetail extends React.Component {
<View style={styles.field_detail_addrees}> <View style={styles.field_detail_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', marginLeft: 10, color: "#ccb46c", textAlign: 'center', fontSize: 18 }} >Detail</Text> <Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c",textAlign:'center', fontSize: 18 }}>Detail</Text>
<TextInput style={{ height: 150, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey', justifyContent: 'flex-start' }} <TextInput style={{ height: 150, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey', justifyContent: 'flex-start' }}
onChangeText={(description) => this.setState({ description })} onChangeText={(description) => this.setState({ description })}
numberOfLines={10} numberOfLines={10}
......
This diff is collapsed.
...@@ -37,10 +37,16 @@ class Outlets extends React.Component { ...@@ -37,10 +37,16 @@ class Outlets extends React.Component {
} }
componentDidMount() { componentDidMount() {
this._getOutletClosest()
this.OrderedList()
this._getPermissions()
this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({
indicator: true,
})
this._getOutletClosest()
this.OrderedList()
this._getPermissions()
});
} }
_getPermissions = async () => { _getPermissions = async () => {
......
...@@ -3,6 +3,7 @@ import { View, Text, TextInput, StyleSheet, Button, Alert, TouchableOpacity, Ima ...@@ -3,6 +3,7 @@ import { View, Text, TextInput, StyleSheet, Button, Alert, TouchableOpacity, Ima
import { Rating, AirbnbRating } from 'react-native-elements'; import { Rating, AirbnbRating } from 'react-native-elements';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Axios from 'axios'; import Axios from 'axios';
import moment from 'moment'
import ActionType from '../redux/globalActionType'; import ActionType from '../redux/globalActionType';
import Spinner from 'react-native-loading-spinner-overlay'; import Spinner from 'react-native-loading-spinner-overlay';
...@@ -13,86 +14,122 @@ class RatingOrder extends React.Component { ...@@ -13,86 +14,122 @@ class RatingOrder extends React.Component {
this.state = { this.state = {
review: "", review: "",
rating: 5, rating: 5,
outlet: '',
outlet_code: '',
trans_status_display: '',
transaction_detail: [],
numberId: '',
detail_trans: '',
trans_status: '',
modalVisible: false,
} }
} }
rating(rating){ componentDidMount() {
this.getDetailTrans();
}
getDetailTrans() {
let params = {
session_id: this.props.session_id,
transaction_id: this.props.route.params.idTrans
}
// console.log("PARAMETER : " + JSON.stringify(params))
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/detail', params).then(res => {
let data = res.data
// console.log('ini data' + JSON.stringify(data))
// console.log("INI OUTLET "+ data.outlet)
// console.log("OUTLET-CODE" + data.outlet_code)
// console.log("TRANS-DISPLAY" + data.trans_type_display)
this.setState({
outlet: data.outlet,
outlet_code: data.outlet_code,
trans_status_display: data.trans_status_display,
transaction_detail: data.transaction_detail,
detail_trans: data,
trans_status: data.trans_status,
numberId: data.id.substring(0, 5).toUpperCase()
})
}).catch(error => {
const { navigation } = this.props
let response = error.response.data
session(response, navigation)
Alert.alert(response.msg);
this.setState({
indicator: false,
})
// let response = error.response.data;
// Alert.alert(response.msg);
})
}
rating(rating) {
this.setState({ this.setState({
rating: rating, rating: rating,
}) })
} }
review(){ review() {
let paramater = { let paramater = {
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,
rating: this.state.rating, rating: this.state.rating,
review: this.state.review, review: this.state.review,
lat: this.props.lat, lat: this.props.lat,
long: this.props.long long: this.props.long
} }
console.log("INI PARAMS"+ JSON.stringify(paramater) ); console.log("INI PARAMS" + JSON.stringify(paramater));
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/review/transaction', paramater).then(res => { Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/review/transaction', paramater).then(res => {
Alert.alert("Terimakasih Atas masukan anda!") Alert.alert('', 'Terimakasih Atas masukan anda!')
this.props.navigation.navigate('Home'); this.props.navigation.navigate('Home');
}).catch(error => { }).catch(error => {
console.log ("INI error " + error) console.log("INI error " + error)
let response = error.response.data; let response = error.response.data;
Alert.alert(response.msg); Alert.alert(response.msg);
}) })
} }
render() { render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Spinner
visible={this.state.spinner}
textContent={'Loading...'}
textStyle={styles.spinnerTextStyle}
/>
<View style={{ flex: 3 }}> <View style={{ flex: 3 }}>
<View style={{ flex: 1, marginRight: 30, marginLeft: 30, top: 50 }}> <View style={{ height: 100, justifyContent: 'center' }}>
<Text style={{ margin: 20, fontFamily: 'Gotham-Light', fontSize: 14, color: '#838383' }}>How was your experience with your <Text style={{ color: 'red' }}>{this.state.detail_trans.trans_type_display}</Text> order with us {this.state.outlet} on <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'center', color: '#838383' }}>{moment(this.state.detail_trans.trans_time).format('DD MMMM YYYY HH:mm:ss')}</Text> </Text>
</View>
<View style={{ flex: 1, marginRight: 30, marginLeft: 30, }}>
<AirbnbRating <AirbnbRating
count={5} count={5}
reviews={["Terrible", "Bad", "Meh", "OK", "Good", "Hmm...", "Very Good", ]} reviews={["Need improvement", "Bellow average", "Average", "Good", "Awesome"]}
onFinishRating={rating => this.rating(rating)} onFinishRating={rating => this.rating(rating)}
defaultRating={5} defaultRating={5}
size={30} size={30}
/> />
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3,top:10}}>Review</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3, top: 10 }}>Review</Text>
<TextInput style={{ height: 150, borderWidth: 1, padding: 5, margin: 10, borderRadius: 10, borderColor: 'grey', fontFamily: 'Gotham-Black', textAlign: 'center', color: 'grey', fontWeight: 'bold', fontSize: 20,top:20 }} <TextInput style={{ height: 150, borderWidth: 1, padding: 5, margin: 10, borderRadius: 10, borderColor: 'grey', fontFamily: 'Gotham-Black', textAlign: 'center', color: 'grey', fontWeight: 'bold', fontSize: 20, top: 20 }}
onChangeText={(review) => this.setState({ review })} onChangeText={(review) => this.setState({ review })}
value={this.state.review} value={this.state.review}
autoCapitalize="none" autoCapitalize="none"
value={this.state.review} value={this.state.review}
/> />
<TouchableOpacity style={{ height: 100 }} onPress={()=>this.review()}> <TouchableOpacity style={{ height: 100 }} onPress={() => this.review()}>
<View style={{ backgroundColor: '#CFB368', height: 45, top: 20, borderRadius: 10, marginRight: 50, marginLeft: 50 }}> <View style={{ backgroundColor: '#CFB368', height: 40, top: 20, borderRadius: 10, marginRight: 50, marginLeft: 50 }}>
<Text style={{ alignSelf: 'center', top: 10, color: 'white', fontFamily: 'Gotham-Black', fontSize: 20 }}>SUBMIT</Text> <Text style={{ alignSelf: 'center', top: 10, color: 'white', fontFamily: 'Gotham-Black', fontSize: 20 }}>SUBMIT</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
<View style={{ flex: 1, flexDirection: 'row' }}> <View style={{ flex: 1, flexDirection: 'row' }}>
{/*
<View style={styles.v_logo}>
<View style={{ flex: 1, alignSelf: 'flex-start' }}>
<Image resizeMode="contain" source={require('../assets/images/daun.png')} style={styles.logo}></Image>
</View>
<View style={{ flex: 1 }}>
</View>
</View> */}
<View style={{ flex: 0.5 }}> <View style={{ flex: 0.5 }}>
</View> </View>
</View> </View>
</View> </View>
...@@ -148,7 +185,7 @@ const styles = StyleSheet.create({ ...@@ -148,7 +185,7 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
session_id: state.session_id, session_id: state.session_id,
lat: state.lat, lat: state.lat,
long: state.long, long: state.long,
......
...@@ -46,21 +46,32 @@ class UseBalance extends React.Component { ...@@ -46,21 +46,32 @@ class UseBalance extends React.Component {
}) })
}).catch(error => { }).catch(error => {
// console.log('ini error ' + error) // console.log('ini error ' + error)
}) })
} }
redeem(){ redeem(){
if (this.state.current_balance > this.state.redeem) { let params = {
session_id: this.props.session_id,
Alert.alert('','Balance tidak cukup !') pin : 123456,
}else{ balance: 5000,
Alert.alert('','Balance cukup') point: 5000
}
} }
console.log("INI PARAMS : "+ JSON.stringify(params))
Axios.post('http://excelsocrm.ravintoladev.com/crm/v2/point/redeem', params).then(res => {
console.log('sukses')
}).catch(error => {
let response = error.response.data;
Alert.alert(response.msg);
})
}
render() { render() {
return ( return (
...@@ -71,7 +82,7 @@ class UseBalance extends React.Component { ...@@ -71,7 +82,7 @@ class UseBalance extends React.Component {
<TextInput style={{ height: 40, borderWidth: 1, padding: 5, margin: 10, borderRadius: 10, borderColor: 'grey', fontFamily: 'Gotham-Black', textAlign: 'center', color: 'grey', fontWeight: 'bold', fontSize: 20 }} <TextInput style={{ height: 40, borderWidth: 1, padding: 5, margin: 10, borderRadius: 10, borderColor: 'grey', fontFamily: 'Gotham-Black', textAlign: 'center', color: 'grey', fontWeight: 'bold', fontSize: 20 }}
onChangeText={(current_balance) => this.setState({ current_balance })} onChangeText={(current_balance) => this.setState({ current_balance })}
keyboardType='email-address'>IDR. {this.state.current_balance}</TextInput> keyboardType='email-address'>IDR. {this.state.current_balance}</TextInput>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>Redeem</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>Point</Text>
<TextInput style={{ height: 40, borderWidth: 1, padding: 5, margin: 10, borderRadius: 10, borderColor: 'grey', fontFamily: 'Gotham-Black', textAlign: 'center', color: 'grey', fontWeight: 'bold', fontSize: 20 }} <TextInput style={{ height: 40, borderWidth: 1, padding: 5, margin: 10, borderRadius: 10, borderColor: 'grey', fontFamily: 'Gotham-Black', textAlign: 'center', color: 'grey', fontWeight: 'bold', fontSize: 20 }}
onChangeText={(redeem) => this.setState({ redeem })} onChangeText={(redeem) => this.setState({ redeem })}
autoCapitalize="none" autoCapitalize="none"
......
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