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 { ...@@ -410,7 +410,7 @@ class Auth extends React.Component {
color: 'white', color: 'white',
textAlign: 'center' textAlign: 'center'
}, },
title: 'Reward History', title: 'Transaction History Detail',
headerLeft: props => <HeaderBackButton {...props} onPress={() => navigation.navigate('Home', { screen: 'ORDER' })} />, headerLeft: props => <HeaderBackButton {...props} onPress={() => navigation.navigate('Home', { screen: 'ORDER' })} />,
})} /> })} />
......
...@@ -19,7 +19,7 @@ class ItemShoping extends React.Component { ...@@ -19,7 +19,7 @@ class ItemShoping extends React.Component {
code: item.code, code: item.code,
name: item.name, name: item.name,
description: item.description, description: item.description,
note: 'jangan garing', note: item.note,
image: item.image, image: item.image,
price: parseInt(item.price), price: parseInt(item.price),
} }
......
...@@ -33,12 +33,6 @@ class MenuConfirmation extends React.Component { ...@@ -33,12 +33,6 @@ class MenuConfirmation extends React.Component {
// console.log("POINT" +this.props.pointsused) // console.log("POINT" +this.props.pointsused)
// console.log(this.props.type_pickup) // 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('kosong'+this.props.value_voucher)
console.log('nih')
console.log('udah')
console.log('update')
} }
...@@ -118,8 +112,7 @@ class MenuConfirmation extends React.Component { ...@@ -118,8 +112,7 @@ class MenuConfirmation extends React.Component {
{ cancelable: false } { cancelable: false }
); );
}).catch(error => { }).catch(error => {
let response = error.response.data;
console.log(" INI ERROR : " + error)
Alert.alert(response.msg); Alert.alert(response.msg);
this.setState({ this.setState({
spinner: false, spinner: false,
......
import React from 'react'; 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 Axios from 'axios';
import Item from './Item'; import Item from './Item';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
......
...@@ -21,6 +21,7 @@ class OrderDetail extends React.Component { ...@@ -21,6 +21,7 @@ class OrderDetail extends React.Component {
transaction_detail: [], transaction_detail: [],
numberId: '', numberId: '',
detail_trans: '', detail_trans: '',
trans_status:''
} }
...@@ -44,6 +45,10 @@ class OrderDetail extends React.Component { ...@@ -44,6 +45,10 @@ class OrderDetail extends React.Component {
return true; return true;
} }
handleCancel(){
}
getDetailTrans() { getDetailTrans() {
let params = { let params = {
session_id: this.props.session_id, session_id: this.props.session_id,
...@@ -62,6 +67,7 @@ class OrderDetail extends React.Component { ...@@ -62,6 +67,7 @@ class OrderDetail extends React.Component {
trans_status_display: data.trans_status_display, trans_status_display: data.trans_status_display,
transaction_detail: data.transaction_detail, transaction_detail: data.transaction_detail,
detail_trans: data, detail_trans: data,
trans_status : data.trans_status,
numberId: data.id.substring(0, 5).toUpperCase() numberId: data.id.substring(0, 5).toUpperCase()
}) })
...@@ -237,6 +243,15 @@ class OrderDetail extends React.Component { ...@@ -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={''} /> <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>
</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({ ...@@ -293,7 +308,16 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
margin: 20, margin: 20,
borderWidth: 1, borderWidth: 1,
} },
button: {
backgroundColor: '#CFB368',
marginTop: 25,
marginHorizontal: 30,
borderRadius: 10,
paddingVertical: 5,
alignItems: 'center',
justifyContent: 'center'
},
}) })
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
......
...@@ -64,11 +64,11 @@ class PickupName extends React.Component { ...@@ -64,11 +64,11 @@ class PickupName extends React.Component {
this.getOutlet() this.getOutlet()
} }
getOutletDetail(id,name) { getOutletDetail(id, name) {
let OutletChange = { let OutletChange = {
outlet_id: id , outlet_id: id,
name_outlet:name, name_outlet: name,
} }
// let recalculateProps = { // let recalculateProps = {
...@@ -81,7 +81,7 @@ class PickupName extends React.Component { ...@@ -81,7 +81,7 @@ class PickupName extends React.Component {
this.props.setTypePickup(true); this.props.setTypePickup(true);
if (this.props.route.params.from == 'shoppingCart') { 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 { } else {
this.props.navigation.navigate('Home', { this.props.navigation.navigate('Home', {
...@@ -101,7 +101,7 @@ class PickupName extends React.Component { ...@@ -101,7 +101,7 @@ class PickupName extends React.Component {
Axios.post("https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_list", params).then(res => { Axios.post("https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_list", params).then(res => {
let dataOutlets = res.data.outlets; 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++) { for (let i = 0; i < dataOutlets.length; i++) {
dataOutlets[i]['distance'] = this.distance(dataOutlets[i]['lat'], dataOutlets[i]['long']); dataOutlets[i]['distance'] = this.distance(dataOutlets[i]['lat'], dataOutlets[i]['long']);
let address = dataOutlets[i]['address']; let address = dataOutlets[i]['address'];
...@@ -198,6 +198,8 @@ class PickupName extends React.Component { ...@@ -198,6 +198,8 @@ class PickupName extends React.Component {
RenderItem = ({ item }) => { RenderItem = ({ item }) => {
return ( return (
<View>
{item.can_accept_order == true ? (
<View> <View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}> <TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}>
<View style={{ flexDirection: 'row', flex: 1 }}> <View style={{ flexDirection: 'row', flex: 1 }}>
...@@ -207,13 +209,13 @@ class PickupName extends React.Component { ...@@ -207,13 +209,13 @@ class PickupName extends React.Component {
<View style={styles.list_addrees}> <View style={styles.list_addrees}>
<View style={{ margin: 5 }}> <View style={{ margin: 5 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text>
<View style={{flexDirection:'row'}}> <View style={{ flexDirection: 'row' }}>
{item.can_accept_order == true ? (<Text style={{fontFamily: 'Gotham-Black',color:"#ccb46c",top:5}}>OPEN </Text>) {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>) } : (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c" }}>CLOSED </Text>)}
</View> </View>
</View> </View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368'}}> Opening Hours : {item.open_time} - {item.close_time}</Text> <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={{ margin: 5, color: '#b1b1b2', fontFamily: 'Gotham-Light' }}>
{item.full_address} {item.full_address}
</Text> </Text>
</View> </View>
...@@ -226,11 +228,45 @@ class PickupName extends React.Component { ...@@ -226,11 +228,45 @@ class PickupName extends React.Component {
checkedColor="#ccb46c" checkedColor="#ccb46c"
uncheckedColor="#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>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
) : (<View>
<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>
</View>)}
</View>
); );
} }
render() { render() {
...@@ -315,14 +351,14 @@ const mapDispatchToProps = (dispacth) => { ...@@ -315,14 +351,14 @@ const mapDispatchToProps = (dispacth) => {
setTypePickup: (type) => dispacth({ setTypePickup: (type) => dispacth({
type: ActionType.SET_TYPE, type: ActionType.SET_TYPE,
data: { data: {
type_pickup : type type_pickup: type
} }
}), }),
setRecalculate: (recalculateProps) => dispacth({ setRecalculate: (recalculateProps) => dispacth({
type: ActionType.SET_RECALCULATE, type: ActionType.SET_RECALCULATE,
data: { data: {
order_total : recalculateProps.order_total, order_total: recalculateProps.order_total,
order_quantity: recalculateProps.order_quantity, order_quantity: recalculateProps.order_quantity,
order_item: recalculateProps.order_item 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