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

{% block title %}Comptes - Négatifs{% endblock %}
{% block header-title %}Comptes en négatif{% endblock %}

{% block fixed %}

<aside>
  <div class="heading">
    {{ negatives|length }}
    <span class="sub">compte{{ negatives|length|pluralize }} en négatif</span>
  </div>
  <div class="heading">
    {{ negatives_sum|floatformat:2 }}€
    <span class="sub">de négatif total</span>
  </div>
</aside>

{% endblock %}

{% block main %}

<div class="table-responsive">
  <table class="table table-hover table-condensed sortable" {# Initial sort: [(trigramme,asc)] #}
    data-sortlist="[[0,0]]">
    <thead>
      <tr>
        <td class="text-center">Tri.</td>
        <td>Nom</td>
        <td class="text-right">Balance</td>
        <td data-sorter="shortDate">Début</td>
      </tr>
    </thead>
    <tbody>
      {% for neg in negatives %}
      <tr>
        <td class="text-center">
          <a href="{% url 'kfet.account.update' neg.account.trigramme %}">
            {{ neg.account.trigramme }}
          </a>
        </td>
        <td>{{ neg.account.name }}</td>
        <td class="text-right">{{ neg.account.balance|floatformat:2 }}€</td>
        <td title="{{ neg.start }}">
          {{ neg.start|date:'d/m/Y H:i'}}
        </td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>

{% endblock %}