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

change outlet and add button cancel order logic

parent f7c6f6fb
......@@ -410,7 +410,7 @@ class Auth extends React.Component {
color: 'white',
textAlign: 'center'
},
title: 'Reward History',
title: 'Transaction History Detail',
headerLeft: props => <HeaderBackButton {...props} onPress={() => navigation.navigate('Home', { screen: 'ORDER' })} />,
})} />
......
......@@ -19,7 +19,7 @@ class ItemShoping extends React.Component {
code: item.code,
name: item.name,
description: item.description,
note: 'jangan garing',
note: item.note,
image: item.image,
price: parseInt(item.price),
}
......
......@@ -33,12 +33,6 @@ class MenuConfirmation extends React.Component {
// console.log("POINT" +this.props.pointsused)
// console.log(this.props.type_pickup)
// console.log('kosong'+this.props.value_voucher)
// console.log('kosong'+this.props.value_voucher)
// console.log('kosong'+this.props.value_voucher)
console.log('nih')
console.log('udah')
console.log('update')
}
......@@ -118,8 +112,7 @@ class MenuConfirmation extends React.Component {
{ cancelable: false }
);
}).catch(error => {
console.log(" INI ERROR : " + error)
let response = error.response.data;
Alert.alert(response.msg);
this.setState({
spinner: false,
......
import React from 'react';
import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Image, FlatList, Button, StatusBar, ActivityIndicator, Alert } from 'react-native';
import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Image, FlatList, Button, StatusBar, ActivityIndicator, Alert,Modal } from 'react-native';
import Axios from 'axios';
import Item from './Item';
import { connect } from 'react-redux';
......
......@@ -21,6 +21,7 @@ class OrderDetail extends React.Component {
transaction_detail: [],
numberId: '',
detail_trans: '',
trans_status:''
}
......@@ -44,6 +45,10 @@ class OrderDetail extends React.Component {
return true;
}
handleCancel(){
}
getDetailTrans() {
let params = {
session_id: this.props.session_id,
......@@ -62,6 +67,7 @@ class OrderDetail extends React.Component {
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()
})
......@@ -237,6 +243,15 @@ class OrderDetail extends React.Component {
<NumberFormat decimalScale={0} value={this.state.detail_trans.trans_total} renderText={value => <Text style={{ fontSize: 15, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
</View>
{
this.state.trans_status == 0 && this.state.trans_status_display == 'On Queue' ? (<TouchableOpacity onPress={() => this.handleCancel()}>
<View style={styles.button}>
<Text style={{ color: 'white', fontSize: 22, fontFamily: 'Gotham-Black' }}>Cancel</Text>
</View>
</TouchableOpacity>):(null)
}
......@@ -293,7 +308,16 @@ const styles = StyleSheet.create({
flex: 1,
margin: 20,
borderWidth: 1,
}
},
button: {
backgroundColor: '#CFB368',
marginTop: 25,
marginHorizontal: 30,
borderRadius: 10,
paddingVertical: 5,
alignItems: 'center',
justifyContent: 'center'
},
})
const mapStateToProps = (state) => {
......
......@@ -32,7 +32,7 @@ class PickupName extends React.Component {
componentDidMount() {
this._getPermissions()
}
_getPermissions = async () => {
......@@ -64,11 +64,11 @@ class PickupName extends React.Component {
this.getOutlet()
}
getOutletDetail(id,name) {
getOutletDetail(id, name) {
let OutletChange = {
outlet_id: id ,
name_outlet:name,
outlet_id: id,
name_outlet: name,
}
// let recalculateProps = {
......@@ -81,13 +81,13 @@ class PickupName extends React.Component {
this.props.setTypePickup(true);
if (this.props.route.params.from == 'shoppingCart') {
this.props.navigation.navigate('Shopping Cart', {outlet_change: true, outlet_id: id})
this.props.navigation.navigate('Shopping Cart', { outlet_change: true, outlet_id: id })
} else {
this.props.navigation.navigate('Home', {
screen: 'MENU',
params: { user: 'jane' },
})
})
}
}
......@@ -101,7 +101,7 @@ class PickupName extends React.Component {
Axios.post("https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_list", params).then(res => {
let dataOutlets = res.data.outlets;
console.log("INI ADALAH DATA OUTLETS : "+ JSON.stringify(dataOutlets))
console.log("INI ADALAH DATA OUTLETS : " + JSON.stringify(dataOutlets))
for (let i = 0; i < dataOutlets.length; i++) {
dataOutlets[i]['distance'] = this.distance(dataOutlets[i]['lat'], dataOutlets[i]['long']);
let address = dataOutlets[i]['address'];
......@@ -140,9 +140,9 @@ class PickupName extends React.Component {
}).catch(error => {
let response = error.response.data;
Alert.alert(response.msg);
this.setState({
spinner: false,
})
this.setState({
spinner: false,
})
})
}
......@@ -192,14 +192,49 @@ class PickupName extends React.Component {
name_outlet: item.name,
}
this.props.setChangeOutletProps(OutletChange)
this.props.navigation.navigate('Home', { screen: 'MENU' });
}
RenderItem = ({ item }) => {
return (
<View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}>
{item.can_accept_order == true ? (
<View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}>
<View style={{ flexDirection: 'row', flex: 1 }}>
<View>
<MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
</View>
<View style={styles.list_addrees}>
<View style={{ margin: 5 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text>
<View style={{ flexDirection: 'row' }}>
{item.can_accept_order == true ? (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c", top: 5 }}>OPEN </Text>)
: (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c" }}>CLOSED </Text>)}
</View>
</View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368' }}> Opening Hours : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, color: '#b1b1b2', fontFamily: 'Gotham-Light' }}>
{item.full_address}
</Text>
</View>
<View>
<CheckBox
center
checkedIcon='dot-circle-o'
uncheckedIcon='circle-o'
checked={this.state.checked}
checkedColor="#ccb46c"
uncheckedColor="#ccb46c"
/>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light' }}>{item.distance} KM</Text>
</View>
</View>
</TouchableOpacity>
</View>
) : (<View>
<View style={{ flexDirection: 'row', flex: 1 }}>
<View>
<MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
......@@ -207,13 +242,13 @@ class PickupName extends React.Component {
<View style={styles.list_addrees}>
<View style={{ margin: 5 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text>
<View style={{flexDirection:'row'}}>
{item.can_accept_order == true ? (<Text style={{fontFamily: 'Gotham-Black',color:"#ccb46c",top:5}}>OPEN </Text>)
:(<Text style={{fontFamily: 'Gotham-Black',color:"#ccb46c"}}>CLOSED </Text>) }
</View>
<View style={{ flexDirection: 'row' }}>
{item.can_accept_order == true ? (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c", top: 5 }}>OPEN </Text>)
: (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c" }}>CLOSED </Text>)}
</View>
</View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368'}}> Opening Hours : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, color: '#b1b1b2',fontFamily: 'Gotham-Light' }}>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368' }}> Opening Hours : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, color: '#b1b1b2', fontFamily: 'Gotham-Light' }}>
{item.full_address}
</Text>
</View>
......@@ -226,18 +261,19 @@ class PickupName extends React.Component {
checkedColor="#ccb46c"
uncheckedColor="#ccb46c"
/>
<Text style={{textAlign:'center',color:'#ccb46c',fontFamily:'Gotham-Light' }}>{item.distance} KM</Text>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light' }}>{item.distance} KM</Text>
</View>
</View>
</TouchableOpacity>
</View>)}
</View>
);
}
render() {
return (
<View style={styles.container}>
<Spinner
<Spinner
visible={this.state.spinner}
textContent={'Loading...'}
textStyle={styles.spinnerTextStyle}
......@@ -315,14 +351,14 @@ const mapDispatchToProps = (dispacth) => {
setTypePickup: (type) => dispacth({
type: ActionType.SET_TYPE,
data: {
type_pickup : type
type_pickup: type
}
}),
setRecalculate: (recalculateProps) => dispacth({
type: ActionType.SET_RECALCULATE,
data: {
order_total : recalculateProps.order_total,
order_total: recalculateProps.order_total,
order_quantity: recalculateProps.order_quantity,
order_item: recalculateProps.order_item
......
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