<div class="page-header d-print-none">
  <div class="row align-items-center">
    <div class="col"><h2 class="page-title"><%= title %></h2></div>
    <div class="col-auto ms-auto"><a href="/admin/locations/new" class="btn btn-primary">Add Location</a></div>
  </div>
</div>
<div class="card">
  <%- include('../../partials/adminPaginationTop') %>
  <div class="table-responsive">
    <table class="table table-vcenter card-table">
      <thead>
        <tr><th>Name</th><th>City</th><th>Coordinates</th><th>Created</th><th></th></tr>
      </thead>
      <tbody>
        <% locations.forEach(function(l) { %>
        <tr>
          <td><%= l.name %></td>
          <td><%= l.city %></td>
          <td><%= l.latitude ? l.latitude + ', ' + l.longitude : '—' %></td>
          <td><%- include('../../partials/adminDateTime', { value: l.createdAt }) %></td>
          <td>
            <div class="btn-list flex-nowrap">
              <a href="/admin/locations/<%= l.id %>/edit" class="btn btn-sm btn-action-icon" title="Edit"><i class="ti ti-pencil"></i></a>
              <form action="/admin/locations/<%= l.id %>/delete" method="post" class="d-inline delete-form"
                data-delete-title="Delete location?"
                data-delete-message="This will permanently remove &quot;<%= l.name %>&quot; (<%= l.city %>)."
                data-delete-consequences="Location removed from picker and API|Default city fallback may apply for affected users|Action recorded in Audit Logs with full snapshot">
                <button type="submit" class="btn btn-sm btn-action-icon btn-outline-danger" title="Delete"><i class="ti ti-trash"></i></button>
              </form>
            </div>
          </td>
        </tr>
        <% }); %>
      </tbody>
    </table>
  </div>
  <%- include('../../partials/adminPaginationBottom') %>
</div>
