{% extends 'base.html.twig' %}

{% block title %}Clients index{% endblock %}
{% block stylesheets %}
    <link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->

{% endblock %}
{% block body %}
    <h1>Clients index</h1>

    <table class="table">
        <thead>
            <tr>
                <th>Id</th>
                <th>Prenom</th>
                <th>Nom</th>
                <th>Email</th>
                <th>Telephone</th>
                <th>actions</th>
            </tr>
        </thead>
        <tbody>
        {% for client in clients %}
            <tr>
                <td>{{ client.id }}</td>
                <td>{{ client.Prenom }}</td>
                <td>{{ client.Nom }}</td>
                <td>{{ client.Email }}</td>
                <td>{{ client.Telephone }}</td>
                <td>
                    <form method="post" action="{{ path('app_clients_delete', {'id': client.id}) }}" onsubmit="return confirm('Es-tu sur de vouloir le supprimer ?');">
                        <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ client.id) }}">
                        {{ include('clients/_delete_form.html.twig') }}
                    </form>
                    <a href="{{ path('app_clients_edit', {'id': client.id}) }}">Modifier</a>
                </td>
            </tr>
        {% else %}
            <tr>
                <td colspan="6">no records found</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <a href="{{ path('app_clients_new') }}">Créer un nouveau client</a>
{% endblock %}
