Add unit tests for backend and refactor few things on frontend
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import React, {Component} from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import OrderListItem from './OrderListItem.jsx';
|
||||
import {WiaasTable, WiaasTableHeader, WiaasTableBody} from '../../../mainComponents/table/WiaasTable.jsx';
|
||||
import {orderTexts} from '../../../constants/ordersConstants';
|
||||
@@ -34,7 +33,7 @@ class OrderList extends Component {
|
||||
''
|
||||
];
|
||||
|
||||
if(this.props.isCompanyAdmin && this.props.isViewAllOrdersChecked[type]) {
|
||||
if(this.props.showOrderCustomer) {
|
||||
activeOrdersHeader.splice(2, 0, orderTexts.headers.PLACED_BY);
|
||||
activeOrdersHeader.join();
|
||||
historyOrdersHeader.splice(2, 0, orderTexts.headers.PLACED_BY);
|
||||
@@ -45,7 +44,7 @@ class OrderList extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const {orders, type, isCompanyAdmin, isViewAllOrdersChecked} = this.props;
|
||||
const {orders, type} = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -53,11 +52,7 @@ class OrderList extends Component {
|
||||
<WiaasTableHeader headers={this.getHeadersByType(type)}/>
|
||||
<WiaasTableBody>
|
||||
{
|
||||
orders &&
|
||||
orders.map((order, index) =>
|
||||
(order.isMyOrder || (isCompanyAdmin && isViewAllOrdersChecked[type])) &&
|
||||
<OrderListItem key={order.id} order={order} type={type} />
|
||||
)
|
||||
orders.map(order => <OrderListItem key={order.id} order={order} type={type} />)
|
||||
}
|
||||
</WiaasTableBody>
|
||||
</WiaasTable>
|
||||
@@ -65,9 +60,4 @@ class OrderList extends Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
isCompanyAdmin: true, //state.auth.isCompanyAdmin,
|
||||
isViewAllOrdersChecked: state.ordersReducer.isViewAllOrdersChecked
|
||||
});
|
||||
export default connect(mapStateToProps)(OrderList);
|
||||
export default OrderList;
|
||||
|
||||
@@ -64,7 +64,7 @@ class OrderPackage extends Component {
|
||||
<div className="package-name">{orderPackage.quantity} x {orderPackage.name}</div>
|
||||
</WiaasTableCol>
|
||||
<WiaasTableCol header="Price">
|
||||
{this.calculateQuantityPrice(orderPackage.quantity, orderPackage.price).toLocaleString()} {orderPackage.packageCurrency && orderPackage.packageCurrency.currency} {' '}
|
||||
{this.calculateQuantityPrice(orderPackage.quantity, orderPackage.price).toLocaleString()} {order.currency} {' '}
|
||||
({orderPackage.paymentType})
|
||||
</WiaasTableCol>
|
||||
<WiaasTableCol header="Services and support">
|
||||
|
||||
Reference in New Issue
Block a user