{% extends "SsoBackendBundle:Token:base.html.twig" %}
{% block title %}
    IdP User Manager
{% endblock %}

{% block body %}
    <h2>IDP User</h2>
    <div class="row">
        <div class="col-md-12 col-ld-12" style="text-align: right;">
            {% if userBlockingEnabled %}
                User blocking is <strong style="color: green;">online</strong> -
                                                                               maxLoginFails: <strong>{{ maxLoginFails }}</strong> -
                                                                                                                                   clearTimeSec: <strong>{{ clearTimeSec }}</strong>
            {% else %}
                User Blocking is <strong style="color: red;">offline</strong>
            {% endif %}
        </div>
        <div class="col-md-12 col-ld-12">
            <a class="btn btn-primary dropdown-toggle" data-toggle="collapse" data-target="#filters">
                show filter
                <span class="caret"></span>
            </a>
            <a class="btn btn-primary likepaginator" href="{{ path('_admin_backend_webservice_user_new') }}">
                new User
            </a>
            <a class="btn btn-primary likepaginator" href="{{ path('_admin_backend_webservice_user_configure') }}">
                CSV User Update
            </a>
        </div>
        <div class="col-md-12 col-ld-12">
            <div id="filters" class="collapse">
                <form class="well" action="{{ path('_admin_backend_webservice_user') }}" method="get" {{ form_enctype(filterForm) }}>
                    {{ form_widget(filterForm) }}
                    <p>
                        <button class="btn btn-success" type="submit" name="filter_action" value="filter">filter</button>
                        <button class="btn btn-danger" type="submit" name="filter_action" value="reset">reset</button>
                    </p>
                </form>
            </div>
        </div>
    </div>
    <hr />
    <div class="row">
        <div class="col-md-12 col-ld-12">
            <table class="table table-striped table-bordered table-condensed">
                <thead>
                <tr>
                    <th>Guid</th>
                    <th>Status</th>
                    <th>Username</th>
                    <th>Email</th>
                    <th>Firstname</th>
                    <th>Lastname</th>
                    <th width="100px">created</th>
                    <th width="100px">updated</th>
                    <th width="100px">referencesAt</th>
                    <th>fails</th>
                    <th>Actions</th>
                </tr>
                </thead>
                <tbody>
                {% for entity in entities %}
                    <tr>
                        <td class="infinitely-tooltip">
                            <span class="cutstring"><a class="tt" data-toggle="tooltip" data-placement="top" data-html="1" title="Guid: {{ entity.Guid|e }}<br />Id: {{ entity.id|e }}" href="{{ path('_admin_backend_webservice_user_show', { 'userId': entity.id }) }}">{{ entity.Guid }}</a></span>
                        </td>
                        <td>
                            {% if entity.active == 1 %}
                                <div class="label label-success">Active</div>
                            {% else %}
                                <div class="label label-warning">Inactive</div>
                            {% endif %}
                            <br>
                            {% if entity.deleted == 1 %}
                                <div class="label label-danger">DELETED</div>
                            {% else %}
                                &nbsp;
                            {% endif %}</td>
                        <td>{{ entity.Username }}</td>
                        <td>{{ entity.Email }}</td>
                        <td>{{ entity.Firstname }}</td>
                        <td>{{ entity.Lastname }}</td>
                        <td>{% if entity.createdAt %}{{ entity.createdAt|date('Y-m-d H:i:s') }}{% endif %}</td>
                        <td>{% if entity.updatedAt %}{{ entity.updatedAt|date('Y-m-d H:i:s') }}{% endif %}</td>
                        <td>{% if entity.updatedReferencesAt %}{{ entity.updatedReferencesAt|date('Y-m-d H:i:s') }}{% endif %}</td>
                        <td>{{ entity.LoginFails }}</td>
                        <td>
                            <a class="btn btn-success btn-xs" href="{{ path('_admin_backend_webservice_user_show', { 'userId': entity.id }) }}">
                                show
                            </a>&nbsp;
                            <a class="btn btn-danger btn-xs" href="{{ path('_admin_backend_webservice_user_edit', { 'userId': entity.id }) }}">
                                edit
                            </a>            </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>

        <div class="col-md-12 col-ld-12">
            {{ pagerHtml|raw }}
        </div>

        <div class="col-md-12 col-ld-12">
            <a class="btn btn-primary likepaginator" href="{{ path('_admin_backend_webservice_user_new') }}">
                new User
            </a>
            <a class="btn btn-primary likepaginator" href="{{ path('_admin_backend_webservice_user_configure') }}">
                CSV Import Users
            </a>
        </div>
    </div>

    <script>
        $(function() {
            $(".tt").tooltip();
        });
    </script>

{% endblock %}
