{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load bootstrap4 %}

{% block title %}
    {% trans "Users" %}
{% endblock %}

{% block content %}
    <div class="page-header">
        <h1>{% trans "Users" %}</h1>
    </div>
    {% if perms.user_management.add_userprofile %}
        <a class="btn btn-secondary" href="{% url "user_management:userprofile_create" %}"><span
                class="fa fa-plus"></span> {% trans "Add user" %}</a>
    {% endif %}
    <table id="userprofile_table" class="table table-striped display datatable">
        <thead>
        <tr>
            <th data-priority="3">{% trans "Last name" %}</th>
            <th data-priority="2">{% trans "First name" %}</th>
            <th data-priority="4">{% trans "Email address" %}</th>
            <th data-priority="5">{% trans "Information" %}</th>
            <th data-priority="1" data-orderable="false">{% trans "Action" %}</th>
        </tr>
        </thead>
        <tbody>
        {% for userprofile in userprofile_list %}
            <tr>
                <td>{{ userprofile.last_name }}</td>
                <td>{{ userprofile.first_name }}</td>
                <td>{{ userprofile.email }}</td>
                <td>{% include "user_management/userprofile_badges.html" with userprofile=userprofile %}</td>
                <td>
                    <a class="btn btn-outline-primary btn-sm" href="{% url "user_management:userprofile_edit" userprofile.pk %}"><span
                            class="fa fa-edit"></span> {% trans "Edit" %}</a>
                    {% if perms.user_management.delete_userprofile %}
                        <a class="btn btn-outline-danger btn-sm" href="{% url "user_management:userprofile_delete" userprofile.pk %}"><span
                                class="fa fa-trash-alt"></span> {% trans "Delete" %}</a>
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}
