{% extends 'base.html' %}
{% block content %}
  <h1>Cases by size</h1>
  <form method="get" class="mb-3">
    <label>Min size (bytes): <input type="number" name="min_size" value="{{ min_size }}" /></label>
    <button class="btn btn-primary btn-sm">Filter</button>
  </form>
  <table class="table table-sm">
    <thead>
      <tr>
        <th>Case</th>
        <th>Title</th>
        <th>Series</th>
        <th>Images</th>
        <th>Total Size</th>
      </tr>
    </thead>
    <tbody>
      {% for row in page.object_list %}
        <tr>
          <td><a href="{{ row.case.get_absolute_url }}">{{ row.case.pk }}</a></td>
          <td>{{ row.case.title }}</td>
          <td>{{ row.series_count }}</td>
          <td>{{ row.image_count }}</td>
          <td>{{ row.human_total }}</td>
        </tr>
      {% empty %}
        <tr><td colspan="5">No cases</td></tr>
      {% endfor %}
    </tbody>
  </table>
  <nav>
    <ul class="pagination">
      {% if page.has_previous %}
        <li class="page-item"><a class="page-link" href="?page={{ page.previous_page_number }}&min_size={{ min_size }}">Previous</a></li>
      {% endif %}
      <li class="page-item disabled"><span class="page-link">Page {{ page.number }} / {{ page.paginator.num_pages }}</span></li>
      {% if page.has_next %}
        <li class="page-item"><a class="page-link" href="?page={{ page.next_page_number }}&min_size={{ min_size }}">Next</a></li>
      {% endif %}
    </ul>
  </nav>
{% endblock %}
