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

{% block title %}Groupes de comptes{% endblock %}
{% block content-header-title %}Groupes de 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 text-center">
        <div class="line"></div>
      </div>
      <div class="buttons">
        <a class="btn btn-primary btn-lg" href="{% url 'kfet.account.group.create' %}">Créer un groupe</a>
      </div>
    </div>
  </div>
  <div class="col-sm-8 col-md-9 col-content-right">
    {% include 'kfet/base_messages.html' %}
    <div class="content-right">
      {% for group in groups %}
        <div class="content-right-block">
          <div class="buttons-title">
            <a class="btn btn-primary" href="{% url 'kfet.account.group.update' group.pk %}">
              <span class="glyphicon glyphicon-cog"></span>
            </a>
          </div>
          <h2>{{ group.name }}</h2>
          <div class="row">
            <div class="col-sm-6">
              <h3>Permissions</h3>
              <ul>
                {% for perm in group.permissions.all %}
                  <li>{{ perm.name }}</li>
                {% endfor %}
              </ul>
            </div>
            <div class="col-sm-6">
              <h3>Comptes</h3>
              <ul>
                {% for user in group.user_set.all %}
                  <li>{{ user.profile.account_kfet }}</li>
                {% endfor %}
              </ul>
            </div>
          </div>
        </div>
      {% endfor %}
    </div>
  </div>
</div>

{% endblock %}
