Commit 3ee6baaf authored by Trisno's avatar Trisno

update

parent fd26ccc5
......@@ -43,10 +43,8 @@ import OutletDetail from './OutletDetails';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { enableScreens } from 'react-native-screens';
import MenuDetail from './MenuDetail';
import OrderHistory from './OrderHistory'
import { TouchableOpacity } from 'react-native-gesture-handler';
import { StackActions } from '@react-navigation/native';
import { NavigationActions } from 'react-navigation';
import OrderHistory from './OrderHistory';
import OrderDetail from './OrderDetail';
enableScreens();
function Rewards() {
......@@ -168,10 +166,11 @@ class Auth extends React.Component {
<Stack.Screen name="Menu Detail" component={MenuDetail} />
<Stack.Screen name="Pickup Name" component={PickupName} options={{title:"PICKUP STORE",headerStyle:{backgroundColor:"#ccb46c"},headerTitleAlign:'center',headerTitleStyle:{color:'white',fontWeight:'bold'}}} />
<Stack.Screen name="Outlet Detail" component={OutletDetail}/>
<Stack.Screen name="Menu Select" component={MenuSelection} />
<Stack.Screen name="Menu Select" component={MenuSelection} options={{headerShown:false}} />
<Stack.Screen name="Card Info" component={CardInfo} />
<Stack.Screen name="Shopping Cart" component={ShoppingCart} />
<Stack.Screen name="Order History" component={OrderHistory} />
<Stack.Screen name="Order Detail" component={OrderDetail} />
</>
)
......
import React from 'react';
import { View, Text, TextInput, StyleSheet, ScrollView, Alert, TouchableOpacity } from 'react-native';
import { Card } from 'react-native-shadow-cards'
import { connect } from 'react-redux';
import Axios from 'axios';
class OrderDetail extends React.Component {
constructor(props) {
super(props)
this.state = {
trans_type_display:'',
outlet:'',
outlet_code:'',
trans_status_display:'',
transaction_detail:[],
}
}
componentDidMount() {
this.getDetailTrans()
}
getDetailTrans() {
let params = {
session_id: this.props.session_id,
transaction_id: this.props.route.params.idTrans
}
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)
this.setState({
outlet: data.outlet,
outlet_code: data.outlet_code,
trans_status_display: data.trans_status_display,
transaction_detail: data.transaction_detail
})
}).catch(error => {
let response = error.response.data;
Alert.alert(response.msg);
})
}
render() {
// console.log(this.state.order_list)
return (
<View style={styles.container}>
<ScrollView style={styles.body}>
<View>
<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>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
header: {
flex: 0.2,
},
body: {
flex: 3,
margin: 5,
},
list_detail_order: {
flex: 1,
margin: 20,
borderWidth: 1,
}
})
const mapStateToProps = (state) => {
return {
session_id: state.session_id,
}
}
export default connect(mapStateToProps)(OrderDetail);
\ No newline at end of file
......@@ -41,8 +41,10 @@ class OrderHistory extends React.Component {
return (
<View style={styles.container}>
<ScrollView style={styles.body}>
{
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>
......@@ -51,7 +53,7 @@ class OrderHistory extends React.Component {
<Text>STATUS : {item.trans_status_display}</Text>
</Card>
</View>
</TouchableOpacity>
))
}
</ScrollView>
......
......@@ -197,33 +197,36 @@ class PickupName extends React.Component {
RenderItem = ({ item }) => {
return (
<View style={{ flexDirection: 'row', flex: 1 }}>
<View>
<MaterialCommunityIcons name="map-marker" size={32} color="brown" />
</View>
<View style={styles.list_addrees}>
<View style={{ margin: 5 }}>
<Text style={{ fontWeight: 'bold', fontSize: 20 }}>{item.name}</Text>
<Text style={{ fontWeight: 'bold', fontSize: 15, color: '#ccb46c' }}>OPEN - </Text>
</View>
<Text style={{ margin: 5, color: '#b1b1b2' }}>
{item.full_address}
</Text>
<Text style={{ margin: 5, color: '#aeaead' }}>
{item.distance} KM
</Text>
</View>
<View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}>
<CheckBox
center
checkedIcon='dot-circle-o'
uncheckedIcon='circle-o'
checked={this.state.checked}
/>
</TouchableOpacity>
<View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}>
<View style={{ flexDirection: 'row', flex: 1 }}>
</View>
<View>
<MaterialCommunityIcons name="map-marker" size={32} color="brown" />
</View>
<View style={styles.list_addrees}>
<View style={{ margin: 5 }}>
<Text style={{ fontWeight: 'bold', fontSize: 20 }}>{item.name}</Text>
<Text style={{ fontWeight: 'bold', fontSize: 15, color: '#ccb46c' }}>OPEN - </Text>
</View>
<Text style={{ margin: 5, color: '#b1b1b2' }}>
{item.full_address}
</Text>
<Text style={{ margin: 5, color: '#aeaead' }}>
{item.distance} KM
</Text>
</View>
<View>
<CheckBox
center
checkedIcon='dot-circle-o'
uncheckedIcon='circle-o'
checked={this.state.checked}
/>
</View>
</View>
</TouchableOpacity>
</View>
);
}
......
......@@ -9,11 +9,18 @@ class TransactionDetail extends React.Component {
super(props)
this.state = {
transDetail: [],
transDate: '',
trans_date: '',
transDiscount: '',
transId: '',
transTax: '',
transTotal: ''
transTotal: '',
trans_type_display: '',
outlet: '',
outlet_code: '',
trans_time: '',
trans_total: '',
point_reduce: '',
transaction_detail: []
}
}
......@@ -27,18 +34,22 @@ class TransactionDetail extends React.Component {
transaction_id: this.props.route.params.idTrans
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/detail', params).then(res => {
console.log("INI DATA NYA LHOOOOO ......." + JSON.stringify(res.data))
let data = res.data
console.log(data)
this.setState({
trans_type_display: data.trans_type_display,
transId: data.trans_id,
transDate: data.trans_date,
trans_date: data.trans_date,
transTotal: data.trans_total,
transDetail: data.transaction_detail
outlet: data.outlet,
outlet_code: data.outlet_code,
trans_time: data.trans_time,
trans_total: data.trans_total,
point_reduce: data.point_reduce,
transaction_detail: data.transaction_detail
})
// console.log(this.state.history_list)
}).catch(error => {
let response = error.response.data;
Alert.alert(response.msg);
})
}
......@@ -50,11 +61,31 @@ class TransactionDetail extends React.Component {
</View>
<View style={styles.body}>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text> Jenis Transaksi : {this.state.transId}</Text>
<Text> Tanggal : {this.state.transDate}</Text>
<Text> Jenis Transaksi : {this.state.trans_type_display}</Text>
<Text> Tanggal : {this.state.trans_date}</Text>
<Text> Total : {this.state.transTotal}</Text>
<Text> Detail : {this.state.transDetail}</Text>
<Button title="OK" onPress={() => this.props.navigation.goBack()}/>
<Text> Waktu Transaksi : {this.state.trans_time}</Text>
<Text> Poin reduce : {this.state.point_reduce}</Text>
<Text> Total : {this.state.outlet_code}</Text>
<Text> Total : {this.state.outlet_code}</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>
</View>
......
......@@ -22,7 +22,7 @@ class TransactionHistory extends React.Component {
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/history', params).then(res => {
let data = res.data.transactions
// console.log('ini datanya loh : ' + JSON.stringify(data))
console.log('ini datanya loh : ' + JSON.stringify(data))
this.setState({
history_list: data
})
......@@ -43,9 +43,9 @@ class TransactionHistory extends React.Component {
item.transactions.map((i, k) => (
<TouchableOpacity key={k} onPress={() => this.props.navigation.navigate('Transaction Detail', {idTrans:i.id})}>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text>{i.trans_id}</Text>
<Text>{i.trans_date}</Text>
<Text>{i.trans_total}</Text>
<Text>TANGGAL : {i.trans_date}</Text>
<Text>TOTAL : {i.trans_total}</Text>
<Text>TRANSAKSI : {i.trans_type_display}</Text>
</Card>
</TouchableOpacity>
))
......
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