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

{% block title %}Liste des comptes{% endblock %}
{% block content-header-title %}Comptes{% endblock %}

{% block content %}

<div class="row">
  <div class="col-sm-4 col-md-3 col-content-left">
    <div class="content-left">
      <div class="content-left-top">
        <div class="line line-big">{{ accounts|length|add:-1 }}</div>
        <div class="line line-bigsub">compte{{ accounts|length|add:-1|pluralize }}</div>
      </div>
      <div class="buttons">
        <a class="btn btn-primary btn-lg" href="{% url 'kfet.account.create' %}">Créer un compte</a>
        {% if perms.kfet.manage_perms %}
          <a class="btn btn-primary btn-lg" href="{% url 'kfet.account.group' %}">Permissions</a>
        {% endif %}
        {% if perms.kfet.view_negs %}
          <a class="btn btn-primary btn-lg" href="{% url 'kfet.account.negative' %}">Négatifs</a>
        {% endif %}
      </div>
    </div>
  </div>
  <div class="col-sm-8 col-md-9 col-content-right">
    {% include 'kfet/base_messages.html' %}
    <div class="content-right">
      <div class="content-right-block">
        <h2>Liste des comptes</h2>
        <div class="table-responsive">
          <table class="table table-condensed">
            <thead>
              <tr>
                <td></td>
                <td>Trigramme</td>
                <td>Nom</td>
                <td>Balance</td>
                <td>COF</td>
                <td>Dpt</td>
                <td>Promo</td>
              </tr>
            </thead>
            <tbody>
              {% for account in accounts %}
                <tr>
                  <td class="text-center">
                    <a href="{% url 'kfet.account.read' account.trigramme %}">
                      <span class="glyphicon glyphicon-cog"></span>
                    </a>
                  </td>
                  <td>{{ account.trigramme }}</td>
                  <td>{{ account.name }}</td>
                  <td class="text-right">{{ account.balance }}€</td>
                  <td>{{ account.is_cof }}</td>
                  <td>{{ account.departement }}</td>
                  <td>{{ account.promo|default_if_none:'' }}</td>
                </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>

{% endblock %}
