import React, {Component} from 'react';
import {connect} from 'react-redux';
import {Button} from 'reactstrap';
import {Link} from 'react-router-dom';
import {WiaasTableRow, WiaasTableCol} from '../../../mainComponents/table/WiaasTable.jsx';
import {orderTexts} from '../../../constants/ordersConstants';
import '../style/Orders.css';
import OrderPackage from './OrderPackage.jsx';
class ActiveOrderItem extends Component {
constructor(props) {
super(props);
this.state = {
showPackages: false
};
this.toggle = this.toggle.bind(this);
}
toggle() {
this.setState({
showPackages: !this.state.showPackages
});
}
getIconClass(type) {
return 'fa fa-angle-' + type + ' toggle-view-packages';
}
render() {
const {order, isViewAllOrdersChecked} = this.props;
return (
{!this.state.showPackages && }
{this.state.showPackages && }
{order.orderNumber}
{order.reference ? order.reference : '-'}
{isViewAllOrdersChecked['active'] && {order.customerName ? order.customerName : ''}}
{order.orderDate ? order.orderDate : '-'}
{order.estimatedDeliveryDate ? order.estimatedDeliveryDate : '-'}
{order.clContactName}
{order.clName}
{order.orderCurrency && order.orderCurrency.currency
? order.orderTotalPrice.toLocaleString() + ' ' + order.orderCurrency.currency
: parseFloat(order.orderTotalPrice).toLocaleString()}
{order.status}
{ this.state.showPackages &&
}
);
}
}
const mapStateToProps = (state) => ({
isViewAllOrdersChecked: state.ordersReducer.isViewAllOrdersChecked
});
export default connect(mapStateToProps)(ActiveOrderItem);