{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% load static %}
{% load wagtailadmin_tags %}

{% block titletag %}{% trans "Block Inventory" %}{% endblock %}

{% block content %}
{% trans "Block Inventory" as header_str %}
{% include "wagtailadmin/shared/header.html" with title=header_str icon="placeholder" %}

<form class="nice-padding" action="{% url 'wagtailinventory:search' %}">
	{{ formset.management_form }}
  {% for form in formset %}
    <div>
      {{ form.has }}
      {{ form.block }}
    </div>
  {% endfor %}
  <input type="submit" value="Find matching pages" style="width: 240px; padding: 10px; margin: 10px 0" />
</form>

<div id="search-results">
  {% if pages %}
    <div class="nice-padding">
      <h2>
        {% blocktrans count counter=pages.paginator.count %}
            There is one match
        {% plural %}
            There are {{ counter }} matches
        {% endblocktrans %}
      </h2>

      {% include "wagtailadmin/pages/listing/_list_explore.html" with show_parent=1 allow_navigation=0 %}
      {% include "wagtailadmin/shared/pagination_nav.html" with items=pages %}
    </div>
  {% else %}
    <div class="nice-padding">
      <h2>
        {% blocktrans %}Sorry, there are no matching pages.{% endblocktrans %}
      </h2>
    </div>
  {% endif %}
</div>
{% endblock %}
