{% extends "ClarolineCoreBundle:Administration:layout.html.twig" %}

{% block title %}{{ parent() ~ ' - ' ~ 'roles_management' | trans({}, 'platform') | striptags | raw }}{% endblock %}

{% block breadcrumb %}
    {{
        macros.breadcrumbs([
            {
                'icon': 'fa fa-cog',
                'name': 'administration'|trans({}, 'platform'),
                'href': path('claro_admin_index')
            },
            {
                'name': 'roles_management'|trans({}, 'platform'),
                'href': path('claro_admin_roles_index')
            },
            {
                'name': 'role_list'|trans({}, 'platform'),
                'href': ''
            },
        ])
    }}
{% endblock %}

{% block section_content %}
    <div class="panel-heading">
        <h3 class="panel-title">{{ 'role_list'|trans({}, 'platform') }}</h3>
    </div>
    <div class="panel-body">
        <table class="table table-striped table-bordered table-condensed" id="group-table">
            <thead>
            <tr>
                <th> {{ 'name'|trans({}, 'platform') }} </th>
                <th> {{ 'users'|trans({}, 'platform') }}</th>
                <th> {{ 'limit'|trans({}, 'platform') }} </th>
                <th> {{ 'add'|trans({}, 'platform') }}</th>
                <th> {{ 'initialize'|trans({}, 'platform') }}</th>
                <th> {{ 'delete'|trans({}, 'platform') }}</th>
            </tr>
            </thead>
            <tbody id="role-table-body">
                {% for role in roles %}
                    {% set countRole = 0 %}
                    {% for name, count in counts %}
                        {% if name == role.getName() %}
                            {% set countRole = count %}
                        {% endif %}
                    {% endfor %}
                    {% include "ClarolineCoreBundle:Administration\\Roles:renderRoleRow.html.twig"
                        with {'role': role, 'count': countRole}
                    %}
                {% endfor %}
            </tbody>
        </table>
    </div>
    <div class="panel-footer">
        <button id="create-role-btn" class="btn btn-primary">
            {{ 'create'|trans({}, 'platform') }}
        </button>
        <a class="btn btn-default" href="{{ path('claro_admin_roles_index') }}" role="button">
            {{ 'back'|trans({}, 'platform') }}
        </a>
    </div>
{% endblock %}

{% block javascripts %}
    {{ parent() }}
    <script src='{{ asset('bundles/clarolinecore/js/administration/roleList.js') }}' type="text/javascript"></script>
{% endblock %}