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

{% block content %}
    <div class="col-md-10 main">
        <h3>Port: historia</h3>
        <div class="table-responsive">
            <table class="table table-striped">
                <colgroup>
                    <col class="col-xs-2">
                    <col class="col-xs-6">
                    <col class="col-xs-2">
                    <col class="col-xs-2">
                </colgroup>
                <thead>
                <tr>
                    <th{% if pagination.isSorted('ph.name') %} class="sorted"{% endif %}>
                        {{ knp_pagination_sortable(pagination, 'nazwa', 'ph.name') }}
                    </th>
                    <th{% if pagination.isSorted('ph.country') %} class="sorted"{% endif %}>
                        {{ knp_pagination_sortable(pagination, 'kraj', 'ph.country') }}
                    </th>
                    <th{% if pagination.isSorted('ph.createdAt') %} class="sorted"{% endif %}>
                        {{ knp_pagination_sortable(pagination, 'zmodyfikowany', 'ph.createdAt') }}
                    </th>
                    <th>Użytkownik</th>
                </tr>
                </thead>
                <tbody>
                {% for port in pagination %}
                    <tr {{ port.isRemoved ? 'class="text-danger"' : '' }}>
                        <td>{{ port.name is defined ? port.name : '' }}</td>
                        <td>{{ port.country is defined ? port.country : '' }}</td>
                        <td>{{ port.createdAt is defined ? port.createdAt|date('d.m.Y H:i') : '' }}</td>
                        <td>
                            {% if port.user.id is defined %}
                                <a href="{{ path('app_admin.user.edit', { user: port.user.id }) }}">
                                    {{ port.user.fullName }}
                                </a>
                            {% endif %}
                        </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 %}