<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/jobs/new" class="btn btn-primary">Add Job</a></div>
  </div>
</div>
<div class="card">
  <%- include('../../partials/adminPaginationTop') %>
  <div class="table-responsive">
    <table class="table table-vcenter card-table">
      <thead>
        <tr><th>Title</th><th>Company</th><th>Location</th><th>Type</th><th>Created</th><th>Status</th><th class="w-1"></th></tr>
      </thead>
      <tbody>
        <% if (jobs.length === 0) { %>
        <tr><td colspan="7" class="text-center text-secondary">No jobs yet</td></tr>
        <% } %>
        <% jobs.forEach(function(job) { %>
        <tr>
          <td><%= job.title %></td>
          <td><%= job.company %></td>
          <td><%= job.location || '—' %></td>
          <td><%= job.jobType %></td>
          <td><%- include('../../partials/adminDateTime', { value: job.createdAt }) %></td>
          <td><span class="badge bg-<%= job.isActive ? 'success' : 'secondary' %>"><%= job.isActive ? 'Active' : 'Inactive' %></span></td>
          <td>
            <a href="/admin/jobs/<%= job._id %>/edit" class="btn btn-sm btn-action-icon btn-outline-primary" title="Edit"><i class="ti ti-pencil"></i></a>
            <form action="/admin/jobs/<%= job._id %>/delete" method="post" class="d-inline delete-form"
              data-delete-title="Delete job listing?"
              data-delete-message="This will permanently remove &quot;<%= job.title %>&quot; at <%= job.company %>."
              data-delete-consequences="Job removed from mobile app and API|Applicants lose access to this listing|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>
          </td>
        </tr>
        <% }); %>
      </tbody>
    </table>
  </div>
  <%- include('../../partials/adminPaginationBottom') %>
</div>
