Files
crm_ecosplay/templates/admin/contrats/index.html.twig
Serreau Jovann d9073944e0 feat: finalisation contrats - tab client, bouton generer PDF, renommage Contrat de Service
- Tab Contrats dans fiche client avec liste (reference, type, statut, date)
- Bouton "Generer PDF" si PDF absent (fallback)
- Renommage "Contrat de Migration" -> "Contrat de Service" partout
  (PDF titre, entite label, template modal)
- Chargement contratsList dans ClientsController

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 15:16:49 +02:00

94 lines
6.1 KiB
Twig

{% extends 'admin/_layout.html.twig' %}
{% block title %}Contrats - Association E-Cosplay{% endblock %}
{% block admin_content %}
<div class="page-container">
<div class="flex items-center justify-between mb-6">
<h1 class="text-2xl font-bold heading-page">Contrats</h1>
<button type="button" data-modal-open="modal-contrat" class="btn-gold px-4 py-2 font-bold uppercase text-[10px] tracking-wider text-gray-900">Creer un contrat</button>
</div>
{% for type, messages in app.flashes %}
{% for message in messages %}
<div class="mb-4 p-4 glass font-medium text-sm {{ type == 'success' ? 'border-green-300 text-green-800' : 'border-red-300 text-red-800' }}">{{ message }}</div>
{% endfor %}
{% endfor %}
{% if contrats|length > 0 %}
<div class="glass overflow-x-auto overflow-hidden">
<table class="w-full text-sm">
<thead>
<tr class="glass-dark text-white">
<th class="px-4 py-3 text-left font-bold uppercase text-xs tracking-widest">Reference</th>
<th class="px-4 py-3 text-left font-bold uppercase text-xs tracking-widest">Client</th>
<th class="px-4 py-3 text-left font-bold uppercase text-xs tracking-widest">Email</th>
<th class="px-4 py-3 text-left font-bold uppercase text-xs tracking-widest">Type</th>
<th class="px-4 py-3 text-center font-bold uppercase text-xs tracking-widest">Statut</th>
<th class="px-4 py-3 text-left font-bold uppercase text-xs tracking-widest">Date</th>
<th class="px-4 py-3 text-center font-bold uppercase text-xs tracking-widest">Actions</th>
</tr>
</thead>
<tbody>
{% for c in contrats %}
<tr class="border-b border-white/20 hover:bg-white/50">
<td class="px-4 py-3 font-mono font-bold text-[10px]">{{ c.reference }}</td>
<td class="px-4 py-3 font-bold text-xs">{{ c.raisonSociale }}</td>
<td class="px-4 py-3 text-xs text-gray-500">{{ c.email }}</td>
<td class="px-4 py-3 text-xs">{{ c.typeLabel }}</td>
<td class="px-4 py-3 text-center">
{% if c.state == 'signed' %}
<span class="px-2 py-0.5 bg-green-500/20 text-green-700 font-bold uppercase text-[10px]">Signe</span>
{% elseif c.state == 'send' %}
<span class="px-2 py-0.5 bg-blue-500/20 text-blue-700 font-bold uppercase text-[10px]">Envoye</span>
{% elseif c.state == 'cancelled' %}
<span class="px-2 py-0.5 bg-red-500/20 text-red-700 font-bold uppercase text-[10px]">Annule</span>
{% else %}
<span class="px-2 py-0.5 bg-yellow-100 text-yellow-800 font-bold uppercase text-[10px]">Brouillon</span>
{% endif %}
</td>
<td class="px-4 py-3 text-xs text-gray-500">{{ c.createdAt|date('d/m/Y') }}</td>
<td class="px-4 py-3 text-center">
<a href="{{ path('app_admin_contrats_show', {id: c.id}) }}" class="px-3 py-1 bg-gray-900 text-white hover:bg-[#fabf04] hover:text-gray-900 font-bold uppercase text-[10px] transition-all">Voir</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="glass p-8 text-center text-gray-400 font-bold">Aucun contrat.</div>
{% endif %}
{# Modal creation #}
<div id="modal-contrat" class="hidden fixed inset-0 z-50 flex items-center justify-center bg-black/50">
<div class="glass-heavy p-6 w-full max-w-lg">
<h2 class="text-lg font-bold uppercase mb-4">Nouveau contrat</h2>
<form method="post" action="{{ path('app_admin_contrats_create') }}">
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 mb-4">
<div class="md:col-span-2">
<label for="ctr-raisonSociale" class="block text-[9px] font-bold uppercase tracking-wider text-gray-400 mb-1">Raison sociale du client *</label>
<input type="text" id="ctr-raisonSociale" name="raisonSociale" required class="input-glass w-full px-3 py-2 text-xs font-bold" placeholder="Ex: SARL Mon Entreprise">
</div>
<div class="md:col-span-2">
<label for="ctr-email" class="block text-[9px] font-bold uppercase tracking-wider text-gray-400 mb-1">Email du client *</label>
<input type="email" id="ctr-email" name="email" required class="input-glass w-full px-3 py-2 text-xs font-bold" placeholder="client@exemple.fr">
</div>
<div class="md:col-span-2">
<label for="ctr-type" class="block text-[9px] font-bold uppercase tracking-wider text-gray-400 mb-1">Type de contrat *</label>
<select id="ctr-type" name="type" required class="input-glass w-full px-3 py-2 text-xs font-bold">
<option value="">— Selectionner —</option>
<option value="migration_siteconseil">Contrat de Service - Migration SARL SITECONSEIL</option>
</select>
</div>
</div>
<div class="flex justify-end gap-2">
<button type="button" data-modal-close="modal-contrat" class="px-4 py-2 glass font-bold uppercase text-[10px] tracking-widest">Annuler</button>
<button type="submit" class="btn-gold px-4 py-2 font-bold uppercase text-[10px] tracking-wider text-gray-900">Creer</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}