{% extends "SsoBackendBundle:token:base.html.twig" %}
{# % form_theme filterForm ':Forms:bootstrap.layout.html.twig' % #}
{% block title %}{{ parent() }} - Index{% endblock %}

{% block body %}
    <br/><br/>
    <a class="btn btn-success btn-xs" href="{{ path('_admin_backend_servicetoken_index') }}">Back to main
        overview</a></td>

    <br/><br/>

    {% if assignableServicesCount > 0 %}
        {{ form_start(assignForm) }}
        {{ form_label(assignForm.service) }} <br/>
        {{ form_widget(assignForm.service) }} {{ form_widget(assignForm.submit) }}
        {{ form_end(assignForm) }}
        <br/><br/>
    {% else %}
        <div class="panel panel-default">
            <div class="panel-heading">All available services have been assigned to this Service Group Name</div>
        </div>
    {% endif %}

    <br/>

    <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.ServiceType') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Service Type', 'a.ServiceType') }}</th>
            <th {% if pagination.isSorted('a.ServiceController') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Service Controller', 'a.ServiceController') }}</th>
            <th {% if pagination.isSorted('a.ServiceAction') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Service Action', 'a.ServiceAction') }}</th>
            <th {% if pagination.isSorted('a.ServiceMapped2Group') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Service Mapped To Group', 'a.ServiceMapped2Group') }}</th>
            <th>&nbsp;</th>
        </tr>
        </thead>
        <tbody>
        {% for entity in pagination %}
            <tr>
                <td>{{ entity.ServiceType }}</td>
                <td>{{ entity.ServiceController }}</td>
                <td>{{ entity.ServiceAction }}</td>
                <td>{{ entity.ServiceMapped2Group }}</td>
                <td><a class="btn btn-danger btn-xs"
                       href="{{ path('_admin_backend_servicetoken_delete_service', {'ServiceId': entity.ServiceId, 'ServiceNameId': serviceName.ServiceNameId}) }}">Remove</a>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    <div class="navigation">
        {{ knp_pagination_render(pagination) }}
    </div>

    <style>
        th.sorted > a.desc:before {
            content: "\2191";
            padding-right: 3px;
            margin-top: -5px;
            font-size: 18px;
            color: #000;
            text-decoration: none;
            font-weight: bold;
        }

        th.sorted > a.asc:before {
            content: "\2193";
            padding-right: 3px;
            margin-top: -5px;
            font-size: 18px;
            color: #000;
            text-decoration: none;
            font-weight: bold;
        }
    </style>
{% endblock %}
