{% extends 'base-margins.html' %}

{% load i18n %}

{% block title %}{% trans 'Użytkownicy' %}{% endblock %}

{% block content2 %}
<div class="mt-3">
    <h5 class="float-left mt-2">{% trans 'Użytkownicy' %}</h5>
    <div class="mb-4 float-right">
        {% if perms.users.add_user %}
            <a href="{% url 'users:user_add' %}" class="btn btn-sm btn-outline-dark">+ {% trans 'Dodaj użytkownika' %}</a>
        {% endif %}
    </div>
</div>
<table class="table">
    <thead>
        <tr>
            <th>{% trans 'Imię i nazwisko' %}</th>
            <th>{% trans 'Nazwa użytkownika' %}</th>
            <th>{% trans 'Grupa' %}</th>
            <th>{% trans 'Aktywny' %}</th>
            <th>{% trans 'Akcje' %}</th>
        </tr>
    </thead>
    <tbody>
    {% for user in users %}
        <tr>
            <td>{{ user.get_full_name }}</td>
            <td>{{ user.username }}</td>
            <td>{{ user.groups.all|join:', ' }}</td>
            <td>{{ user.is_active|yesno }}</td>
            <td><a href="{% url 'users:user_edit' pk=user.pk %}" class="btn btn-xs btn-outline-dark">{% trans 'Edytuj' %}</a></td>
        </tr>
    {% endfor %}
    </tbody>
</table>
{% endblock %}