{% extends "base.html" %}
{% load static %}
{% load django_tables2 %}
{% load crispy_forms_field %}
{% load crispy_forms_tags %}
{% block title %} Browse {{ verbose_name_plural }} {% endblock %}
{% block scriptHeader %}

{% endblock %}
{% block content %}
{% include 'browsing/partials/listview_breadcrumb.html' %}

<div class="container">

    <h1 class="display-5 text-center">{{ h1 }}</h1>
    {% if user.is_authenticated and create_view_link %}
    <div class="d-grid gap-2 pb-2">
        <a class="btn btn-primary float-center ms-5 me-5" href="{{ create_view_link }}">
            Create new {{ verbose_name }}</a>
    </div>
    {% endif %}

    <div class="row">
        <div class="col-md-4">
            <!--Search mask-->
            <h2 class="text-center pb-4 pt-3">Refine Results</h2>
            <form action="." class="uniForm" method="get">
                {% crispy filter.form filter.form.helper %}
                {% include 'browsing/partials/column_selector.html' %}
                <div class="d-grid gap-2 pt-2" aria-label="Search or reset search">
                    <button type="submit" class="btn btn-primary">Submit</button>
                    <a class="btn btn-primary" href=".">Reset</a>
                </div>
            </form>
        </div>
        <div class="col-md-8" id="results">
            {% with table.paginator.count as total %}
            <h2 class="text-center pb-4 pt-3">{{ total }} Result(s)</h2>
            {% endwith %}
            {% block table %}
            {% include 'browsing/partials/table.html' %}
            {% endblock table %}
            {% block pagination.allpages %}
            {% include 'browsing/partials/pagination.html' %}
            {% endblock pagination.allpages %}
            <div class="float-end">
                {% include "browsing/partials/download_menu.html" %}
            </div>
        </div>
    </div>
</div>

{% endblock %}
{% block scripts2 %}
<script src="{% static 'browsing/js/set-form-attributes.js' %}"></script>
<script src="{% static 'browsing/js/filter-for-blank-fields.js' %}"></script>
{% endblock scripts2 %}