Commit 73ac6bc6 authored by Trisno's avatar Trisno

update order history

parent 997d9d6b
...@@ -14,7 +14,7 @@ class OrderHistory extends React.Component { ...@@ -14,7 +14,7 @@ class OrderHistory extends React.Component {
} }
componentDidMount(){ componentDidMount() {
this.getOrderHistory() this.getOrderHistory()
...@@ -24,36 +24,34 @@ class OrderHistory extends React.Component { ...@@ -24,36 +24,34 @@ class OrderHistory extends React.Component {
let params = { let params = {
session_id: this.props.session_id session_id: this.props.session_id
} }
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/history', params).then(res => { Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/list', params).then(res => {
let data = res.data.transactions let data = res.data.data
// console.log('ini datanya loh : ' + JSON.stringify(data)) // console.log(data)
this.setState({ this.setState({
order_list: data order_list: data
}) })
console.log(this.state.order_list) // console.log(this.state.order_list)
}).catch(error => { }).catch(error => {
let response = error.response.data; let response = error.response.data;
Alert.alert(response.msg); Alert.alert(response.msg);
}) })
} }
render(){ render() {
// console.log(this.state.order_list) // console.log(this.state.order_list)
return( return (
<View style={styles.container}> <View style={styles.container}>
<ScrollView style={styles.body}> <ScrollView style={styles.body}>
{ {
this.state.order_list.map((item) => ( this.state.order_list.map((item, key) => (
<View key={key}>
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' }}> <Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<Text>{i.trans_id}</Text> <Text>{item.outlet}</Text>
<Text>{i.trans_date}</Text> <Text>{item.trans_date}</Text>
<Text>{i.trans_total}</Text> <Text>{item.trans_total}</Text>
</Card> </Card>
</TouchableOpacity> </View>
))
)) ))
} }
</ScrollView> </ScrollView>
......
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