<%- include('_head') %>
  <h1 style="font-size:24px; margin-bottom:18px;">Customers</h1>

  <div class="panel">
    <div style="overflow-x:auto;">
      <table class="table">
        <thead><tr><th>Customer</th><th>Email</th><th>Phone</th><th>Orders</th><th>Spend</th><th>Joined</th></tr></thead>
        <tbody>
          <% if (customers.length) { customers.forEach(function(u){ %>
            <tr>
              <td><b><%= u.name %></b><%= u.is_admin ? ' <span class="status-tag st-paid">admin</span>' : '' %></td>
              <td><%= u.email %></td>
              <td><%= u.phone || '—' %></td>
              <td><b><%= u.order_count %></b></td>
              <td><b><%= money(u.spend) %></b></td>
              <td style="color:var(--muted);"><%= new Date(u.created_at + 'Z').toLocaleDateString() %></td>
            </tr>
          <% }); } else { %>
            <tr><td colspan="6" style="color:var(--muted); text-align:center; padding:30px;">No customers yet.</td></tr>
          <% } %>
        </tbody>
      </table>
    </div>
  </div>
<%- include('_foot') %>
