{% extends 'AppBundle:Admin/Connection:layout.html.twig' %}

{% block content %}
    <div class="col-md-10 main">
        <h3>Połączenia</h3>
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                <tr>
                    <th{% if pagination.isSorted('c.loading.id') %} class="sorted"{% endif %}>
                        {{ knp_pagination_sortable(pagination, 'port załadunku', 'c.loading.id') }}
                    </th>
                    <th{% if pagination.isSorted('c.unloading.id') %} class="sorted"{% endif %}>
                        {{ knp_pagination_sortable(pagination, 'port rozładunku', 'c.unloading.id') }}
                    </th>
                    <th{% if pagination.isSorted('c.cost') %} class="sorted"{% endif %}>
                        {{ knp_pagination_sortable(pagination, 'koszt', 'c.cost') }}
                    </th>
                    <th{% if pagination.isSorted('c.validTo') %} class="sorted"{% endif %}>
                        {{ knp_pagination_sortable(pagination, 'termin ważności', 'c.validTo') }}
                    </th>
                    <th{% if pagination.isSorted('c.updatedAt') %} class="sorted"{% endif %}>
                        {{ knp_pagination_sortable(pagination, 'zmodyfikowany', 'c.updatedAt') }}
                    </th>
                    <th>opcje</th>
                </tr>
                </thead>
                <tbody>
                {% for connection in pagination %}
                    <tr>
                        <td>{{ connection.loading.name }}</td>
                        <td>{{ connection.unloading.name }}</td>
                        <td>{{ connection.cost }}</td>
                        <td>{{ connection.validTo|date('d.m.Y H:i') }}</td>
                        <td>{{ connection.updatedAt|date('d.m.Y H:i') }}</td>
                        <td>
                            <a href="{{ path('app_admin.connection.history', { connection: connection.id }) }}">Historia</a> ,
                            <a href="{{ path('app_admin.connection.edit', { connection: connection.id }) }}">Edytuj</a> ,
                            <a href="{{ path('app_admin.connection.remove', { connection: connection.id }) }}">Usuń</a>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>

            <div class="text-center">
                {{ knp_pagination_render(pagination, 'KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig') }}
            </div>
        </div>
    </div>
{% endblock %}