Commit 57958b13 authored by Trisno's avatar Trisno

update order detail

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