Commit b33f1cac authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo
parents d24c6307 5bd2f858
......@@ -23,7 +23,7 @@ class OrderDetail extends React.Component {
detail_trans: '',
trans_status: '',
modalVisible: false,
reason:''
reason: ''
}
......@@ -55,7 +55,7 @@ class OrderDetail extends React.Component {
handleOrderCancel() {
// console.log(this.state.reason)
let params = {
session_id: this.props.session_id,
transaction_id: this.props.route.params.idTrans,
......@@ -82,6 +82,7 @@ class OrderDetail extends React.Component {
// console.log("PARAMETER : " + JSON.stringify(params))
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/detail', params).then(res => {
let data = res.data
// console.log('ini data' + JSON.stringify(data))
// console.log("INI OUTLET "+ data.outlet)
// console.log("OUTLET-CODE" + data.outlet_code)
// console.log("TRANS-DISPLAY" + data.trans_type_display)
......@@ -110,7 +111,7 @@ class OrderDetail extends React.Component {
}
render() {
// console.log(this.state.detail_trans)
console.log(this.state.detail_trans)
// console.log(this.state.detail_trans.used_reward)
return (
<View style={styles.container}>
......@@ -143,24 +144,26 @@ class OrderDetail extends React.Component {
</Modal>
<View style={styles.header}>
<Text style={{ fontSize: 16, fontFamily: 'Gotham-Light', textAlign: 'center', color: 'grey' }}>#{this.state.numberId}</Text>
<Text style={{ fontSize: 20, fontFamily: 'Gotham-Light', textAlign: 'center', color: 'grey' }}>#{this.state.numberId}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'center', color: 'grey' }}>{moment(this.state.detail_trans.trans_time).format('DD MMMM YYYY HH:mm:ss')}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'center', color: 'grey' }}>{this.state.detail_trans.trans_status_display}</Text>
</View>
<ScrollView style={styles.body}>
<View style={{ flex: 1, flexDirection: 'row', borderBottomWidth: 1, borderColor: 'grey', margin: 10, paddingBottom: 30, padding: 10 }}>
<View style={{ flex: 1, flexDirection: 'row', borderBottomWidth: 1, borderColor: 'grey', marginHorizontal: 10, padding: 10 }}>
<View style={{ flex: 0.1, justifyContent: 'center' }}>
<FontAwesome name="map-marker" size={24} color="red" />
<FontAwesome name="map-marker" size={24} color="#d34343" />
</View>
{
this.state.detail_trans.trans_type_display == 'Pick Up' ? (
<View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.outlet}</Text>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet}</Text> */}
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.outlet_address}</Text>
</View>
) : (
<View style={{ flex: 0.6, justifyContent: 'center' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.recipient_address}</Text>
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.recipient_address_name}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.state.detail_trans.recipient_address}</Text>
</View>
)
......@@ -179,29 +182,35 @@ class OrderDetail extends React.Component {
}
</View>
<View style={{ margin: 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>
{
this.state.transaction_detail.map((item, index) => {
// total = total + item.quantity * item.price
return (
<View style={{ margin: 10 }} key={index} >
<View style={{ flex: 1, margin: 10, flexDirection: 'row', justifyContent: 'space-around' }}>
<View style={{ flex: 0.3, alignItems: 'center' }}>
{/* <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={''} />
</View>
<View style={{ flex: 0.1, alignItems: 'flex-start' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>x</Text>
</View>
<View style={{ flex: 0.3, alignItems: 'baseline' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{item.item_name} </Text>
</View>
<View style={{ flex: 0.3, alignItems: 'flex-end' }}>
{/* <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>
</View>
{
item.item_code == 'GRAB-DELIVERY' ? (
null
) : (
<View style={{ flex: 1, margin: 10, flexDirection: 'row', justifyContent: 'space-around' }}>
<View style={{ flex: 0.3, alignItems: 'center' }}>
{/* <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={''} />
</View>
<View style={{ flex: 0.1, alignItems: 'flex-start' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>x</Text>
</View>
<View style={{ flex: 0.3, alignItems: 'baseline' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>{item.item_name} </Text>
</View>
<View style={{ flex: 0.3, alignItems: 'flex-end' }}>
{/* <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>
</View>
)
}
</View>
)
})
......@@ -228,72 +237,84 @@ class OrderDetail extends React.Component {
</>
)
} */}
<View style={{ borderTopWidth: 1, borderColor: 'grey', margin: 10, paddingLeft: 10, padding: 20, paddingBottom: -10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Payment</Text>
<View style={{ borderTopWidth: 1, borderColor: 'grey', marginHorizontal: 10 }}>
<View style={{ paddingLeft: 10, paddingTop: 10 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>PAYMENT</Text>
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', margin: 10, marginTop: -10 }}>
<View style={{ margin: 10, paddingLeft: 10 }}>
<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' }}>Balance Used</Text>
</View>
<View style={{ margin: 10, paddingRight: 5 }}>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{this.state.detail_trans.trans_paid}</Text> */}
<NumberFormat decimalScale={0} value={this.state.detail_trans.trans_paid} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<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={{ flexDirection: 'row', justifyContent: 'space-between', margin: 10, marginTop: -10 }}>
<View style={{ margin: 10, paddingLeft: 10 }}>
<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' }}>Point Used</Text>
</View>
<View style={{ margin: 10, paddingRight: 5 }}>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{this.state.detail_trans.point_booked}</Text> */}
<NumberFormat decimalScale={0} value={this.state.detail_trans.point_booked} 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', margin: 10, paddingLeft: 10, padding: 20, paddingBottom: -10, flexDirection: 'row', justifyContent: 'space-between', flex: 1, flexDirection: 'row' }}>
<View style={{ flex: 0.6 }}>
<View style={{ marginTop: 5, borderTopWidth: 1, borderColor: 'grey', marginHorizontal: 10, flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}>
<View style={{ flex: 0.5, marginLeft: 10, marginVertical: 5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Harga</Text>
</View>
<View style={{ flex: 0.4, marginRight: -5 }}>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10 }}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'right' }}>{this.state.detail_trans.trans_subtotal}</Text> */}
<NumberFormat decimalScale={0} value={this.state.detail_trans.trans_subtotal} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', textAlign: 'right' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
</View>
{
this.state.detail_trans.trans_discount == '' ? (
null
) : (
<View style={{ margin: 10, marginTop: -10, paddingLeft: 10, padding: 20, paddingBottom: -10, flexDirection: 'row', justifyContent: 'space-between', flex: 1, flexDirection: 'row' }}>
<View style={{ flex: 0.6 }}>
this.state.detail_trans != '' ? (
this.state.detail_trans.used_reward.length ? (
<View style={{flexDirection: 'row', justifyContent: 'space-between', flex: 1, marginHorizontal: 10}}>
<View style={{ flex: 0.5, marginLeft: 10, marginVertical: 5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Voucher</Text>
</View>
<View style={{ flex: 0.4, marginRight: -5 }}>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10}}>
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'right' }}>- {this.state.detail_trans.trans_discount}</Text> */}
<NumberFormat decimalScale={0} value={this.state.detail_trans.trans_discount} 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={this.state.detail_trans.used_reward[0].reward.value} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', textAlign: 'right' }}>- Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
</View>
)
) :(null)
) : (null)
}
{/* {
this.props.type_pickup == true ? (
null
) : (
<View style={{ margin: 10, marginTop: -10, paddingLeft: 10, padding: 20, paddingBottom: -10, flexDirection: 'row', justifyContent: 'space-between', flex: 1, flexDirection: 'row' }}>
<View style={{ flex: 0.6 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>Ongkos Kirim</Text>
{
this.state.detail_trans != '' ? (
this.state.detail_trans.trans_type == 2 ? (
<View style={{flexDirection: 'row', justifyContent: 'space-between', flex: 1, marginHorizontal: 10}}>
<View style={{ flex: 0.5, marginLeft: 10, marginVertical: 5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>Ongkis kirim</Text>
</View>
<View style={{ flex: 0.4, marginRight: -5 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', textAlign: 'right' }}>{this.props.grabamount}</Text>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10}}>
{
this.state.detail_trans.transaction_detail.map((item,index) => {
// 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={this.state.detail_trans.trans_discount} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey', textAlign: 'right' }}>- Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> */}
</View>
</View>
)
} */}
<View style={{ margin: 10, marginTop: -10, paddingLeft: 10, padding: 20, paddingBottom: -10, flexDirection: 'row', justifyContent: 'space-between', flex: 1, flexDirection: 'row' }}>
<View style={{ flex: 0.6 }}>
<Text style={{ fontSize: 15, fontFamily: 'Gotham-Black', color: '#CFB368' }}>Total</Text>
) :(null)
) : (null)
}
<View style={{flexDirection: 'row', justifyContent: 'space-between', flex: 1, marginHorizontal: 10, marginTop:5}}>
<View style={{ flex: 0.5, marginLeft: 10, marginVertical: 5 }}>
<Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#CFB368' }}>Total</Text>
</View>
<View style={{ flex: 0.4, marginRight: -5 }}>
<View style={{ flex: 0.5, marginVertical: 5, alignItems: 'flex-end', marginRight: 10}}>
{/* <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>{this.state.detail_trans.trans_total}</Text> */}
<NumberFormat decimalScale={0} value={this.state.detail_trans.trans_total} renderText={value => <Text style={{ fontSize: 15, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<NumberFormat decimalScale={0} value={this.state.detail_trans.point_reduce} renderText={value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', textAlign: 'right', color: '#CFB368' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
</View>
{
......@@ -347,15 +368,16 @@ const styles = StyleSheet.create({
},
header: {
justifyContent: 'center',
flex: 0.2,
flex: 0.1,
borderBottomWidth: 1,
borderColor: 'grey',
margin: 10
borderColor: '#838383',
marginHorizontal: 10,
padding: 10
},
body: {
flex: 0.8,
margin: 5,
margin: 0,
},
list_detail_order: {
flex: 1,
......@@ -394,7 +416,7 @@ const styles = StyleSheet.create({
},
button2: {
backgroundColor: '#CFB368',
padding:20,
padding: 20,
borderRadius: 10,
paddingVertical: 5,
alignItems: 'center',
......
......@@ -44,7 +44,7 @@ class OrderHistory extends React.Component {
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/list', params).then(res => {
let data = res.data.data
console.log(data)
// console.log(data)
this.setState({
order_list: data,
indicator: false,
......@@ -79,7 +79,7 @@ class OrderHistory extends React.Component {
<Text style={{ fontFamily: 'Gotham-Light', color: 'grey', fontSize: 12, margin: 2 }}>{moment(item.trans_time).format("DD MMMM YYYY, hh:mm A")}</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 12, margin: 2 }}>{item.trans_type_display}</Text>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Order Detail', { idTrans: item.id })}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', justifyContent: 'center', marginTop:10 }}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', justifyContent: 'center', marginVertical:5 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 12, textAlign: 'center',paddingHorizontal:5}}>Lihat Detail Pemesanan</Text>
</View>
</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