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>
This commit is contained in:
Serreau Jovann
2026-04-09 15:16:49 +02:00
parent 0e1f249cc3
commit d9073944e0
6 changed files with 58 additions and 5 deletions

View File

@@ -368,6 +368,7 @@ class ClientsController extends AbstractController
$facturesList = $em->getRepository(\App\Entity\Facture::class)->findBy(['customer' => $customer], ['createdAt' => 'DESC']);
$echeancierList = $em->getRepository(\App\Entity\Echeancier::class)->findBy(['customer' => $customer], ['createdAt' => 'DESC']);
$eflexList = $em->getRepository(\App\Entity\EFlex::class)->findBy(['customer' => $customer], ['createdAt' => 'DESC']);
$contratsList = $em->getRepository(\App\Entity\Contrat::class)->findBy(['customer' => $customer], ['createdAt' => 'DESC']);
$trustStatus = $this->computeTrustStatus($advertsList, $echeancierList, $customer);
@@ -382,6 +383,7 @@ class ClientsController extends AbstractController
'facturesList' => $facturesList,
'echeancierList' => $echeancierList,
'eflexList' => $eflexList,
'contratsList' => $contratsList,
'tab' => $tab,
'trustStatus' => $trustStatus,
]);

View File

@@ -18,7 +18,7 @@ class Contrat
public const TYPE_MIGRATION_SITECONSEIL = 'migration_siteconseil';
public const TYPE_LABELS = [
self::TYPE_MIGRATION_SITECONSEIL => 'Contrat Migration SARL SITECONSEIL',
self::TYPE_MIGRATION_SITECONSEIL => 'Contrat de Service - Migration SARL SITECONSEIL',
];
#[ORM\Id]

View File

@@ -13,7 +13,7 @@ class ContratMigrationSiteconseilPdf extends Fpdi
private readonly Contrat $contrat,
) {
parent::__construct();
$this->SetTitle($this->enc('Contrat Migration '.$this->contrat->getReference().' - '.$this->contrat->getRaisonSociale()));
$this->SetTitle($this->enc('Contrat de Service '.$this->contrat->getReference().' - '.$this->contrat->getRaisonSociale()));
$this->SetAuthor($this->enc('Association E-Cosplay'));
}
@@ -59,12 +59,12 @@ class ContratMigrationSiteconseilPdf extends Fpdi
$this->SetFont('Arial', 'B', 14);
$this->SetXY(60, 10);
$this->Cell(0, 7, $this->enc('CONTRAT DE MIGRATION'), 0, 1, 'L');
$this->Cell(0, 7, $this->enc('CONTRAT DE SERVICE'), 0, 1, 'L');
$this->SetFont('Arial', 'B', 10);
$this->SetXY(60, 17);
$this->SetTextColor(253, 140, 4);
$this->Cell(0, 5, $this->enc('Transfert de services SARL SITECONSEIL'), 0, 1, 'L');
$this->Cell(0, 5, $this->enc('Migration SARL SITECONSEIL'), 0, 1, 'L');
$this->SetTextColor(0, 0, 0);
$this->SetFont('Arial', '', 9);

View File

@@ -1207,6 +1207,53 @@
</div>
</div>
{# Tab: Contrats #}
{% elseif tab == 'contrats' %}
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-bold uppercase">Contrats</h2>
</div>
{% if contratsList|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">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 contratsList %}
<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 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') }}{% if c.signedAt %} <span class="text-green-600">(signe {{ c.signedAt|date('d/m/Y') }})</span>{% endif %}</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 pour ce client.</div>
{% endif %}
{# Tab: E-Flex #}
{% elseif tab == 'esyflex' %}
{% set hasActiveEflex = false %}

View File

@@ -78,7 +78,7 @@
<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 Migration SARL SITECONSEIL</option>
<option value="migration_siteconseil">Contrat de Service - Migration SARL SITECONSEIL</option>
</select>
</div>
</div>

View File

@@ -61,6 +61,10 @@
<form method="post" action="{{ path('app_admin_contrats_generate_pdf', {id: contrat.id}) }}" data-confirm="Regenerer le PDF ?">
<button type="submit" class="px-4 py-2 bg-yellow-500/20 text-yellow-700 hover:bg-yellow-500 hover:text-white font-bold uppercase text-[10px] tracking-wider transition-all">Regenerer PDF</button>
</form>
{% else %}
<form method="post" action="{{ path('app_admin_contrats_generate_pdf', {id: contrat.id}) }}">
<button type="submit" class="px-4 py-2 bg-gray-900 text-white font-bold uppercase text-[10px] tracking-wider hover:bg-[#fabf04] hover:text-gray-900 transition-all">Generer PDF</button>
</form>
{% endif %}
{% endif %}
{% if contrat.pdfUnsigned and contrat.state in ['draft', 'send'] %}