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

{% block content %}
    <div class="panel panel-default">
        <div class="panel-heading">
            Supplément aux frais de port
            <div class="pull-right">
                <div class="btn-group">
                    <a href="{{ path('admin_shipping_additional_new') }}" type="button" class="btn btn-default btn-xs">
                        Ajouter
                    </a>
                </div>
            </div>
        </div>
        <table class="table table-striped">
            <thead>
            <tr>
                <th>#</th>
                <th>De</th>
                <th>A</th>
                <th>Depuis</th>
                <th>Jusqu'au</th>
                <th>Groupes</th>
                <th>Dépt.</th>
                <th>Supplément (€)</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>

            {% for item in items %}
                <tr>
                    <td>{{ loop.index }}</td>
                    <td>{{ item.qtyOf }}</td>
                    <td>{{ item.qtyAt is null ? 'Infini' : item.qtyAt }}</td>
                    <td>{{ item.dateOf|intToDate }}</td>
                    <td>{{ item.dateAt|intToDate }}</td>
                    <td>
                        {% for group in item.groups %}
                            <span class="label label-default">{{ group.name }}</span>
                        {% endfor %}
                    </td>
                    <td>
                        {% for county in item.counties %}
                            <span class="label label-default">{{ county.code }}</span>
                        {% endfor %}
                    </td>
                    <td>
                        {{  item.price / 100 }} €
                    </td>
                    <td>
                        <a href="{{ path('admin_shipping_additional_edit', { id: item.id}) }}" class="btn btn-info btn-xs"
                           data-toggle="tooltip" title="Editer le prix"><i class="fas fa-edit fa-2x"></i></a>

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