//plugin import React, { Component } from "react"; import Text from "react-native-text"; import { View, FlatList, TouchableOpacity, StyleSheet,Linking } from "react-native"; import Icon from "react-native-vector-icons/dist/Ionicons"; import { observer, inject } from "mobx-react/native"; import FastImage from "react-native-fast-image"; import { width, height } from "../../config/screen"; import { scale, verticalScale, moderateScale } from "react-native-size-matters"; // function import Size from "../../config/size"; import theme from "../../config/colors"; import { Fonts } from "../../config/fonts"; var size = new Size(); @inject(["menuStore"], ["userStore"]) @observer export default class OrderListItems extends Component { constructor(props) { super(props); this.store = this.props.menuStore; this.userStore = this.props.userStore; } foodName() { var name = ""; if (this.props.items.items.length == 1) { name = this.props.items.items[0].menu.cuisine.name; } else { this.props.items.items.forEach(element => { name += element.menu.cuisine.name + ", "; }); } return name; } linkToEmail(){ Linking.openURL('mailto:support@hangryfood.co?subject=&body=') } food(items) { return ( Food name {this.userStore.dataLanguage( items.menu.cuisine, "name" )} Restauant {this.userStore.dataLanguage( items.menu.cuisine.restaurant, "name" )} Qty. {items.qty} Price {"$"+items.price} Subtatal { "$"+items.price*items.qty} ); } discountHandle(){ if(this.props.items.discount >0){ return( {"- "+this.props.items.discount} ) }else{ return( N/A ) } } clickAction() { if(this.props.whichOrder){ this.store.goOrderDetail(this.props.items,this) } //this.props.navigation.navigate("OrderDetails", { data: this.props.items }); } go(data,time){ this.props.navigation.navigate("OrderDetails", { data: data, time: time }); } render() { console.log("show up " + this.props.items.status); if (this.props.items.status != "E") { return ( this.clickAction()} style={{ flexDirection: "row" }} > Order details {"Order No: " + this.props.items.id} {this.props.items.items.map((items, key) => { return {this.food(items)}; })} Pick up Point {this.userStore.dataLanguage( this.props.items.pickUpLocation, "name" )} Discount {this.discountHandle()} Total HKD$ {this.props.items.payAmount} Status {size.status(this.props.items.status)} this.linkToEmail()} style={{ backgroundColor: theme.mainColor, alignItems: "center", justifyContent: "center", marginLeft:20, width: scale(80), height: verticalScale(20), borderRadius: 4, marginBottom: 5 }} > contact us ); } else { return null; } } } const styles = StyleSheet.create({ textView: { marginLeft: 20, fontFamily: Fonts.century, marginBottom: 5 } });