<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/service-providers/new" class="btn btn-primary">Add Provider</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>Service</th><th>Rating</th><th>Contact</th><th>Created</th><th></th></tr>
      </thead>
      <tbody>
        <% providers.forEach(function(p) { %>
        <tr>
          <td><%= p.name %></td>
          <td><%= p.serviceKey || '—' %></td>
          <td><%= p.rating %> (<%= p.reviewsCount %>)</td>
          <td><%= p.contactPhone || '—' %></td>
          <td><%- include('../../partials/adminDateTime', { value: p.createdAt }) %></td>
          <td>
            <div class="btn-list flex-nowrap">
              <a href="/admin/service-providers/<%= p.id %>/edit" class="btn btn-sm btn-action-icon" title="Edit"><i class="ti ti-pencil"></i></a>
              <form action="/admin/service-providers/<%= p.id %>/delete" method="post" class="d-inline delete-form"
                data-delete-title="Delete service provider?"
                data-delete-message="This will permanently remove &quot;<%= p.name %>&quot; from the services directory."
                data-delete-consequences="Provider removed from mobile Services module|Contact and rating data deleted|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>
