{% extends '@CpCreationVitiCore/admin/base.html.twig' %}

{% block content %}
    <div class="panel panel-default">
        <div class="panel-heading">
            Zones pour frais de port
            <div class="pull-right">
                <div class="btn-group">
                    <a href="{{ path('admin_shipping_zone_new') }}" type="button" class="btn btn-default btn-xs">
                        Ajouter
                    </a>
                </div>
            </div>
        </div>
        <table class="table table-striped">
            <thead>
            <tr>
                <th>#</th>
                <th>Nom</th>
                <th>Pays</th>
                <th>Département</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>

            {% for item in items %}
                <tr>
                    <td>{{ loop.index }}</td>
                    <td>{{ item.name }}</td>
                    <td>{% for country in item.countries %}
                            <span class="label label-default">{{ country.code }}</span>
                        {% endfor %}</td>
                    <td>
                        {% for county in item.counties %}
                            <span class="label label-default">{{ county.code }}</span>
                        {% endfor %}
                    </td>
                    <td>
                        <a href="{{ path('admin_shipping_zone_edit', { id: item.id}) }}" class="btn btn-info btn-xs"
                           data-toggle="tooltip" title="Editer la zone"><i class="fas fa-edit fa-2x"></i></a>

                        <a href="{{ path('admin_shipping_zone_delete', { id: item.id }) }}"
                           class="confirm-deletable btn btn-danger btn-xs"
                           data-toggle="tooltip" title="Supprimer la zone {{ item.name }}"
                           data-title="Supprimer la zone {{ item.name }}">
                            <i class="fa fa-2x fa-trash"></i></a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}
