{% extends "idhub/base_admin.html" %}
{% load i18n %}

{% block content %}
<h3>
  <i class="{{ icon }}"></i>
  {{ subtitle }}
</h3>
<div class="table-responsive">
  <table class="table table-striped table-sm">
    <thead>
      <tr>
        <th scope="col"><button type="button" class="btn btn-green-admin border border-dark">{% trans 'Last name' %}</button></th>
        <th scope="col"><button type="button" class="btn btn-grey border border-dark">{% trans 'First name' %}</button></th>
        <th scope="col"><button type="button" class="btn btn-grey border border-dark">Username</button></th>
        <th scope="col"><button type="button" class="btn btn-grey border border-dark">{% trans 'Membership' %}</button></th>
        <th scope="col"><button type="button" class="btn btn-grey border border-dark">{% trans 'Role' %}</button></th>
        <th scope="col"></th>
      </tr>
    </thead>
    <tbody>
    {% for user in users %}
      <tr>
        <td>{{ user.last_name }}</td>
        <td>{{ user.first_name }}</td>
        <td>{{ user.username }}</td>
        <td>
          {% for m in user.memberships.all %}
            {{ m.get_type }} 
          {% endfor %}
        </td>
        <td>
          {% for r in user.roles.all %}
            {{ r.service.rol.name }} 
          {% endfor %}
        </td>
        <td><a type="button" class="btn btn-green-admin rounded-pill" href="{% url 'idhub:admin_people' user.id %}">{% trans 'View' %}</td>
      </tr>
    {% endfor %}
    </tbody>
  </table>
</div>
{% endblock %}
