FestinHegre/templates/clients/index.html.twig

61 lines
2.2 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}Client index{% endblock %}
{% block container_modal %}
<div id="container_modal">
<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>Depense</th>
<th>Réduction Appliquée</th> <!-- Nouvelle colonne -->
<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>{{ client.totalDepense }}</td>
<td>
{% if client.reductions|length > 0 %}
{% for reduction in client.reductions %}
<span>Réduction de {{ reduction.pourcentage }}% - Valide jusqu'à {{ reduction.DateFin|date('d/m/Y') }}</span><br>
{% endfor %}
{% else %}
Aucune réduction
{% endif %}
</td>
<td>
<form method="post" action="{{ path('app_clients_delete', {'id': client.id}) }}" onsubmit="return confirm('Es-tu sûr 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="8">Aucun client trouvé</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_clients_new') }}">Créer un nouveau client</a>
</div>
{% endblock %}