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

{% block content %}
    <div class="panel panel-default">
        <div class="panel-heading">
            Configuration Avancée Transport
            {% if items|length < 1  and is_granted('ROLE_ADMIN') %}
                <div class="pull-right">
                    <div class="btn-group">
                        <a href="{{ path('admin_shipping_config_new') }}" type="button" class="btn btn-default btn-xs">
                            Ajouter
                        </a>
                    </div>
                </div>
            {% endif %}
        </div>
        <table class="table table-striped">
            <thead>
            <tr>
                <th>#</th>
                <th>Transport offert</th>
                <th>Marge Auto</th>
                <th>Supplément</th>
            </tr>
            </thead>
            <tbody>
            {% for item in items %}
                <tr>
                    <td>{{ loop.index }}</td>
                    <td>{{ (item.amountFreeShipping/100) | number_format(2) }} €</td>
                    <td>{{ item.marginAuto * 100 }} %</td>
                    <td>
                        <a href="{{ path('admin_shipping_config_edit', { id: item.id}) }}" class="btn btn-info btn-xs"
                           data-toggle="tooltip" title="Editer la configuration"><i
                                    class="fas fa-edit fa-2x"></i></a>
                        {% if is_granted('ROLE_ADMIN') %}
                            <a href="{{ path('admin_shipping_config_delete', { id: item.id }) }}"
                               class="confirm-deletable btn btn-danger btn-xs"
                               data-toggle="tooltip" title="Supprimer la configuration"
                               data-title="Supprimer la configuration">
                                <i class="fa fa-2x fa-trash"></i></a>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}
