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

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

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

    <table class="table">
        <thead>
            <tr>
                <th>Id</th>
                <th>Description</th>
                <th>Prix</th>
                <th>Pourcentage</th>
                <th>MontantFixe</th>
                <th>DateDebut</th>
                <th>DateFin</th>
                <th>actions</th>
            </tr>
        </thead>
        <tbody>
        {% for reduction in reductions %}
            <tr>
                <td>{{ reduction.id }}</td>
                <td>{{ reduction.Description }}</td>
                <td>{{ reduction.Prix }}</td>
                <td>{{ reduction.Pourcentage }}</td>
                <td>{{ reduction.MontantFixe }}</td>
                <td>{{ reduction.DateDebut ? reduction.DateDebut|date('Y-m-d H:i:s') : '' }}</td>
                <td>{{ reduction.DateFin ? reduction.DateFin|date('Y-m-d H:i:s') : '' }}</td>
                <td>
                    <form method="post" action="{{ path('app_reductions_delete', {'id': reduction.id}) }}" onsubmit="return confirm('Es-tu sur de vouloir le supprimer ?');">
                        <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ reduction.id) }}">
                        {{ include('reductions/_delete_form.html.twig') }}
                    </form>
                    <a href="{{ path('app_reductions_edit', {'id': reduction.id}) }}">Modifier</a>
                </td>
            </tr>
        {% else %}
            <tr>
                <td colspan="8">Aucun enregistrement trouvé</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <a href="{{ path('app_reductions_new') }}">Créer une réduction</a>
{% endblock %}
