{% extends "notes/base.html" %}
{% load tables %}

{% block sidebar %}
{{ block.super }}
{% block sidebar_insert %}{% endblock %}
{% if filters %}
  <h4 class="sidebar-heading mt-4 px-3">Filtrer</h4>
  <ul class="nav flex-column">
  {% for filter in filters %}
  <li role="presentation" class="nav-item">
        <a href="?filter={{filter.parameter_name}}" class="nav-link {% if filter.active %}active{% endif %}">
          {{ filter.title }}
        </a>
    </li>
  {% endfor %}
  </ul>
</div>
{% endif %}
{% endblock %}

{% block page_content %}
  {% block search %}{% endblock %}
  <!-- Table -->
  {% table object_list cols=3 cell_template=table_cell_template header=table_header %}
  {% if is_paginated %}
    <div class="text-center">
      <ul class="pagination">{% with request.GET.filter as filter %}
      {% for num in page_obj.paginator.page_range %}
        <li {% if page_obj.number == num %} class="active" {%endif%}><a href="?{% if filter %}filter={{ filter }}&{%endif%}page={{num}}">{{num}}</a></li>
      {%endfor%}{% endwith %}
      </ul>
    </div>
  {% endif %}
{% endblock %}
