{% extends "stg_inv.html" %}
{% block title %}Batch Inventory Summary{% endblock %}
{% block body %}
<p><a href="/">&larr;Hachoir</a></p>
<p><a href="{% url 'stg_index' %}">&larr;Staging</a></p>
<h1>StagingTable Inventory</h1>

<h3>Filters</h3>
<ul>
    <li>State: {{ state_abbr }} {% if state_abbr != "all" %}<a href="{% url 'djhcup_staging.views.obj_inventory' obj_type='StagingTable' state_abbr="all" year=year %}">(drop filter&rarr;)</a>{% endif %}</li>
    <li>Year: {{ year }} {% if year != "all" %}<a href="{% url 'djhcup_staging.views.obj_inventory' obj_type='StagingTable' state_abbr=state_abbr year="all" %}">(drop filter&rarr;)</a>{% endif %}</li>
</ul>

<h2>Tables</h2>
{% if objects|length > 0 %}
    {% regroup objects by state as st_grouped %}
    <ul>
        {% for st in st_grouped %}
        <li><a href="{% url 'djhcup_staging.views.obj_inventory' obj_type='StagingTable' state_abbr=st.grouper year=year %}">{{ st.grouper }}</a>
        <ul>
            {% regroup st.list by year as yr_grouped %}
            {% for yr in yr_grouped %}
                <li><a href="{% url 'djhcup_staging.views.obj_inventory' obj_type='StagingTable' state_abbr=state_abbr year=yr.grouper %}">{{ yr.grouper }}</a>
                <ul>{% for tbl in yr.list %}
                        <!-- Details/display for each StagingTable object -->
                        <li><a href="{{ tbl.get_absolute_url }}">{{ tbl }}</a></li>
                    {% endfor %}
                </ul>
                </li>
            {% endfor %}
        </ul>
        </li>
        {% endfor %}
    </ul>
{% else %}
<p>No StagingTables.</p>
{% endif %}


{% endblock %}
