{% trans_default_domain 'FOSUserBundle' %}

<div class="container fos_user_list"
     style="margin-top: 2.5vmin;">
    <div class="col-lg-12"
         style="font-size: 2.5vmin; margin-bottom: 1vmin;">
        <strong>Users</strong>
        <a style="display: inline-block; margin-left: 2vmin; color: #428bca; cursor: pointer;" data-toggle="modal" data-target="#new-user-modal" href="#">
            <span class="glyphicon glyphicon-plus"></span>
        </a>
    </div>
    <div class="table-responsive col-lg-12">
        <table class="table table-striped table-hover">
            <thead>
                <tr>
                    <th class="col-md-4">Worker name</th>
                    <th class="col-md-2">Username</th>
                    <th class="col-md-6">Access groups</th>
                </tr>
            </thead>
            <tbody>
            {% for user in users %}
                <tr style="cursor: pointer;"
                    onclick="location.href='{{ path('vgm_user_show_edit', {'username': user.username} ) }}'">
                    <td>
                        {{ user.getWorker() }}
                    </td>
                    <td>
                        {{ user.username }}
                    </td>
                    <td>
                        {% set groups_length = user.getGroups() | length %}
                        {% for group in user.getGroups() %}
                            {{ group }}
                            {% if groups_length > loop.index  %}
                                |
                            {% endif %}
                        {% endfor %}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
    {% include "FOSUserBundle:User:new_content.html.twig" %}
</div>