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

{% block title %}Caisses{% endblock %}
{% block header-title %}Caisses{% endblock %}

{% block fixed %}

<aside>
  <div class="heading">
    {{ checkouts|length }}
    <span class="sub">caisse{{ checkouts|length|pluralize }}</span>
  </div>
</aside>

<div class="buttons">
  <a class="btn btn-primary" href="{% url 'kfet.checkout.create' %}">
    <span class="glyphicon glyphicon-plus"></span>
    <span>Créer une caisse</span>
  </a>
</div>

{% endblock %}

{% block main %}

<div class="table-responsive">
  <table class="table table-hover table-condensed">
    <thead>
      <tr>
        <td>Nom</td>
        <td class="text-right">Balance</td>
        <td class="text-right">Déb. valid.</td>
        <td class="text-right">Fin valid.</td>
        <td class="text-right">Protégée</td>
      </tr>
    </thead>
    <tbody>
      {% for checkout in checkouts %}
      <tr>
        <td>
          <a href="{% url 'kfet.checkout.read' checkout.pk %}">
            {{ checkout.name }}
          </a>
        </td>
        <td class="text-right">{{ checkout.balance}}€</td>
        <td class="text-right">{{ checkout.valid_from }}</td>
        <td class="text-right">{{ checkout.valid_to }}</td>
        <td class="text-right">{{ checkout.is_protected|yesno }}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>

{% endblock %}
