{% extends 'iconolab_base.html' %}

{% load staticfiles %}

{% load thumbnail %}

{% load iconolab_tags %}

{% load notifications_tags %}

{% block content %}
  <div id="user-profile-block">
    <h3>Tableau de bord - Fonds {{collection.verbose_name}}</h3>
    <h2><small>Filtres et tri</small></h2>
    <form class="form" method="GET" target="">
      <div class="row">
        <div class="form-group col-md-4">
          <label>Trier par
          </label><br>
          <select id="first_ordering_select" name="first" class="form-control">
            <option id="first_oldest" value="oldest" {% if qarg_first == 'oldest'%}selected{% endif %}>Date (plus vieux d'abord)</option>
            <option id="first_recent" value="recent" {% if qarg_first == 'recent'%}selected{% endif %}>Date (plus récents d'abord)</option>
            <option id="first_most_viewed" value="most_viewed" {% if qarg_first == 'most_viewed'%}selected{% endif %}>Nombre de vues</option>
            <option id="first_most_commented" value="most_commented" {% if qarg_first == 'most_commented'%}selected{% endif %}>Nombre de commentaires</option>
            <option id="first_most_revised" value="most_revised" {% if qarg_first == 'most_revised'%}selected{% endif %}>Nombre de révisions</option>
            <option id="first_most_tagged" value="most_tagged" {% if qarg_first == 'most_tagged'%}selected{% endif %}>Nombre de mots-clés</option>
          </select>
        </div>
        <div class="form-group col-md-6">
          <label>Filtrer par</label><br>
          <b>Mots-clés pertinents:</b> qualification minimale <input type="number" name="min_relevancy" min="0" max="5" {% if qarg_min_relevancy %}value='{{qarg_min_relevancy}}'{% endif %}></input><br>
          <b>Mots-clés fiables:</b> qualification minimale <input type="number" name="min_accuracy" min="0" max="5" {% if qarg_min_accuracy %}value='{{qarg_min_accuracy}}'{% endif %}></input><br>
          <b>Nombre de commentaires:</b> au moins <input type="number" name="min_comments" min="0" {% if qarg_min_comments %}value='{{qarg_min_comments}}'{% endif %}></input><br>
          <b>Nombre de révisions:</b> au moins <input type="number" name="min_revisions" min="0" {% if qarg_min_revisions %}value='{{qarg_min_revisions}}'{% endif %}></input><br>
          <b>Métacatégories:</b><br>
          {% for metacategory in collection.metacategories.all %}
            {% with 'min_metacategory_'|addstr:metacategory.id as mtcg_input_name %}
              au moins <input type="number" name="{{mtcg_input_name}}" min="0" {% if qarg_metacategories_filters %}value='{{qarg_metacategories_filters|get_item:mtcg_input_name}}'{% endif %}></input> {{metacategory.label}}<br>
            {% endwith %}
          {% endfor %}
        </div>
      </div>
      <input class="btn btn-default" type="submit" value="Filtrer"></input>
    </form>
    <h2><small>Listes des annotations</small></h2>
    {% include "partials/image_annotations_list.html" with annotation_list=collection_filtered_annotations collection_name=collection.name show_links=True %}
  </div>
{% endblock %}
