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

{% block content %}
    <div class="panel panel-default">
        <div class="panel-heading">
            Labels
            <div class="pull-right">
                <div class="btn-group">
                    <a href="{{ path('admin_label_new') }}" type="button" class="btn btn-default btn-xs">
                        Ajouter
                    </a>
                </div>
            </div>
        </div>
        <table class="table table-striped">
            <thead>
            <tr>
                <th>#</th>
                <th>Image</th>
                <th>Texte</th>
                <th>Position</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>
            {% for item in items %}
                <tr>
                    <td>{{ item.position }}</td>
                    <td><img src="{{ item.image.path|image_path }}" width="50px"></td>
                    <td>{{ item.text| slice (0,50) }}</td>
                    <td>
                        {% if loop.first == false %}
                            <a href="{{ path('admin_label_move_up', {id : item.id}) }}"
                               class="btn btn-default btn-xs" data-toggle="tooltip" title="Remonter le label"><i
                                        class="fa fa-2x fa-arrow-up" aria-hidden="true"></i></a>
                        {% endif %}
                        {% if loop.last == false %}
                            <a href="{{ path('admin_label_move_down', {id : item.id}) }}"
                               class=" btn btn-default btn-xs" data-toggle="tooltip" title="Descendre le label"><i
                                        class="fa fa-2x fa-arrow-down" aria-hidden="true"></i></a>
                        {% endif %}
                    </td>
                    <td>
                        <a href=" {{ path('admin_label_edit', { id: item.id }) }}" class="btn btn-info btn-xs"
                           data-toggle="tooltip" title="Editer le label">
                                    <i class="fas fa-edit fa-2x"></i></a>

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