{% extends 'base.html.twig' %}
{% import "macros/datatables.html.twig" as tables %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/toolbar.html.twig" as toolbar %}
{% import "user/actions.html.twig" as actions %}

{% set columns = {
    'label.name': 'alwaysVisible',
} %}

{% for role in roles %}
    {% set columns = columns|merge({
        (role): 'alwaysVisible text-center',
    }) %}
{% endfor %}

{% set tableName = 'user_admin_permissions' %}

{% block page_title %}{{ 'admin_user.title'|trans }}{% endblock %}
{% block page_actions %}{{ actions.user_permissions('index') }}{% endblock %}

{% block main %}

    {{ tables.data_table_header_options(tableName, columns, {'translationPrefix': ''}) }}

    {% for permission in permissions|sort %}
        <tr>
            <td>{{ permission }}</td>
            {% for role in roles %}
                <td class="text-center">
                    {{ widgets.label_boolean(manager.permission(role, permission)) }}
                </td>
            {% endfor %}
        </tr>
    {% endfor %}

    {{ tables.data_table_footer(permissions) }}

{% endblock %}
