Commit e443f3d5 authored by Trisno's avatar Trisno
parents 87466357 58fe8ad6
{ {
"expo": { "expo": {
"name": "Excelso_update v1.08.05.2020", "name": "Excelso_update v1.11.05.2020",
"slug": "excelso-pro", "slug": "excelso-pro",
"privacy": "public", "privacy": "public",
"sdkVersion": "36.0.0", "sdkVersion": "36.0.0",
......
This diff is collapsed.
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
"react": "~16.9.0", "react": "~16.9.0",
"react-currency-format": "^1.0.0", "react-currency-format": "^1.0.0",
"react-dom": "~16.9.0", "react-dom": "~16.9.0",
"react-htmltext": "^0.40.2",
"react-material-ui-form-validator": "^2.0.10", "react-material-ui-form-validator": "^2.0.10",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz", "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-check-box": "^2.1.7", "react-native-check-box": "^2.1.7",
...@@ -62,7 +63,7 @@ ...@@ -62,7 +63,7 @@
"react-native-view-pager": "^0.2.3", "react-native-view-pager": "^0.2.3",
"react-native-view-shot": "3.0.2", "react-native-view-shot": "3.0.2",
"react-native-web": "~0.11.7", "react-native-web": "~0.11.7",
"react-native-webview": "^9.0.1", "react-native-webview": "^7.4.3",
"react-navigation": "^4.2.2", "react-navigation": "^4.2.2",
"react-redux": "^7.2.0", "react-redux": "^7.2.0",
"react-redux-i18n": "^1.9.3", "react-redux-i18n": "^1.9.3",
......
...@@ -34,9 +34,10 @@ const ActionType = { ...@@ -34,9 +34,10 @@ const ActionType = {
SET_ORDER_FINISH: 'SET_ORDER_FINISH', SET_ORDER_FINISH: 'SET_ORDER_FINISH',
UPDATE_MENU: 'UPDATE_MENU', UPDATE_MENU: 'UPDATE_MENU',
CHANGE_QUANTITY: 'CHANGE_QUANTITY', CHANGE_QUANTITY: 'CHANGE_QUANTITY',
SET_CORDINAT :'SET_CORDINAT',
SET_TRANS_ID:'SET_TRANS_ID', SET_TRANS_ID:'SET_TRANS_ID',
CHANGE_TO_CHART:'CHANGE_TO_CHART' CHANGE_TO_CHART:'CHANGE_TO_CHART',
SET_VOUCHER:'SET_VOUCHER'
} }
export default ActionType; export default ActionType;
\ No newline at end of file
...@@ -76,7 +76,13 @@ const globalState = { ...@@ -76,7 +76,13 @@ const globalState = {
balanceUsed:'', balanceUsed:'',
pointused:'', pointused:'',
trans_id:'' trans_id:'',
lat:'',
long:'',
voucher :[],
value_voucher:''
} }
...@@ -234,6 +240,14 @@ const rootReducer = (state = globalState, action) => { ...@@ -234,6 +240,14 @@ const rootReducer = (state = globalState, action) => {
selfie: false selfie: false
} }
} }
case ActionType.SET_VOUCHER: {
return {
...state,
voucher: action.data.voucher,
value_voucher: action.data.value_voucher
}
}
case ActionType.SET_CHANGE_IMAGE_SELFI: { case ActionType.SET_CHANGE_IMAGE_SELFI: {
return { return {
...state, ...state,
...@@ -247,6 +261,14 @@ const rootReducer = (state = globalState, action) => { ...@@ -247,6 +261,14 @@ const rootReducer = (state = globalState, action) => {
} }
} }
case ActionType.SET_CORDINAT: {
return {
...state,
lat: action.data.lat,
long: action.data.long
}
}
case ActionType.SET_CHANGE_OUTLET: { case ActionType.SET_CHANGE_OUTLET: {
return { return {
...state, ...state,
......
...@@ -34,6 +34,7 @@ class Home extends React.Component { ...@@ -34,6 +34,7 @@ class Home extends React.Component {
this._account(); this._account();
this._getPermissions() this._getPermissions()
this._renderCarousell() this._renderCarousell()
console.log("INI LAT : " + this.props.lat)
this._unsubscribe = this.props.navigation.addListener('focus', () => { this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({ this.setState({
...@@ -72,11 +73,20 @@ class Home extends React.Component { ...@@ -72,11 +73,20 @@ class Home extends React.Component {
let latitude = location.coords.latitude; let latitude = location.coords.latitude;
let longitude = location.coords.longitude; let longitude = location.coords.longitude;
this.setState({ this.setState({
my_lat: latitude, my_lat: latitude,
my_long: longitude my_long: longitude
}) })
let cordinate = {
lat: this.state.my_lat,
long: this.state.my_long,
}
this.props.setCordinatProps(cordinate);
this._getOutletClosest(); this._getOutletClosest();
} }
...@@ -284,7 +294,7 @@ class Home extends React.Component { ...@@ -284,7 +294,7 @@ class Home extends React.Component {
<TouchableOpacity style={styles.submitUpgradePemium} activeOpacity={.5} onPress={this.onPress}> <TouchableOpacity style={styles.submitUpgradePemium} activeOpacity={.5} onPress={this.onPress}>
<Text style={{ textAlign: 'center', bottom: 5, color: 'white' }}>TOP BALANCE </Text> <Text style={{ textAlign: 'center', bottom: 5, color: 'white' }}>TOP BALANCE </Text>
</TouchableOpacity> </TouchableOpacity>
<Text>8 May 2019 </Text> <Text>11 May 2019 </Text>
<View style={{ height: 60 }}></View> <View style={{ height: 60 }}></View>
</View> </View>
</View> </View>
...@@ -385,6 +395,13 @@ const mapDispatchToProps = (dispacth) => { ...@@ -385,6 +395,13 @@ const mapDispatchToProps = (dispacth) => {
} }
}), }),
setCordinatProps: (cordinate) => dispacth({
type: ActionType.SET_CORDINAT,
data: {
lat: cordinate.lat,
long: cordinate.long,
}
}),
} }
} }
...@@ -407,6 +424,8 @@ const mapStateToProps = (state) => { ...@@ -407,6 +424,8 @@ const mapStateToProps = (state) => {
proses: state.proses, proses: state.proses,
pageEmailConfirmation: state.pageEmailConfirmation, pageEmailConfirmation: state.pageEmailConfirmation,
language: state.language, language: state.language,
lat: state.lat,
long: state.long,
} }
} }
......
...@@ -15,7 +15,7 @@ class Item extends React.Component { ...@@ -15,7 +15,7 @@ class Item extends React.Component {
handleChangeQuantity = (item, qty) => { handleChangeQuantity = (item, qty) => {
if (qty == '') { if (qty == '') {
qty=0 item.qty=0
} else { } else {
const order_item = { const order_item = {
......
...@@ -7,6 +7,8 @@ import Axios from 'axios'; ...@@ -7,6 +7,8 @@ import Axios from 'axios';
import session from '../function/session'; import session from '../function/session';
import HTML from 'react-native-render-html'; import HTML from 'react-native-render-html';
import { WebView } from 'react-native-webview'; import { WebView } from 'react-native-webview';
import ActionType from '../redux/globalActionType';
import moment from 'moment';
class RewardDetail extends React.Component { class RewardDetail extends React.Component {
constructor(props) { constructor(props) {
...@@ -15,8 +17,12 @@ class RewardDetail extends React.Component { ...@@ -15,8 +17,12 @@ class RewardDetail extends React.Component {
image: '', image: '',
title: '', title: '',
subtitle: '', subtitle: '',
deskripsi: "", content: "",
expire: '' expire: '',
code: '',
used: '',
dateNow: '',
value: '',
} }
} }
...@@ -30,41 +36,111 @@ class RewardDetail extends React.Component { ...@@ -30,41 +36,111 @@ class RewardDetail extends React.Component {
session_id: this.props.session_id, session_id: this.props.session_id,
reward_id: this.props.route.params.rewardId reward_id: this.props.route.params.rewardId
} }
console.log(params);
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/reward/get_detail', params).then(res => { Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/reward/get_detail', params).then(res => {
this.setState({ this.setState({
image: res.data.reward.reward.content_image, image: res.data.reward.reward.content_image,
title: res.data.reward.reward.title, title: res.data.reward.reward.title,
subtitle: res.data.reward.reward.subtitle, subtitle: res.data.reward.reward.subtitle,
deskripsi: res.data.reward.reward.content, content: res.data.reward.reward.content,
expire: res.data.reward.expire_time, expire: res.data.reward.expire_time,
code: res.data.reward.verification_number,
used: res.data.reward.used,
value: res.data.reward.reward.value,
}) })
// console.log("INI TITLE : " + JSON.stringify())
// console.log("INI SUBTITILE : " + JSON.stringify())
console.log("INI IMAGE : " + JSON.stringify()) let date = new Date(this.state.expire);
// console.log("INI DESKRIPSI : " + JSON.stringify(res.data.reward.reward.subtitle)) let year = date.getFullYear();
let month = date.getMonth() + 1;
let dt = date.getDate();
if (dt < 10) {
dt = '0' + dt;
}
if (month < 10) {
month = '0' + month;
}
let hasil = year+'-' + month + '-'+dt;
this.setState({
expire: hasil,
})
}) })
} }
useVoucher() {
let params = {
session_id: this.props.session_id,
reward_id: this.props.route.params.rewardId,
lat: this.props.lat,
long: this.props.long
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/reward/use_reward', params).then(res => {
let voucherProps = {
value_voucher: this.state.value,
voucher: this.state.code
}
this.props.setVoucher(voucherProps);
Alert.alert(
'',
res.data.message,
[
{ text: 'OK', onPress: () => this.props.navigation.navigate('Home', { screen: 'MENU' }) }
]
)
}).catch(error => {
let response = error.response.data;
Alert.alert(
'',
response.msg,
[
{ text: 'OK' }
]
)
})
}
useDVoucher() {
this.props.navigation.navigate('Order Detail')
}
render() { render() {
const deskripsi = this.state.deskripsi const deskripsi = this.state.deskripsi
return ( return (
<View style={styles.container}> <View style={styles.container}>
<ScrollView style={styles.body}> <ScrollView style={styles.body}>
<View style={styles.body}> <View style={styles.body}>
{/* <View style={styles.images}> */}
<Image style={{ height: 250, width: '100%' }} source={this.state.image ? { uri: this.state.image } : null} /> <Image style={{ height: 250, width: '100%' }} source={this.state.image ? { uri: this.state.image } : null} />
{/* </View> */} <View style={{ height: 70, flex: 1, backgroundColor: '#03989E', top: -60, marginRight: 10, marginLeft: 10 }}>
<View style={{margin:20}}> <Text style={{ margin: 5 }}>Voucher code : </Text>
<HTML html={this.state.deskripsi} /> <Text style={{ fontSize: 30, textAlign: 'center', fontWeight: 'bold', bottom: 5 }}>{this.state.code}</Text>
</View> </View>
<View style={{ margin: 10 }}> <View style={{ height: 70, flex: 1, backgroundColor: 'black', top: -70, marginRight: 10, marginLeft: 10 }}>
<Button title="Validate" /> <Text style={{ margin: 5, color: 'white' }}>Expired Date : </Text>
<Text style={{ fontSize: 30, textAlign: 'center', fontWeight: 'bold', bottom: 5, color: 'white' }}>{this.state.expire}</Text>
</View> </View>
</View> </View>
<View style={{ flex: 1, top: -60, margin: 10 }}>
{
this.state.used == 0 ? (
<Button title="USE VOUCHER" onPress={() => this.useVoucher()}></Button>
) : this.state.expire >= Date.now() ? (<Button title="EXPIRED" ></Button>) :
(<Button title="USED" onPress={() => this.props.navigation.navigate('Menu Select')()}></Button>)
}
<HTML html={this.state.title} />
<HTML html={this.state.content} />
</View>
</ScrollView> </ScrollView>
</View> </View>
) )
...@@ -96,12 +172,30 @@ const styles = StyleSheet.create({ ...@@ -96,12 +172,30 @@ const styles = StyleSheet.create({
}) })
const mapDispatchToProps = (dispacth) => {
return {
setVoucher: (voucherProps) => dispacth({
type: ActionType.SET_VOUCHER,
data: {
voucher: voucherProps.voucher,
value_voucher: voucherProps.value_voucher,
}
}),
}
}
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
session_id: state.session_id, session_id: state.session_id,
lat: state.lat,
long: state.long,
} }
} }
export default connect(mapStateToProps)(RewardDetail); export default connect(mapStateToProps, mapDispatchToProps)(RewardDetail);
\ No newline at end of file \ No newline at end of file
...@@ -43,6 +43,8 @@ class ShoppingCart extends React.Component { ...@@ -43,6 +43,8 @@ class ShoppingCart extends React.Component {
componentDidMount() { componentDidMount() {
console.log('INI VOUCHER : ' + this.props.voucher)
console.log('INI VALUE : ' + this.props.value_voucher)
if (!this.props.type_pickup) { if (!this.props.type_pickup) {
this.getRate() this.getRate()
} }
...@@ -854,6 +856,8 @@ const mapDispatchToProps = (dispacth) => { ...@@ -854,6 +856,8 @@ const mapDispatchToProps = (dispacth) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
type_pickup: state.type_pickup, type_pickup: state.type_pickup,
value_voucher: state.value_voucher,
voucher: state.voucher,
session_id: state.session_id, session_id: state.session_id,
outlet_id: state.outlet_id, outlet_id: state.outlet_id,
name_outlet: state.name_outlet, name_outlet: state.name_outlet,
......
...@@ -16,8 +16,6 @@ import Axios from 'axios'; ...@@ -16,8 +16,6 @@ import Axios from 'axios';
import HTML from 'react-native-render-html'; import HTML from 'react-native-render-html';
export default class TopUpInfo extends React.Component { export default class TopUpInfo extends React.Component {
constructor(props){ constructor(props){
super(props); super(props);
......
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