| {% extends '::base.html.twig' %}
{% block title %} {{ app.session.get('user_full_name') }} {% endblock %}
{% block content %}
    {% if success is defined and success is not null and success == true %}
        <div class="nNote nSuccess">
            <p>{{ 'action_success'|trans }}</p>
        </div>
    {% endif %}
    {% if success is defined and success is not null and success == false %}
        <div class="nNote nFailure">
            <p>{{ 'action_error'|trans }}</p>
        </div>
    {% endif %}
    {% if can_add == false %}
        <div class="nNote nWarning">
            <p>{{ 'user_limit_reached'|trans }}</p>
        </div>
    {% endif %}
    {% if can_add == true and app.session.get('demo') == false %}
        <input type="button" onclick="location.href='{{ path('admin_user_add') }}';" class="buttonM bRed" style="margin-top: 30px;" value="{{ 'add_new_user'|trans }}"/>
    {% endif %}
    <div class="fluid">
        <div class="widget grid12">
            <div class="whead"><h6><span class="icon-users"></span>{{ 'system_users'|trans }}</h6>
                <div class="clear"></div>
            </div>
            <table cellpadding="0" cellspacing="0" width="100%" class="tDefault">
                <thead>
                <tr>
                    <td>{{ 'role'|trans }}</td>
                    <td>{{ 'username'|trans }}</td>
                    <td>{{ 'full_name'|trans }}</td>
                    <td>{{ 'last_seen'|trans }}</td>
                    <td>{{ 'actions'|trans }}</td>
                </tr>
                </thead>
                <tbody>
                {% if users|length > 0 %}
                    {% for u in users %}
                        <tr>
                            <td class="center-text">
                                {% if u.isAdmin == true %}
                                    <span class="label label-success" style="margin-left: 10px;">{{ 'admin'|trans }}</span>
                                {% else %}
                                    <span class="label label-warning" style="margin-left: 10px;">{{ 'user'|trans }}</span>
                                {% endif %}
                            </td>
                            <td>
                                <a href="{{ path('admin_user_view', {'user_id': u.userId}) }}">{{ u.userName }}</a>
                            </td>
                            <td>{{ u.fullName }}</td>
                            <td>{{ u.sessionTimestamp|date }}</td>
                            <td class="center-text">
                                <div class="btn-group rightdd" style="display: inline-block; margin-bottom: -4px;">
                                    <button class="buttonS bLightBlue floatL" onClick="location.href='{{ path('admin_user_view', {'user_id': u.userId}) }}';">{{ 'show'|trans }}</button>
                                    <button class="buttonS bLightBlue dropdown-toggle" data-toggle="dropdown">
                                        <span class="caret"></span></button>
                                    <ul class="dropdown-menu">
                                            <li>
                                                {% if app.session.get('user_id') != u.userId %}
                                                    <a href="javascript:void(0);" onClick="if (confirm('{{ 'are_you_sure'|trans }}')) { location.href = '{{ path('admin_user_delete', {'user_id': u.userId}) }}'; }"><span class="icos-trash"></span>{{ 'delete'|trans }}</a>
                                                {% endif %}
                                            </li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                    {% endfor %}
                {% else %}
                    <div style="text-align: center; padding: 20px 0;">{{ 'no_records_found'|trans }}</div>
                {% endif %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}
 |