Commit 57958b13 authored by Trisno's avatar Trisno

update order detail

parent 70f52f85
import React from 'react'; import React from 'react';
import { View, Text, TextInput, StyleSheet, ScrollView, Alert, TouchableOpacity, BackHandler, Modal } from 'react-native'; import { View, Text, TextInput, StyleSheet, ScrollView, Alert, TouchableOpacity, BackHandler, Modal, Image } from 'react-native';
import { Card } from 'react-native-shadow-cards' import { Card } from 'react-native-shadow-cards'
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Axios from 'axios'; import Axios from 'axios';
...@@ -181,30 +181,30 @@ class OrderDetail extends React.Component { ...@@ -181,30 +181,30 @@ class OrderDetail extends React.Component {
) )
} }
</View> </View>
<View style={{ margin: 10, paddingLeft: 10 }}> <View style={{ marginLeft: 10, marginTop: 10, paddingLeft: 10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>PESANAN</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>PESANAN</Text>
</View> </View>
{ {
this.state.transaction_detail.map((item, index) => { this.state.transaction_detail.map((item, index) => {
// total = total + item.quantity * item.price // total = total + item.quantity * item.price
return ( return (
<View style={{ margin: 10 }} key={index} > <View style={{ margin: 0 }} key={index} >
{ {
item.item_code == 'GRAB-DELIVERY' ? ( item.item_code == 'GRAB-DELIVERY' ? (
null null
) : ( ) : (
<View style={{ flex: 1, margin: 10, flexDirection: 'row', justifyContent: 'space-around' }}> <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-around', marginHorizontal: 10, marginVertical: 5 }}>
<View style={{ flex: 0.3, alignItems: 'center' }}> <View style={{ flex: 0.1, alignItems: 'center', justifyContent: 'center', alignItems: 'center', marginLeft: 18 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{item.item_quantity}</Text> */} {/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{item.item_quantity}</Text> */}
<NumberFormat decimalScale={0} value={item.item_quantity} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={item.item_quantity} renderText={value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Light', color: '#838383' }}>{value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View> </View>
<View style={{ flex: 0.1, alignItems: 'flex-start' }}> <View style={{ flex: 0.2, alignItems: 'center' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>x</Text> <Image source={{ uri: item.item_image }} style={{ height: 50, width: 50, borderRadius: 5 }}></Image>
</View> </View>
<View style={{ flex: 0.3, alignItems: 'baseline' }}> <View style={{ flex: 0.4, alignItems: 'baseline', justifyContent: 'center', alignItems: 'flex-start', paddingLeft: 10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{item.item_name} </Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{item.item_name} </Text>
</View> </View>
<View style={{ flex: 0.3, alignItems: 'flex-end' }}> <View style={{ flex: 0.3, alignItems: 'flex-end', justifyContent: 'center', paddingRight: 10 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{item.item_quantity * item.item_price} </Text> */} {/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{item.item_quantity * item.item_price} </Text> */}
<NumberFormat decimalScale={0} value={item.item_quantity * item.item_price} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={item.item_quantity * item.item_price} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View> </View>
...@@ -215,29 +215,31 @@ class OrderDetail extends React.Component { ...@@ -215,29 +215,31 @@ class OrderDetail extends React.Component {
) )
}) })
} }
{/* { {
this.state.detail_trans.used_reward.length < 0 ? ( this.state.detail_trans != '' ? (
null this.state.detail_trans.used_reward.length ? (
) : (
<> <>
<View style={{ borderTopWidth: 1, margin: 10, padding: 10 }}> <View style={{ borderTopWidth: 1, borderColor: 'grey', marginHorizontal: 10, marginTop: 5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>Voucher</Text> <View style={{ paddingLeft: 10, paddingTop: 10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>VOUCHER</Text>
</View>
</View> </View>
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginHorizontal: 10 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', margin: 10, marginTop: -10 }}> <View style={{ flex: 0.5, marginLeft: 20, marginVertical: 5 }}>
<View style={{ margin: 10, paddingLeft: 10 }}> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.used_reward[0].reward.title}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{this.props.voucher.reward.title}</Text>
</View> </View>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Reward Detail', { rewardId: this.props.voucher.id })}> <View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}>
<View style={{ margin: 10, paddingRight: 5 }}> <TouchableOpacity onPress={() => this.props.navigation.navigate('Reward Detail', { rewardId: this.state.detail_trans.used_reward[0].id})}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: '#CFB368' }}>View Detail</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: '#CFB368' }}>View Detail</Text>
</View> </TouchableOpacity>
</TouchableOpacity> {/* <NumberFormat decimalScale={0} value={this.state.detail_trans.point_reduce} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> */}
</View>
</View> </View>
</> </>
) ) : (null)
} */} ) : (null)
<View style={{ borderTopWidth: 1, borderColor: 'grey', marginHorizontal: 10 }}> }
<View style={{ borderTopWidth: 1, borderColor: 'grey', marginHorizontal: 10, marginTop: 5 }}>
<View style={{ paddingLeft: 10, paddingTop: 10 }}> <View style={{ paddingLeft: 10, paddingTop: 10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>PAYMENT</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>PAYMENT</Text>
</View> </View>
...@@ -297,7 +299,7 @@ class OrderDetail extends React.Component { ...@@ -297,7 +299,7 @@ class OrderDetail extends React.Component {
// console.log(item) // console.log(item)
if (item.item_code == 'GRAB-DELIVERY') { if (item.item_code == 'GRAB-DELIVERY') {
return ( return (
<NumberFormat decimalScale={0} value={item.item_price} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', textAlign: 'right' }}>- Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={item.item_price} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', textAlign: 'right' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
) )
} }
}) })
...@@ -338,6 +340,8 @@ class OrderDetail extends React.Component { ...@@ -338,6 +340,8 @@ class OrderDetail extends React.Component {
) )
} }
<View style={{ marginVertical: 20 }} />
...@@ -398,7 +402,7 @@ const styles = StyleSheet.create({ ...@@ -398,7 +402,7 @@ const styles = StyleSheet.create({
}, },
button: { button: {
backgroundColor: '#d34343', backgroundColor: '#d34343',
height:40, height: 40,
marginTop: 25, marginTop: 25,
marginHorizontal: 20, marginHorizontal: 20,
borderRadius: 10, borderRadius: 10,
......
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