<%- include('../partials/head',{pageTitle,bodyClass:'admin-shell'}) %><%- include('nav') %><main class="admin-main"><h1>Orders</h1><section class="admin-panel"><table><tr><th>ID</th><th>Customer</th><th>Total</th><th>Status</th><th>Items</th><th>Address</th></tr><% orders.forEach(order=>{ %><tr><td>#<%= order.id %></td><td><strong><%= order.customer_name %></strong><br><small><%= order.customer_email %></small><br><small><%= order.customer_phone %></small></td><td><%= money(order.subtotal) %></td><td><form method="post" action="/admin/orders/<%= order.id %>/status" class="inline-form"><input type="hidden" name="_csrf" value="<%= csrfToken %>"><select name="status"><% ['new','in-progress','confirmed','completed','cancelled'].forEach(s=>{ %><option value="<%= s %>" <%= order.status===s?'selected':'' %>><%= s %></option><% }) %></select><button class="btn btn-secondary">Save</button></form></td><td><% itemsByOrder[order.id].forEach(item=>{ %><div><%= item.product_name %> × <%= item.qty %></div><% }) %></td><td><%= order.customer_address %><% if(order.notes){ %><hr><small><%= order.notes %></small><% } %></td></tr><% }) %></table></section></main></body></html>
