<%- include('partials/header', { title }) %>

<h1 class="title">Pending approvals</h1>

<% if (pendingUsers.length === 0) { %>
<p class="has-text-grey">No pending accounts.</p>
<% } else { %>
<table class="table is-fullwidth is-striped">
  <thead>
    <tr>
      <th>Username</th>
      <th>Requested</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% pendingUsers.forEach((user) => { %>
    <tr>
      <td><%= user.username %></td>
      <td><%= new Date(user.created_at).toLocaleDateString() %></td>
      <td>
        <form method="post" action="/admin/users/<%= user.id %>/approve">
          <button class="button is-small is-success" type="submit">Approve</button>
        </form>
      </td>
    </tr>
    <% }) %>
  </tbody>
</table>
<% } %>

<%- include('partials/footer') %>
