{% extends 'admin/layouts/base.html.twig' %}

{% block title %} Admin - {{ app.user ? app.user.username : company_name }} - {{ title }} {% endblock %}
{% block pageheader %}
    <div class="page-header page-header-light">
        <div class="page-header-content header-elements-md-inline">
            <div class="page-title d-flex">
                <h4><i class="icon-flip-vertical3 mr-2"></i>
                    <span class="font-weight-semibold">Gestion des états</span>
                </h4>
                <a href="javascript:" class="header-elements-toggle text-default d-md-none">
                    <i class="icon-more"></i>
                </a>
            </div>

            <div class="header-elements d-none">
                <div class="d-flex justify-content-center">
                    {% include 'admin/partials/_action_global_btn.html.twig' %}
                    <a data-toggle="tooltip" title="{{ libelle_ajouter }}" href="{{ path('admin.etats.new') }}"
                       class="btn btn-success btn-sm btn-icon ml-5">
                        <i class="icon-plus2"></i>
                    </a>
                </div>
            </div>
        </div>

        <div class="breadcrumb-line breadcrumb-line-light header-elements-md-inline">
            {{ fil_arial(title, 'Etats') }}
        </div>
    </div>
{% endblock %}
{% block body %}
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header header-elements-inline">
                    <h6 class="card-title"><i class="icon-flip-vertical3"></i> {{ title }}</h6>
                </div>

                <table class="datatable-show-all table">
                    <thead class="{{ class }}">
                        <tr>
                            <th>Etats</th>
                            <th style="width: 100px;">Couleur</th>
                            <th style="width: 100px;">Icône</th>
                            <th style="width: 150px;">Ajouté le</th>
                            <th style="width: 150px;">Modifié le</th>
                            <th style="width: 60px;">Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for etat in etats %}
                            <tr class="odd gradeX">
                                <td><a style="color: {{ etat.color }}!important;" href="{{ path('admin.etats.edit', {'id': etat.id}) }}">{{ etat.name }}</a></td>
                                <td style="text-align: left;">
                                    <span class="badge badge-dark" style="background-color: {{ etat.color }}!important;">
                                        <i class="{{ etat.icon }}"></i> {{ etat.color }}
                                    </span>
                                </td>
                                <td style="text-align: left;">
                                    {% if etat.icon %}
                                        <span class="badge badge-dark" style="background-color: {{ etat.color }}!important;">
                                            <i class="{{ etat.icon }}"></i> {{ etat.iconType }}
                                        </span>
                                    {% endif %}
                                </td>
                                <td>{{ etat.createdAt|date('d/m/Y') }}</td>
                                <td>{{ etat.updatedAt|date('d/m/Y') }}</td>
                                <td style="text-align: center!important;">
                                    <div class="list-icons">
                                        <div class="dropdown">
                                            <a href="javascript:" class="list-icons-item" data-toggle="dropdown">
                                                <i class="icon-menu9"></i>
                                            </a>
                                            <div class="dropdown-menu dropdown-menu-right">
                                                <a class="dropdown-item" href="{{ path('admin.etats.edit', {'id': etat.id}) }}">
                                                    <i class="icon-pencil"></i> Modifier
                                                </a>
                                                {% include 'admin/configurations/etats/_delete_form.html.twig' %}
                                            </div>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        {% else %}
                            <tr>
                                <td colspan="6">{{ data_none }}</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{% endblock %}
