{% extends "SsoBackendBundle:Token:base.html.twig" %}
{% form_theme filterForm ':Forms:bootstrap.layout.html.twig' %}
{% block title %}
    Backend Logs
{% endblock %}
{% block body %}
    <h2>Logs</h2>
    <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>
            <a class="btn btn-danger" href="{{ path('_life_style_tools_db_log_delete') }}">Delete log</a>
        </div>
        <div class="col-md-12 col-ld-12">
            <div id="filters" class="collapse">
                <form class="well" action="{{ path('_life_style_tools_db_log_overview') }}"
                      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>Date</th>
                    <th>Channel</th>
                    <th>Level</th>
                    <th>Extras</th>
                    <th>Message</th>
                </tr>
                </thead>
                <tbody>
                {% for entity in entities %}
                    <tr>
                        <td class="infinitely-tooltip"
                            style="max-width: 200px; overflow: hidden; text-overflow: ellipsis;">
                            <a class="tt" data-toggle="tooltip" data-placement="top" data-html="1"
                               title="Id: {{ entity.id|e }}" href="#"><span
                                        style="white-space: nowrap">{{ entity.created.format('Y-m-d H:i:s') }}</span></a>
                        </td>
                        <td>{{ entity.channel }}</td>
                        <td>{{ entity.level }}</td>
                        <td>{{ entity.extras }}</td>
                        <td>{{ entity.systemLogData.log|e }}</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">
        </div>
    </div>
    <script>
        $(function () {
            $(".tt").tooltip();
        });
    </script>
{% endblock %}