Commit 501fb054 authored by Afid's avatar Afid

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

# Conflicts:
#	view/Account.js
#	view/ShoppingCart.js
parents 6ea744fa fbb969aa
......@@ -31,8 +31,8 @@ import * as Device from 'expo-device';
my_long: longitude
})
console.log("MY LAT : " + this.state.my_lat)
console.log("MY LONG : " + this.state.my_long)
// console.log("MY LAT : " + this.state.my_lat)
// console.log("MY LONG : " + this.state.my_long)
this.getOutlet()
}
......
......@@ -7,6 +7,6 @@ export async function setLogin(email, password) {
await AsyncStorage.setItem('PASSWORD',password)
} catch (error) {
console.log('Gagal Set Login : ' + error)
// console.log('Gagal Set Login : ' + error)
}
}
......@@ -6,12 +6,12 @@ import ActionType from '../redux/globalActionType';
async function registerForPushNotificationsAsync() {
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (status !== 'granted') {
console.log('No permission');
// console.log('No permission');
return;
}
let fb_token = await Notifications.getExpoPushTokenAsync();
console.log(fb_token);
// console.log(fb_token);
let SetPushNotif = {
fb_token: fb_token
......
......@@ -34,20 +34,21 @@ class Account extends React.Component {
account_number: "",
expire_date: "",
premium: "",
my_lat:0,
my_long:0
my_lat: 0,
my_long: 0
}
}
componentDidMount() {
this._getProfile()
this._unsubscribe = this.props.navigation.addListener('focus', () => {
this._getProfile()
});
}
componentWillUnmount() {
this._unsubscribe();
this._unsubscribe();
}
_getPermissions = async () => {
......@@ -55,7 +56,7 @@ class Account extends React.Component {
if (status !== 'granted') {
Alert.alert('Akses tidak dizinkan!')
} else if (Platform.OS === 'android' && !Device.isDevice) {
Alert.alert('Silahkan anda coba di real Device')
} else {
this._getCurrentPosisition()
......@@ -68,15 +69,15 @@ class Account extends React.Component {
let location = await Location.getCurrentPositionAsync({
accuracy: Location.Accuracy.Highest
})
let latitude = location.coords.latitude;
let longitude = location.coords.longitude;
this.setState({
my_lat: latitude,
my_long: longitude
})
this._getProfile()
}
......@@ -86,7 +87,7 @@ class Account extends React.Component {
session_id: ''
}
this.props.setConfig(configProps);
// console.log(this.props.navigation.replace('Login'));
this.props.navigation.replace('Login');
}
_getProfile() {
......@@ -297,17 +298,17 @@ class Account extends React.Component {
</View>
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'center', top: 10 }}>
{this.state.premium === false ? (
<TouchableOpacity onPress={() => this.props.navigation.navigate('Upgrade Premium')} style={{ marginBottom: 20, marginRight: 5, marginLeft: 5 }}>
<Card style={{ height: 100, width: 160 }}>
<View style={{ height: 50, alignItems: 'center' }}>
<MaterialIcons name="autorenew" size={30} color="gray" style={{ top: 20 }} />
<Text style={{ textAlign: 'center', top: 30, fontSize: 14 }}>UPGRADE PREMIUM</Text>
</View>
</Card>
</TouchableOpacity>
):(
null
)}
<TouchableOpacity onPress={() => this.props.navigation.navigate('Upgrade Premium')} style={{ marginBottom: 20, marginRight: 5, marginLeft: 5 }}>
<Card style={{ height: 100, width: 160 }}>
<View style={{ height: 50, alignItems: 'center' }}>
<MaterialIcons name="autorenew" size={30} color="gray" style={{ top: 20 }} />
<Text style={{ textAlign: 'center', top: 30, fontSize: 14 }}>UPGRADE PREMIUM</Text>
</View>
</Card>
</TouchableOpacity>
) : (
null
)}
<TouchableOpacity onPress={() => this.props.navigation.navigate('Profile')} style={{ marginBottom: 10 }}>
<Card style={{ height: 100, width: 160 }}>
<View style={{ height: 50, alignItems: 'center' }}>
......
......@@ -43,14 +43,14 @@ import ActionType from '../redux/globalActionType';
}
capture(){
console.log('IS SELFIE : ' + this.props.selfie)
console.log('IS IDCARD : ' + this.props.idcard)
// console.log('IS SELFIE : ' + this.props.selfie)
// console.log('IS IDCARD : ' + this.props.idcard)
if (this.props.selfie === true) {
this.takePictureSelfie()
console.log('ini foto selfie');
// console.log('ini foto selfie');
} else {
this.takePictureIdCard()
console.log('ini foto ktp');
// console.log('ini foto ktp');
}
}
......@@ -66,7 +66,7 @@ import ActionType from '../redux/globalActionType';
}
this.props.setUriSelfi(UriProps);
this.props.navigation.navigate("Upgrade Premium")
console.log(photo);
// console.log(photo);
// console.log("ini sudah di pencet" + photo_img)
}
}
......
......@@ -21,7 +21,7 @@ class ChangeEmail extends React.Component {
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/auth/register_change_email', paramater).then(res => {
console.log(res);
// console.log(res);
let loginProps = {
email: this.state.email
......
......@@ -4,7 +4,7 @@ import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler';
import { connect } from 'react-redux';
import Axios from 'axios';
import ActionType from '../redux/globalActionType';
import ravLog from '../helper/debug';
// import ravLog from '../helper/debug';
class DeliveryAddrees extends React.Component {
constructor(props) {
......
......@@ -18,20 +18,20 @@ class EmailConfirmation extends React.Component {
}
componentDidMount(){
console.log("SESSION " + this.props.session_id)
// console.log("SESSION " + this.props.session_id)
}
handleSubmit() {
this.setState({
spinner: true,
})
console.log(this.props.isEmailverif)
// console.log(this.props.isEmailverif)
if (this.props.isEmailverif === true) {
let pageProps = {
pageEmailConfirmation:false
}
this.props.setPage(pageProps)
console.log('hai ini gue kalau ada device yang sama!')
// console.log('hai ini gue kalau ada device yang sama!')
let params = {
"session_id":this.props.session_id,
......@@ -45,7 +45,7 @@ class EmailConfirmation extends React.Component {
"verification_code": this.state.confirmation_number
}
Axios.post(BASE_URL_LOGIN, params).then(res => {
console.log('EMAIL CONFIRM : ' + JSON.stringify(res))
// console.log('EMAIL CONFIRM : ' + JSON.stringify(res))
let emailConfirmProps = {
isEmailverif:false
}
......@@ -55,7 +55,7 @@ class EmailConfirmation extends React.Component {
session_id: res.data.session_id
}
console.log('LOGIN PROPS : ' + JSON.stringify(loginProps))
// console.log('LOGIN PROPS : ' + JSON.stringify(loginProps))
this.props.setLoginInfo(loginProps)
this.props.setEmailConfirm(emailConfirmProps)
......@@ -145,7 +145,7 @@ class EmailConfirmation extends React.Component {
}).catch(error => {
let response = error.response.data;
console.log(response);
// console.log(response);
this.setState({
spinner: false,
})
......@@ -198,7 +198,7 @@ const styles = StyleSheet.create({
})
const mapStateToProps = (state) => {
console.log('EMAIL CONFIRM : ' + JSON.stringify(state))
// console.log('EMAIL CONFIRM : ' + JSON.stringify(state))
return {
isEmailverif: state.isEmailverif,
email: state.email,
......
......@@ -34,6 +34,9 @@ class Home extends React.Component {
this._renderCarousell()
this._account();
this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({
indicator:true,
})
this._getPermissions()
this._renderCarousell()
this._account();
......@@ -151,7 +154,11 @@ class Home extends React.Component {
_orderNow = () => {
if (this.props.outlet_id != '' && this.props.name_outlet != '') {
this.props.setTypePickup(true)
this.props.navigation.navigate("Menu Select")
this.props.navigation.navigate('Home', {
screen: 'MENU',
params: { user: 'jaxi' },
});
} else {
Alert.alert('Belum dapat outlet terdekat')
}
......
......@@ -30,7 +30,7 @@ class Login extends React.Component {
}
componentDidMount(){
console.log(this.props.language)
// console.log(this.props.language)
}
async handleLoggin() {
......@@ -61,7 +61,7 @@ class Login extends React.Component {
fb_token: fb_token,
os_version: os_version,
}
console.log(deviceInfoProps);
// console.log(deviceInfoProps);
this.props.setDeviceInfo(deviceInfoProps)
}
......@@ -116,7 +116,7 @@ class Login extends React.Component {
"os_version": this.state.os_version,
"app_version": this.state.app_version,
}
console.log(params)
// console.log(params)
Axios.post(BASE_URL_LOGIN, params).then(res => {
const navigation = this.props.navigation
......
......@@ -20,13 +20,13 @@ class MenuConfirmation extends React.Component {
}
componentDidMount(){
console.log(" DESTINASI : "+ this.props.grabdestination)
console.log("ONGKIR"+ this.props.grabamount)
console.log("drop off"+this.props.grabdropoff)
console.log("pickup"+this.props.grabpickup)
console.log("type" +this.props.grabtype)
console.log("BALANCED" +this.props.balanceUsed)
console.log("POINT" +this.props.pointsused)
// console.log(" DESTINASI : "+ this.props.grabdestination)
// console.log("ONGKIR"+ this.props.grabamount)
// console.log("drop off"+this.props.grabdropoff)
// console.log("pickup"+this.props.grabpickup)
// console.log("type" +this.props.grabtype)
// console.log("BALANCED" +this.props.balanceUsed)
// console.log("POINT" +this.props.pointsused)
}
......@@ -83,9 +83,10 @@ class MenuConfirmation extends React.Component {
orderSuccess = () => {
this.props.setOrderFinish()
this.props.navigation.reset({
routes: [{ name: 'Home' }]
})
this.props.navigation.navigate('Home', {
screen: 'ORDER',
params: { user: 'jax' },
});
}
......
......@@ -23,8 +23,10 @@ class MenuSelection extends React.Component {
}
}
componentDidMount() {
if (this.props.outlet_id != '') {
this.getMenuList()
} else {
Alert.alert('Device belum mendapatkan lokasi anda')
......@@ -32,6 +34,9 @@ class MenuSelection extends React.Component {
// console.log("INI OUTLET : "+ this.props.outlet_id)
this._unsubscribe = this.props.navigation.addListener('focus', () => {
if (this.props.outlet_id != '') {
this.setState({
indicator:true
})
this.getMenuList()
} else {
Alert.alert('Device belum mendapatkan lokasi anda')
......@@ -203,7 +208,7 @@ class MenuSelection extends React.Component {
</View>
<View style={{ flex: 3 }}>
{this.state.indicator == true ? (
<ActivityIndicator style={{top:10}} size="large" color="#c9af6d" />
<ActivityIndicator style={{ top: 10 }} size="large" color="#c9af6d" />
) : (
<FlatList
......@@ -220,10 +225,17 @@ class MenuSelection extends React.Component {
)}
</View>
<View style={styles.shadow}>
<View style={{ flexDirection: 'row', }}>
<Text style={{ fontSize: 12, margin: 10 }}> Price Estimation / Item {this.props.order_quantity} </Text>
<Text style={{ fontSize: 20, margin: 10, marginBottom: 10 }}> Rp. {this.props.order_total}</Text>
</View>
{
this.state.indicator == true ? (<ActivityIndicator style={{ top: 10 }} size="large" color="#c9af6d" />):(
<View style={{ flexDirection: 'row', }}>
<Text style={{ fontSize: 12, margin: 10 }}> Price Estimation / Item {this.props.order_quantity} </Text>
<Text style={{ fontSize: 20, margin: 10, marginBottom: 10 }}> Rp. {this.props.order_total}</Text>
</View>
)
}
<View>
<Button title="VIEW CART" onPress={() => this.props.navigation.navigate('Shopping Cart')}></Button>
</View>
......
......@@ -18,7 +18,7 @@ class NewPassword extends React.Component {
}
componentDidMount(){
console.log(this.props)
// console.log(this.props)
}
validation(){
......@@ -50,7 +50,7 @@ class NewPassword extends React.Component {
'password': this.state.password,
'password_confirmation': this.state.password_confirmation
}
console.log(params);
// console.log(params);
Axios.post(BASE_URL_NEW_PASSWORD,params).then(res => {
this.setState({
spinner: false,
......
......@@ -174,9 +174,9 @@ class NewRegister extends React.Component {
// "domicile": this.state.domicilie,
}
console.log(parameter);
// console.log(parameter);
Axios.post(BASE_URL_REGISTER, parameter).then(res => {
console.log(res);
// console.log(res);
let registerProps = {
email: this.state.email,
full_name: this.state.full_name,
......@@ -215,7 +215,7 @@ class NewRegister extends React.Component {
this.setState({
spinner: false,
})
console.log(JSON.stringify(error.response));
// console.log(JSON.stringify(error.response));
let response = error.response.data;
Alert.alert(
'',
......
......@@ -31,9 +31,9 @@ class OrderDetail extends React.Component {
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/detail', params).then(res => {
let data = res.data
console.log("INI OUTLET "+ data.outlet)
console.log("OUTLET-CODE" + data.outlet_code)
console.log("TRANS-DISPLAY" + data.trans_type_display)
// 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,
......
import React from 'react';
import { View, Text, TextInput, StyleSheet, ScrollView, Alert, TouchableOpacity } from 'react-native';
import { View, Text, TextInput, StyleSheet, ScrollView, Alert, TouchableOpacity,ActivityIndicator } from 'react-native';
import { Card } from 'react-native-shadow-cards'
import { connect } from 'react-redux';
import Axios from 'axios';
......@@ -9,16 +9,31 @@ class OrderHistory extends React.Component {
constructor(props) {
super(props)
this.state = {
order_list: []
order_list: [],
indicator: true
}
}
componentDidMount() {
this.getOrderHistory()
this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({
indicator:true,
})
this.getOrderHistory()
});
}
componentWillUnmount() {
this._unsubscribe();
}
// componentDidMount() {
// this.getOrderHistory()
// }
getOrderHistory() {
let params = {
......@@ -26,13 +41,17 @@ class OrderHistory extends React.Component {
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/list', params).then(res => {
let data = res.data.data
console.log(data)
// console.log(data)
this.setState({
order_list: data
order_list: data,
indicator: false,
})
}).catch(error => {
let response = error.response.data;
Alert.alert(response.msg);
this.setState({
indicator: false,
})
})
}
......@@ -41,18 +60,18 @@ class OrderHistory extends React.Component {
return (
<View style={styles.container}>
<ScrollView style={styles.body}>
{
{this.state.indicator == true ? (<ActivityIndicator style={{ justifyContent: "center" }} size="large" color="#c9af6d" />) :
this.state.order_list.map((item, key) => (
<TouchableOpacity key={key} onPress={() => this.props.navigation.navigate('Order Detail', {idTrans:item.id})}>
<View key={key}>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text>OUTLET : {item.outlet}</Text>
<Text>TGL TRANSAKSI : {item.trans_date}</Text>
<Text>TOTAL : {item.trans_total}</Text>
<Text>STATUS : {item.trans_status_display}</Text>
</Card>
</View>
<TouchableOpacity key={key} onPress={() => this.props.navigation.navigate('Order Detail', { idTrans: item.id })}>
<View key={key}>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text>OUTLET : {item.outlet}</Text>
<Text>TGL TRANSAKSI : {item.trans_date}</Text>
<Text>TOTAL : {item.trans_total}</Text>
<Text>STATUS : {item.trans_status_display}</Text>
</Card>
</View>
</TouchableOpacity>
))
}
......
......@@ -83,7 +83,11 @@ class PickupName extends React.Component {
if (this.props.route.params.from == 'shoppingCart') {
this.props.navigation.navigate('Shopping Cart', {outlet_change: true, outlet_id: id})
} else {
this.props.navigation.navigate("Menu Select")
this.props.navigation.navigate('Home', {
screen: 'MENU',
params: { user: 'jane' },
})
}
}
......
......@@ -50,8 +50,8 @@ export default class Register extends React.Component {
list_domicilie: list_domicilie,
})
console.log(this.state.list_gender);
console.log(this.state.list_domicilie);
// console.log(this.state.list_gender);
// console.log(this.state.list_domicilie);
})
}
......@@ -71,7 +71,7 @@ export default class Register extends React.Component {
"domicile": this.state.domicilie,
}
console.log(parameter);
// console.log(parameter);
Axios.post(BASE_URL_REGISTER, parameter).then(res => {
console.log('sukses');
}).catch(error => {
......
......@@ -24,14 +24,14 @@ class Renewal extends React.Component {
let params = {
session_id: this.props.session_id
}
console.log(params);
// console.log(params);
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/card/renewal', params).then(res => {
// console.log('ini res ' + JSON.stringify(res.data))
this._getProfile();
Alert.alert('Renewal Berhasil');
}).catch(error => {
let response = error.response.data;
console.log(response.msg)
// console.log(response.msg)
Alert.alert(response.msg);
})
}
......@@ -42,7 +42,7 @@ class Renewal extends React.Component {
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
console.log('ini res ' + JSON.stringify(res.data))
// console.log('ini res ' + JSON.stringify(res.data))
const dataCard = res.data
let balance = dataCard.kaspro_balance
......@@ -65,7 +65,7 @@ class Renewal extends React.Component {
}).catch(error => {
console.log('ini error ' + error)
// console.log('ini error ' + error)
})
}
......
......@@ -44,7 +44,6 @@ class ShoppingCart extends React.Component {
if (!this.props.type_pickup) {
this.getRate()
}
this.getBalance()
this._unsubscribe = this.props.navigation.addListener('focus', () => {
......@@ -79,7 +78,7 @@ class ShoppingCart extends React.Component {
checkChangeTrans(val) {
if (val == 'delivery') {
// let typeProps = {
// type_pickup: false,
// type_pickup: false,
// }
// this.props.setTypePickup(typeProps);
this.setState({
......@@ -89,10 +88,10 @@ class ShoppingCart extends React.Component {
pointsused: 0,
balanceused: 0
})
this.props.navigation.navigate("Delivery Address", {from : 'shoppingCart'})
this.props.navigation.navigate("Delivery Address", { from: 'shoppingCart' })
} else {
// let typeProps = {
// type_pickup: true,
// type_pickup: true,
// }
// this.props.setTypePickup(typeProps);
this.setState({
......@@ -102,7 +101,7 @@ class ShoppingCart extends React.Component {
pointsused: 0,
balanceused: 0
})
this.props.navigation.navigate('Pickup Name', {from : 'shoppingCart'})
this.props.navigation.navigate('Pickup Name', { from: 'shoppingCart' })
}
}
......@@ -134,6 +133,7 @@ class ShoppingCart extends React.Component {
}
if (quantity == 0) {
Alert.alert("Apakah anda ingin menghapus pesanan?");
const order_item = {
id: item.id,
name: item.name,
......@@ -147,8 +147,6 @@ class ShoppingCart extends React.Component {
this.props.removeFromChart(order_item)
}
}
}
}
......@@ -273,9 +271,6 @@ class ShoppingCart extends React.Component {
this.props.setGrab(setGrabProps);
// console.log("INI SUKSES RESPONNYA ")
// console.log('Delivery Amount Cart : ' + res.data.data.amount)
let OutletChange = {
outlet_id: res.data.data.outlet_id,
name_outlet: res.data.data.outlet_name,
......@@ -290,7 +285,7 @@ class ShoppingCart extends React.Component {
this.props.setOrder(setOrdersProps);
}).catch(error => {
console.log('ini error ' + error)
// console.log('ini error ' + error)
})
}
......@@ -317,7 +312,7 @@ class ShoppingCart extends React.Component {
// console.log(this.state.kasproBalance, this.state.kasproPoint)
}).catch(error => {
console.log('ini error ' + error)
// console.log('ini error ' + error)
})
}
......@@ -336,15 +331,15 @@ class ShoppingCart extends React.Component {
{
this.props.type_pickup == true ? (
<Card style={{ margin: 5, padding: 10 }}>
<Text style={{ textAlign: 'center' }}> Ambil pesanan kamu di</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontWeight: 'bold' }}>Excelso {this.props.name_outlet}</Text>
</Card>
) : (
<Card style={{ margin: 5, padding: 10 }}>
<Text style={{ textAlign: 'center' }}> Ambil pesanan kamu di</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontWeight: 'bold' }}>Excelso {this.props.name_outlet}</Text>
<Text style={{ textAlign: 'center' }}> Pesanan kamu dikirim ke</Text>
<Text style={{ textAlign: 'center' }}>{this.props.address}</Text>
</Card>
) : (
<Card style={{ margin: 5, padding: 10 }}>
<Text style={{ textAlign: 'center' }}> Pesanan kamu dikirim ke</Text>
<Text style={{ textAlign: 'center' }}>{this.props.address}</Text>
</Card>
)
}
</View>
......@@ -575,14 +570,20 @@ class ShoppingCart extends React.Component {
</View>
)}
</View>
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'space-between' }}>
<View>
<Text style={{ paddingLeft: 20, paddingTop: 10, color: 'gray' }}>Tujuan</Text>
</View>
<View style={{ paddingRight: 30, paddingTop: 10, alignItems: 'flex-end' }}>
<Text style={{ color: '#ccb46c' }}>{this.props.address}</Text>
</View>
</View>
{this.props.type_pickup == true ? (
null
) : (
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'space-between' }}>
<View>
<Text style={{ paddingLeft: 20, paddingTop: 10, color: 'gray' }}>Tujuan</Text>
</View>
<View style={{ paddingRight: 30, paddingTop: 10, alignItems: 'flex-end' }}>
<Text style={{ color: '#ccb46c' }}>{this.props.address}</Text>
</View>
</View>
)}
<View style={{ margin: 20, }}>
<Button title='Checkout' color='#ccb46c' onPress={() => this.checkOut()} />
</View>
......@@ -809,5 +810,4 @@ const mapStateToProps = (state) => {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(ShoppingCart)
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