{% extends "kfet/base_col_2.html" %}

{% block title %}Categories d'articles{% endblock %}
{% block header-title %}Categories d'articles{% endblock %}

{% block fixed %}

<aside>
  <div class="heading">
    {{ categories|length }}
    <span class="sub">catégorie{{ categories|length|pluralize }}</span>
  </div>
</aside>

{% endblock %}

{% block main %}

<div class="table-responsive">
  <table
      class="table table-hover table-condensed sortable"
      {# Initial sort: [(name,asc)] #}
      data-sortlist="[[0,0]]">
    <thead>
      <tr>
        <td>Nom</td>
        <td class="text-right">Nombre d'articles</td>
        <td class="text-right" data-sorter="yesno">Peut être majorée</td>
        <td class="text-right" data-sorter="yesno">Réduction COF appliquée</td>
      </tr>
    </thead>
    <tbody>
      {% for category in categories %}
      <tr>
        <td>
          <a href="{% url 'kfet.category.update' category.pk %}">
            {{ category.name }}
          </a>
        </td>
        <td class="text-right">{{ category.articles.all|length }}</td>
        <td class="text-right">{{ category.has_addcost | yesno:"Oui,Non"}}</td>
        <td class="text-right">{{ category.has_reduction | yesno:"Oui,Non"}}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>

{% endblock %}
