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

{% block content %}
    <div class="panel panel-default">
        <div class="panel-heading">
            Salons
            <div class="pull-right">
                <div class="btn-group">
                    <a href="{{ path('admin_event_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>Description</th>
                <th>Date de début</th>
                <th>Date de fin</th>
                <th>Adresse</th>
                <th>Code Postal</th>
                <th>Ville</th>
                <th>Fichier</th>
                <th>Url</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>
            {% for item in items %}
                <tr  {% if item.disabled == 1 %} class="danger" {% endif %}>
                    <td>{{ loop.index }}</td>
                    <td>{{ item.name }}</td>
                    <td>{{ item.description | slice(0,50) }}</td>
                    <td>{{ item.beginAt | date('d-m-Y H:i') }}</td>
                    <td>{{ item.endAt | date('d-m-Y H:i') }}</td>
                    <td>{{ item.address }}</td>
                    <td>{{ item.postal }}</td>
                    <td>{{ item.city }}</td>
                    <td> {% if item.file is not null %}<a href="{{ asset(item.file.path) | file_path }}" target="_blank">File</a>{% endif %}</td>
                    <td>{{ item.url }}</td>
                    <td>
                        <a href="{{ path('admin_event_edit', { id: item.id}) }}" class="btn btn-info btn-xs"
                           data-title="Editer le salon"><i
                                    class="fas fa-edit fa-2x" aria-hidden="true"></i></a>

                            <a href="{{ path('admin_event_delete', { id: item.id }) }}"
                               class="confirm-deletable btn btn-danger btn-xs"
                               data-title="Supprimer le salon {{ item.name }}"><i class="fa fa-2x fa-trash"
                                                                                  aria-hidden="true"></i></a>
                        {% if item.disabled == 0 %}
                            <a href="{{ path('admin_event_disable', { id: item.id }) }}"
                               class=" btn btn-default btn-xs" data-toggle="tooltip"
                               title="Dépublier le produit {{ item.name }}"><i
                                        class="fas fa-circle fa-2x color_green"></i></a>
                        {% else %}
                            <a href="{{ path('admin_event_enable', { id: item.id }) }}"
                               class=" btn btn-default btn-xs" data-toggle="tooltip"
                               title="Publier le produit {{ item.name }}"><i class="fas fa-circle fa-2x color_red"></i></a>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}

            </tbody>
        </table>
    </div>
{% endblock %}
