<%- include('../includes/head.ejs') %>
    <link rel="stylesheet" href="/css/orders.css">
    </head>

    <body>
        <%- include('../includes/navigation.ejs') %>
        <main>
            <% if (orders.length <= 0) { %>
                <h1>Nothing there!</h1>
            <% } else { %>
                <ul class="orders">
                    <% orders.forEach(order => { %>
                        <li class="orders__item">
                            <h1>Order - # <%= order._id %></h1>
                            <ul class="orders__products">
                                <% order.products.forEach(p => { %>
                                    <li class="orders__products-item"><%= p.product.title %> (<%= p.quantity %>) - <a href="/orders/<%= order._id %>">Invoice</a></li>
                                <% }); %>
                            </ul>
                        </li>
                    <% }); %>
                </ul>
            <% } %>
        </main>
        <%- include('../includes/end.ejs') %>