{% extends "nui/_base.html" %}
{% block content %}
    <c-nui.collection_breadcrumb :collection="collection" :project="project" />
    <table class="table table-sm table-data table-hover">
      <thead>
        <tr>
          <th scope="col" style="width:2rem;">
            <input type="checkbox" class="check_all_items"/>
          </th>
          <th scope="col" style="width:2rem;"></th>
          <th scope="col"></th>
          <th scope="col" style="width:2rem;"></th>
        </tr>
      </thead>
      <tbody>
  {% if page_number == 1 %}{# always show sub-collections on first page #}
    {% for child in collection.children %}
    <tr>
      <td><input type="checkbox" class="item_check item_collection" data-collection_id={{child.pk}}/></td>
      <td><i class="bi bi-folder"></i></td>
      <td>
          <a href="{% url "nui:collection" child.pk %}">
              {{child.title}}
          </a>
      </td>
      <td></td>
    </tr>    
    {% endfor %}
  {% endif %}
{% if resources_page %}
  {% for resource in resources_page %}
  <tr>
    <td><input type="checkbox" class="item_check item_resource" data-resource_id="{{resource.pk}}"/></td>
    <td>
        {% if resource.file.should_have_iiif %}
        <i class="bi bi-eye popimage" data-imgsrc="{{resource.file.iiif_m_thumbnail_url}}"></i>
        {% endif %}
    </td>
    <td>
        <a href="{% url "nui:resource" collection.pk resource.pk %}">
            {% if resource.file %}
            {{resource.file.new_filename}}
            {% else %}
            {{resource.title}}
            {% endif %}
        </a>
    </td>
    <td>
      <a download href="{% url "force_download" resource.file.pk %}">
        <i class="bi bi-download"></i>
      </a>
    </td>
  </tr>
  {% endfor %}
{% endif %}
</tbody>
</table>
<c-nui.collection_pager :resource_pages="resource_pages" />
{% endblock content %}