Commit 3ee6baaf authored by Trisno's avatar Trisno

update

parent fd26ccc5
...@@ -43,10 +43,8 @@ import OutletDetail from './OutletDetails'; ...@@ -43,10 +43,8 @@ import OutletDetail from './OutletDetails';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { enableScreens } from 'react-native-screens'; import { enableScreens } from 'react-native-screens';
import MenuDetail from './MenuDetail'; import MenuDetail from './MenuDetail';
import OrderHistory from './OrderHistory' import OrderHistory from './OrderHistory';
import { TouchableOpacity } from 'react-native-gesture-handler'; import OrderDetail from './OrderDetail';
import { StackActions } from '@react-navigation/native';
import { NavigationActions } from 'react-navigation';
enableScreens(); enableScreens();
function Rewards() { function Rewards() {
...@@ -168,10 +166,11 @@ class Auth extends React.Component { ...@@ -168,10 +166,11 @@ class Auth extends React.Component {
<Stack.Screen name="Menu Detail" component={MenuDetail} /> <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="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="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="Card Info" component={CardInfo} />
<Stack.Screen name="Shopping Cart" component={ShoppingCart} /> <Stack.Screen name="Shopping Cart" component={ShoppingCart} />
<Stack.Screen name="Order History" component={OrderHistory} /> <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 { ...@@ -41,8 +41,10 @@ class OrderHistory extends React.Component {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<ScrollView style={styles.body}> <ScrollView style={styles.body}>
{ {
this.state.order_list.map((item, key) => ( this.state.order_list.map((item, key) => (
<TouchableOpacity key={key} onPress={() => this.props.navigation.navigate('Order Detail', {idTrans:item.id})}>
<View key={key}> <View key={key}>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}> <Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text>OUTLET : {item.outlet}</Text> <Text>OUTLET : {item.outlet}</Text>
...@@ -51,7 +53,7 @@ class OrderHistory extends React.Component { ...@@ -51,7 +53,7 @@ class OrderHistory extends React.Component {
<Text>STATUS : {item.trans_status_display}</Text> <Text>STATUS : {item.trans_status_display}</Text>
</Card> </Card>
</View> </View>
</TouchableOpacity>
)) ))
} }
</ScrollView> </ScrollView>
......
...@@ -197,7 +197,10 @@ class PickupName extends React.Component { ...@@ -197,7 +197,10 @@ class PickupName extends React.Component {
RenderItem = ({ item }) => { RenderItem = ({ item }) => {
return ( return (
<View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}>
<View style={{ flexDirection: 'row', flex: 1 }}> <View style={{ flexDirection: 'row', flex: 1 }}>
<View> <View>
<MaterialCommunityIcons name="map-marker" size={32} color="brown" /> <MaterialCommunityIcons name="map-marker" size={32} color="brown" />
</View> </View>
...@@ -214,17 +217,17 @@ class PickupName extends React.Component { ...@@ -214,17 +217,17 @@ class PickupName extends React.Component {
</Text> </Text>
</View> </View>
<View> <View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name)}>
<CheckBox <CheckBox
center center
checkedIcon='dot-circle-o' checkedIcon='dot-circle-o'
uncheckedIcon='circle-o' uncheckedIcon='circle-o'
checked={this.state.checked} checked={this.state.checked}
/> />
</TouchableOpacity>
</View> </View>
</View> </View>
</TouchableOpacity>
</View>
); );
} }
render() { render() {
......
...@@ -9,11 +9,18 @@ class TransactionDetail extends React.Component { ...@@ -9,11 +9,18 @@ class TransactionDetail extends React.Component {
super(props) super(props)
this.state = { this.state = {
transDetail: [], transDetail: [],
transDate: '', trans_date: '',
transDiscount: '', transDiscount: '',
transId: '', transId: '',
transTax: '', 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 { ...@@ -27,18 +34,22 @@ class TransactionDetail extends React.Component {
transaction_id: this.props.route.params.idTrans transaction_id: this.props.route.params.idTrans
} }
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/detail', params).then(res => { 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 let data = res.data
console.log(data) console.log(data)
this.setState({ this.setState({
trans_type_display: data.trans_type_display,
transId: data.trans_id, transId: data.trans_id,
transDate: data.trans_date, trans_date: data.trans_date,
transTotal: data.trans_total, 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) // 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 { ...@@ -50,11 +61,31 @@ class TransactionDetail extends React.Component {
</View> </View>
<View style={styles.body}> <View style={styles.body}>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}> <Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text> Jenis Transaksi : {this.state.transId}</Text> <Text> Jenis Transaksi : {this.state.trans_type_display}</Text>
<Text> Tanggal : {this.state.transDate}</Text> <Text> Tanggal : {this.state.trans_date}</Text>
<Text> Total : {this.state.transTotal}</Text> <Text> Total : {this.state.transTotal}</Text>
<Text> Detail : {this.state.transDetail}</Text> <Text> Waktu Transaksi : {this.state.trans_time}</Text>
<Button title="OK" onPress={() => this.props.navigation.goBack()}/> <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> </Card>
</View> </View>
......
...@@ -22,7 +22,7 @@ class TransactionHistory extends React.Component { ...@@ -22,7 +22,7 @@ class TransactionHistory extends React.Component {
} }
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/history', params).then(res => { Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/history', params).then(res => {
let data = res.data.transactions let data = res.data.transactions
// console.log('ini datanya loh : ' + JSON.stringify(data)) console.log('ini datanya loh : ' + JSON.stringify(data))
this.setState({ this.setState({
history_list: data history_list: data
}) })
...@@ -43,9 +43,9 @@ class TransactionHistory extends React.Component { ...@@ -43,9 +43,9 @@ class TransactionHistory extends React.Component {
item.transactions.map((i, k) => ( item.transactions.map((i, k) => (
<TouchableOpacity key={k} onPress={() => this.props.navigation.navigate('Transaction Detail', {idTrans:i.id})}> <TouchableOpacity key={k} onPress={() => this.props.navigation.navigate('Transaction Detail', {idTrans:i.id})}>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}> <Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text>{i.trans_id}</Text> <Text>TANGGAL : {i.trans_date}</Text>
<Text>{i.trans_date}</Text> <Text>TOTAL : {i.trans_total}</Text>
<Text>{i.trans_total}</Text> <Text>TRANSAKSI : {i.trans_type_display}</Text>
</Card> </Card>
</TouchableOpacity> </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