{% 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_country_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>Département</th>
                <th>Groupe</th>
                <th>minQty</th>
                <th>multiple</th>
                <th>Activé</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>

            {% for item in items %}
                <tr>
                    <td>{{ loop.index }}</td>
                    <td>{{ item.name }}</td>
                    <td>
                        {% if item.county== 1 %}
                            <i class="fas fa-circle fa-2x color_green"></i>
                        {% else %}
                            <i class="fas fa-circle fa-2x color_red"></i>
                        {% endif %}
                    </td>
                    <td>{% for group in item.groups %}
                            <span class="label label-default">{{ group.name }}</span>
                        {% endfor %}</td>
                    <td>{{ item.minQty }}</td>
                    <td>{{ item.multiple }}</td>
                    <td>
                        {% if item.disabled == 0 %}
                            <a href="{{ path('admin_shipping_country_disable', { id: item.id }) }}"
                               class=" btn btn-default btn-xs" data-toggle="tooltip"
                               title="Désactiver le pays {{ item.name }}"><i
                                        class="fas fa-circle fa-2x color_green"></i></a>
                        {% else %}
                            <a href="{{ path('admin_shipping_country_enable', { id: item.id }) }}"
                               class=" btn btn-default btn-xs" data-toggle="tooltip"
                               title="Activer le pays {{ item.name }}"><i class="fas fa-circle fa-2x color_red"></i></a>
                        {% endif %}
                    </td>
                    <td>
                        <a href="{{ path('admin_shipping_country_edit', { id: item.id}) }}" class="btn btn-info btn-xs"
                           data-toggle="tooltip" title="Editer le pays"><i class="fas fa-edit fa-2x"></i></a>

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