diff --git a/client/app/components/Manager/OrderList/index.js b/client/app/components/Manager/OrderList/index.js index 59a28a82..b1eac6b6 100644 --- a/client/app/components/Manager/OrderList/index.js +++ b/client/app/components/Manager/OrderList/index.js @@ -1,71 +1,76 @@ -/** - * - * OrderList - * - */ - import React from 'react'; - import { Link } from 'react-router-dom'; - import { formatDate } from '../../../utils/date'; -const OrderList = props => { +const OrderList = (props) => { const { orders } = props; - const renderFirstItem = order => { + const renderFirstItem = (order) => { if (order.products) { const product = order.products[0].product; return ( product ); } else { - return ; + return placeholder; + } + }; + + const renderAddress = (order) => { + const { address } = order.customer; + if (address) { + return ( +
+ Address: + {`${address.street}, ${address.city}, ${address.state}, ${address.zipCode}`} +
+ ); + } else { + return
No Address Available
; } }; return ( -
+
{orders.map((order, index) => ( -
- -
-
+
+ +
+
{renderFirstItem(order)}
-
-
-
+
+
+
Status {order?.products ? ( - {` ${order?.products[0].status}`} + {` ${order?.products[0].status}`} ) : ( - {` Unavailable`} + Unavailable )}
-
+
Order # - {` ${order._id}`} + {` ${order._id}`}
-
+
Ordered on - {` ${formatDate( - order.created - )}`} + {` ${formatDate(order.created)}`}
-
+
Order Total - {` $${ - order?.totalWithTax ? order?.totalWithTax : 0 - }`} + {` $${order?.totalWithTax ? order?.totalWithTax : 0}`}
+ {/* Render Customer Address */} + {renderAddress(order)}