Commit d8cd2f32 authored by Trisno's avatar Trisno

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

# Conflicts:
#	view/OrderDetail.js
parents 07124f10 7b1339f6
This diff is collapsed.
...@@ -53,6 +53,7 @@ import RewardHistory from './RewardHistory'; ...@@ -53,6 +53,7 @@ import RewardHistory from './RewardHistory';
import WelcomeReg from './WelcomeReg'; import WelcomeReg from './WelcomeReg';
import WelcomeLog from './WelcomeLog'; import WelcomeLog from './WelcomeLog';
import RatingOrder from './RatingOrder'; import RatingOrder from './RatingOrder';
import UseBalance from './UseBalance';
enableScreens(); enableScreens();
...@@ -435,6 +436,21 @@ class Auth extends React.Component { ...@@ -435,6 +436,21 @@ class Auth extends React.Component {
}, title: 'RATING ORDER' }, title: 'RATING ORDER'
}} }}
/> />
<Stack.Screen name="UseBalance" component={UseBalance}
options={{
headerStyle: { backgroundColor: '#CFB368' },
headerTitleContainerStyle: { alignContent: 'center' },
headerTitleAlign: 'center',
headerTintColor: '#fff',
headerTitleStyle: {
alignSelf: 'center',
fontFamily: 'Gotham-Black',
fontSize: 20,
color: 'white',
textAlign: 'center'
}, title: 'USE BALANCE'
}}
/>
</> </>
) )
......
...@@ -206,6 +206,9 @@ class Home extends React.Component { ...@@ -206,6 +206,9 @@ class Home extends React.Component {
} }
render() { render() {
// console.log(this.state.images) // console.log(this.state.images)
return ( return (
...@@ -384,9 +387,9 @@ class Home extends React.Component { ...@@ -384,9 +387,9 @@ class Home extends React.Component {
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 16 }}>TOP BALANCE </Text> <Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 16 }}>TOP BALANCE </Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
// style={styles.submitUpgradePemium} // style={styles.submitUpgradePemium}
activeOpacity={.5}> activeOpacity={.5} onPress={() => this.props.navigation.navigate('UseBalance')}>
<View style={styles.topUseBalance}> <View style={styles.topUseBalance}>
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 16 }}>USE BALANCE </Text> <Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 16 }}>USE BALANCE </Text>
</View> </View>
......
...@@ -118,18 +118,40 @@ class OrderDetail extends React.Component { ...@@ -118,18 +118,40 @@ class OrderDetail extends React.Component {
}) })
}).catch(error => { }).catch(error => {
const { navigation } = this.props let response = error.response.data;
let response = error.response.data Alert.alert(error ,response.msg);
session(response, navigation)
Alert.alert(response.msg);
this.setState({ this.setState({
indicator: false, indicator: false,
}) })
// let response = error.response.data;
// Alert.alert(response.msg); // Alert.alert(response.msg);
}) })
} }
rating(){
let paramater = {
session_id: this.props.session_id,
transaction_id: this.props.route.params.idTrans,
rating: this.state.rating,
review: this.state.review,
lat: this.props.lat,
long: this.props.long
}
console.log("INI PARAMS"+ JSON.stringify(paramater) );
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/review/transaction', paramater).then(res => {
Alert.alert('','Terimakasih Atas masukan anda!')
this.props.navigation.navigate('Home');
}).catch(error => {
console.log ("INI error " + error)
let response = error.response.data;
Alert.alert(error,response.msg);
})
}
render() { render() {
// console.log(this.state.detail_trans) // console.log(this.state.detail_trans)
// console.log(this.state.detail_trans.used_reward) // console.log(this.state.detail_trans.used_reward)
...@@ -350,47 +372,23 @@ class OrderDetail extends React.Component { ...@@ -350,47 +372,23 @@ class OrderDetail extends React.Component {
{ {
this.state.trans_status == 4 ? ( this.state.trans_status == 4 ? (
<TouchableOpacity style={{ justifyContent: 'center' }} onPress={() => this.props.navigation.navigate('RatingOrder', { idTrans: this.state.detail_trans.id })}> null
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', justifyContent: 'center', marginRight: 20, marginLeft: 20, marginTop: 50 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center', paddingHorizontal: 5 }}>Rating Order</Text>
</View>
</TouchableOpacity>
) : ( ) : (
null <TouchableOpacity style={{ justifyContent: 'center' }} onPress={() => this.props.navigation.navigate('RatingOrder', { idTrans: this.state.detail_trans.id })}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', justifyContent: 'center', marginRight: 20, marginLeft: 20, marginTop: 50 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center', paddingHorizontal: 5 }}>Rating Order</Text>
</View>
</TouchableOpacity>
) )
} }
<View style={{ marginVertical: 20 }} /> <View style={{ marginVertical: 20 }} />
{/* <TouchableOpacity style={{ justifyContent: 'center' }} onPress={() =>this.rating()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', justifyContent: 'center', marginRight: 20, marginLeft: 20, marginTop: 50 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center', paddingHorizontal: 5 }}>Rating Order</Text>
</View>
{/* <View> </TouchableOpacity> */}
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text>OUTLET : {this.state.outlet}</Text>
<Text>OUTLET CODE : {this.state.outlet_code}</Text>
<Text>OUTLET : {this.state.trans_status_display}</Text>
</Card>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
{
this.state.transaction_detail.map((item, index) => {
return (
<View key={index}>
<Text>NAMA ITEM : {item.item_name}</Text>
<Text>QTY : {item.item_quantity}</Text>
<Text>PRICE : {item.item_price}</Text>
<Text>DISCOUNT : {item.item_discount}</Text>
<View style={{ borderWidth: 1, margin: 10 }}></View>
<Text>TOTAL : {item.item_subtotal}</Text>
</View>
)
})
}
</Card>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text>{}</Text>
</Card>
</View> */}
</ScrollView> </ScrollView>
</View> </View>
) )
...@@ -465,7 +463,9 @@ const mapStateToProps = (state) => { ...@@ -465,7 +463,9 @@ const mapStateToProps = (state) => {
return { return {
session_id: state.session_id, session_id: state.session_id,
trans_id: state.trans_id trans_id: state.trans_id,
lat: state.lat,
long: state.long,
} }
} }
......
...@@ -32,7 +32,7 @@ class Outlets extends React.Component { ...@@ -32,7 +32,7 @@ class Outlets extends React.Component {
data_outlet: [], data_outlet: [],
outlet_selected: '', outlet_selected: '',
data_name: '', data_name: '',
indicator:true indicator: true
} }
} }
...@@ -114,7 +114,7 @@ class Outlets extends React.Component { ...@@ -114,7 +114,7 @@ class Outlets extends React.Component {
this.setState({ this.setState({
dataOutlets: dataOutlets, dataOutlets: dataOutlets,
data_before_search: dataOutlets, data_before_search: dataOutlets,
}) })
this.setState({ this.setState({
...@@ -125,7 +125,7 @@ class Outlets extends React.Component { ...@@ -125,7 +125,7 @@ class Outlets extends React.Component {
let response = error.response.data; let response = error.response.data;
Alert.alert(response.msg); Alert.alert(response.msg);
this.setState({ this.setState({
indicator: false indicator: false
}) })
}) })
} }
...@@ -216,7 +216,13 @@ class Outlets extends React.Component { ...@@ -216,7 +216,13 @@ class Outlets extends React.Component {
dataOutlets: this.state.data_before_search, dataOutlets: this.state.data_before_search,
search: '' search: ''
}) })
} else { } else if (value == null) {
this.setState({
dataOutlets: this.state.data_before_search,
search: ''
})
}
else {
this.setState({ this.setState({
dataOutlets: filteredOutlets, dataOutlets: filteredOutlets,
search: value search: value
...@@ -228,8 +234,8 @@ class Outlets extends React.Component { ...@@ -228,8 +234,8 @@ class Outlets extends React.Component {
RenderItem = ({ item }) => { RenderItem = ({ item }) => {
return ( return (
<View style={{ flexDirection: 'row', flex: 1,marginRight:20,marginLeft:20,marginBottom:20}}> <View style={{ flexDirection: 'row', flex: 1, marginRight: 20, marginLeft: 20, marginBottom: 20 }}>
<View style={styles.content_list}> <View style={styles.content_list}>
<View style={styles.list_addrees}> <View style={styles.list_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#ccb46c', fontSize: 18 }}>{item.name}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#ccb46c', fontSize: 18 }}>{item.name}</Text>
<Text style={{ flexWrap: 'wrap', fontFamily: 'Gotham-Light', color: '#b1b1b2' }}>{item.full_address}</Text> <Text style={{ flexWrap: 'wrap', fontFamily: 'Gotham-Light', color: '#b1b1b2' }}>{item.full_address}</Text>
...@@ -238,7 +244,7 @@ class Outlets extends React.Component { ...@@ -238,7 +244,7 @@ class Outlets extends React.Component {
</Text> </Text>
</View> </View>
<View style={{ flex: 2, flexDirection: 'row' }}> <View style={{ flex: 2, flexDirection: 'row' }}>
<View style={{margin:5}}> <View style={{ margin: 5 }}>
<TouchableOpacity onPress={() => { Linking.openURL('tel:' + item.phone) }}> <TouchableOpacity onPress={() => { Linking.openURL('tel:' + item.phone) }}>
<Icon <Icon
name='ios-call' name='ios-call'
...@@ -248,7 +254,7 @@ class Outlets extends React.Component { ...@@ -248,7 +254,7 @@ class Outlets extends React.Component {
/> />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={{margin:5}}> <View style={{ margin: 5 }}>
<TouchableOpacity onPress={() => Linking.openURL('https://www.google.com/maps/dir/?api=1&destination=' + item.lat + ' ' + item.long)}> <TouchableOpacity onPress={() => Linking.openURL('https://www.google.com/maps/dir/?api=1&destination=' + item.lat + ' ' + item.long)}>
<Icon <Icon
name='ios-navigate' name='ios-navigate'
...@@ -260,7 +266,7 @@ class Outlets extends React.Component { ...@@ -260,7 +266,7 @@ class Outlets extends React.Component {
</View> </View>
</View> </View>
</View> </View>
</View> </View>
); );
} }
...@@ -274,7 +280,7 @@ class Outlets extends React.Component { ...@@ -274,7 +280,7 @@ class Outlets extends React.Component {
textStyle={styles.spinnerTextStyle} textStyle={styles.spinnerTextStyle}
/> */} /> */}
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<MapView style={{ flex: 1 ,marginRight:10,marginLeft:10}} <MapView style={{ flex: 1, marginRight: 10, marginLeft: 10 }}
region={{ region={{
latitude: this.state.my_lat, latitude: this.state.my_lat,
longitude: this.state.my_long, longitude: this.state.my_long,
...@@ -297,37 +303,31 @@ class Outlets extends React.Component { ...@@ -297,37 +303,31 @@ class Outlets extends React.Component {
</MapView> </MapView>
</View> </View>
<View style={{height:50,flexDirection:'row'}}> <View style={{ height: 50, flexDirection: 'row' }}>
<View style={{ flex: 1 }}></View> <View style={{ flex: 1 }}></View>
<View style={{flex:1}}> <View style={{ flex: 1 }}>
<RNPickerSelect <RNPickerSelect
placeholder={{ label: 'Select Area', value: null}} placeholder={{ label: 'All city' }}
onValueChange={(label) => this.filterData(label)} onValueChange={(label) => this.filterData(label)}
items={this.state.data_outlet} items={this.state.data_outlet}
/> />
</View>
</View>
{/* <View style={{ height:50, flex: 1, flexDirection: 'row' }}>
<View style={{flex:1}}>
</View> </View>
</View> */} </View>
<View style={styles.body}> <View style={styles.body}>
{this.state.indicator == true ? ( {this.state.dataOutlets.length > 0 ? (
<ActivityIndicator size="large" color="#c9af6d" style={{margin:20}} /> <FlatList
) : ( data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])}
<FlatList renderItem={this.RenderItem}
data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])} keyExtractor={item => item.id}
renderItem={this.RenderItem} windowSize={5}
keyExtractor={item => item.id} initialNumToRender={18}
windowSize={5} maxToRenderPerBatch={2}
initialNumToRender={18} onEndReachedThreshold={0.5}
maxToRenderPerBatch={2} />
onEndReachedThreshold={0.5} ) : (
/> <Text style={{ flexWrap: 'wrap', fontFamily: 'Gotham-Light', color: '#b1b1b2', textAlign:'center' }}> Tidak Ada Outlets di area anda !</Text>
)} )}
</View> </View>
</View> </View>
) )
...@@ -358,9 +358,9 @@ const styles = StyleSheet.create({ ...@@ -358,9 +358,9 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
margin: 10, margin: 10,
}, },
content_list:{ content_list: {
flex:1, flex: 1,
flexDirection:'row', flexDirection: 'row',
} }
}) })
......
...@@ -110,22 +110,22 @@ class ProfilePage extends PureComponent { ...@@ -110,22 +110,22 @@ class ProfilePage extends PureComponent {
<View style={{ flex: 3 }}> <View style={{ flex: 3 }}>
<View style={{ flex: 1, margin: 20,top:10}}> <View style={{ flex: 1, margin: 20,top:10}}>
<View style={{top:20}}> <View style={{top:20}}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 18, textAlign: 'center' }}>Email</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 18, textAlign: 'center',margin:3 }}>Email</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 14, textAlign: 'center'}}>{this.state.email}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 14, textAlign: 'center'}}>{this.state.email}</Text>
</View> </View>
<View style={{top:30}}> <View style={{top:30}}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 18, textAlign: 'center' }}>Phone</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 18, textAlign: 'center',margin:3 }}>Phone</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 14, textAlign: 'center'}}>{this.state.mobile_phone}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 14, textAlign: 'center'}}>{this.state.mobile_phone}</Text>
</View> </View>
<View style={{top:40}}> <View style={{top:40}}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 18, textAlign: 'center'}}>Date of Birth</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 18, textAlign: 'center',margin:3}}>Date of Birth</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 14, textAlign: 'center'}}>{this.state.dob_day} / {this.state.dob_month} / {this.state.dob_year}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 14, textAlign: 'center'}}>{this.state.dob_day} / {this.state.dob_month} / {this.state.dob_year}</Text>
</View> </View>
<View style={{top:50,marginBottom:50}}> <View style={{top:50,marginBottom:50}}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 18, textAlign: 'center' }}>Gender</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 18, textAlign: 'center',margin:3 }}>Gender</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 14, textAlign: 'center'}}>{this.state.gender}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 14, textAlign: 'center'}}>{this.state.gender}</Text>
</View> </View>
......
import React from 'react';
import { View, Text, TextInput, StyleSheet, Button, Alert, TouchableOpacity, Image } from 'react-native';
import { connect } from 'react-redux';
import Axios from 'axios';
import ActionType from '../redux/globalActionType';
import Spinner from 'react-native-loading-spinner-overlay';
class UseBalance extends React.Component {
constructor(props) {
super(props);
this.state = {
current_balance: '',
redeem:'',
}
}
componentDidMount(){
this._getProfile()
}
_getProfile() {
let params = {
session_id: this.props.session_id
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
console.log('ini res ' + JSON.stringify(res.data))
const dataCard = res.data
let balance = dataCard.kaspro_balance
let expired = dataCard.expire_date
let c_renew_until = dataCard.expire_date
var date_string = c_renew_until
var date_arr = date_string.split('-');
var date = new Date(date_arr[0], date_arr[1], date_arr[2]);
date.setFullYear(date.getFullYear() + 1);
let date_nextyear_string = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate()
this.setState({
current_balance: balance,
expired: expired,
renew_until: date_nextyear_string
})
}).catch(error => {
// console.log('ini error ' + error)
})
}
redeem(){
if (this.state.current_balance > this.state.redeem) {
Alert.alert('','Balance tidak cukup !')
}else{
Alert.alert('','Balance cukup')
}
}
render() {
return (
<View style={styles.container}>
<View style={{ flex: 3 }}>
<View style={{ flex: 1, marginRight: 30, marginLeft: 30, top: 50 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>Current Balance</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 }}
onChangeText={(current_balance) => this.setState({ current_balance })}
keyboardType='email-address'>IDR. {this.state.current_balance}</TextInput>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>Redeem</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 }}
onChangeText={(redeem) => this.setState({ redeem })}
autoCapitalize="none"
keyboardType='numeric'>IDR.</TextInput>
<TouchableOpacity style={{ height: 100 }} onPress={()=> this.redeem()}>
<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 }}>REDEEM</Text>
</View>
</TouchableOpacity>
</View>
</View>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#ffff'
},
header: {
flex: 0.5,
margin: 10,
},
form: {
flex: 3,
top: 40,
margin: 10,
marginTop: 0,
},
field_email: {
flexDirection: 'row'
},
button: {
height: 40,
margin: 10,
},
logo: {
alignSelf: 'flex-start',
marginTop: 50,
width: 290,
height: 290,
bottom: 145,
},
v_logo: {
flex: 2,
flexDirection: 'column-reverse',
alignContent: 'flex-start',
}
})
const mapStateToProps = (state) => {
return {
session_id: state.session_id,
language: state.language,
pageEmailConfirmation: state.pageEmailConfirmation
}
}
export default connect(mapStateToProps)(UseBalance);
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