{% extends "SsoBackendBundle:token_usage:base.html.twig" %}

{% block title %}{{ parent() }} - List{% endblock %}

{% block body %}
    <h1>Token Usage</h1>
    <div class="row">
        <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>
        </div>
        <div class="col-md-12 col-ld-12">
            <div id="filters" class="collapse">
                <form class="well" method="get" action="">
                    {{ form_rest(form) }}
                    <p>
                        <button class="btn btn-primary" type="submit" name="filter_action"
                                value="filter">{% trans %}btn.filter{% endtrans %}</button>
                        <button id="reset" class="btn btn-danger" type="submit" name="filter_action"
                                value="reset">{% trans %}btn.reset{% endtrans %}</button>
                    </p>
                </form>
            </div>
        </div>
    </div>
    <hr/>
    <div class="row">
        <div class="col-md-12 col-ld-12">
            <div style="font-size: 20px;margin-bottom: 20px;" class="pull-right">
                <span class="label label-success label-as-badge">count: {{ pagination.getTotalItemCount }}</span>
            </div>
            <table class="table table-striped table-bordered table-condensed">
                <thead>
                <tr>
                    <th {% if pagination.isSorted('a.Date') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Date', 'a.Date') }}</th>
                    <th>Ip</th>
                    <th {% if pagination.isSorted('a.ServiceToken') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'ServiceToken', 'a.ServiceToken') }}</th>
                    <th {% if pagination.isSorted('a.Controller') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Controller', 'a.Controller') }}</th>
                    <th {% if pagination.isSorted('a.Action') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Action', 'a.Action') }}</th>
                    <th>Track-Id</th>
                </tr>
                </thead>
                <tbody>
                {% for entity in pagination %}
                    <tr>
                        <td>{{ entity.Date|date('Y-m-d H:i:s') }}</td>
                        <td>{{ entity.Ip }}</td>
                        <td class="infinitely-tooltip cutstring"><a class="infinitely-tooltip tt" data-toggle="tooltip"
                                                                    data-placement="top"
                                                                    title="Token: {{ entity.ServiceToken|e }}"
                                                                    href="#">{{ entity.ServiceToken }}</a></td>
                        <td>{{ entity.Controller }}</td>
                        <td>{{ entity.Action }}</td>
                        <td>{{ entity.TrackId }}</td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>

        <div class="col-md-12 col-ld-12">
            <div class="navigation">
                {{ knp_pagination_render(pagination) }}
            </div>
        </div>

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

{% endblock %}
