add webhooks for refused signature contrat

This commit is contained in:
Serreau Jovann
2026-02-16 09:48:53 +01:00
parent 478dc90aa5
commit 8c96f1a0b8
2 changed files with 75 additions and 10 deletions

View File

@@ -14,6 +14,21 @@
Générer la Facture
</a>
{% endif %}
{# --- BOUTON RENVOYER LIEN SIGNATURE (Caché si signé ou refusé) --- #}
{# Note: contrat.signed semble être utilisé dans le snippet original, mais list.twig utilise isSigned. Je vérifie les deux ou je suppose isSigned correct si c'est l'entité. #}
{# Dans le doute, j'utilise la logique cohérente avec le statut #}
{% if not contrat.signed and not contrat.refused %}
<a data-turbo="false" href="{{ path('app_crm_contrats', {idSend: contrat.id}) }}"
onclick="return confirm('Renvoyer les documents à {{ contrat.customer.email }} ?')"
class="flex items-center gap-2 px-6 py-2.5 bg-indigo-600 hover:bg-indigo-500 border border-indigo-500 rounded-xl text-white text-[10px] font-black uppercase italic transition-all shadow-lg shadow-indigo-500/20 group">
<svg class="w-4 h-4 group-hover:rotate-12 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />
</svg>
Renvoyer le lien
</a>
{% endif %}
{% if contrat.signed %}
<a href="{{ vich_uploader_asset(contrat,'devisSignFile') }}" download
class="flex items-center gap-2 px-6 py-2.5 bg-emerald-500/10 hover:bg-emerald-500/20 border border-emerald-500/20 backdrop-blur-md rounded-xl text-emerald-400 text-[10px] font-black uppercase italic transition-all group">
@@ -49,11 +64,33 @@
<div class="space-y-8 pb-20">
{# --- BANNIÈRE DE REFUS (Prioritaire) --- #}
{% if contrat.refused %}
<div class="bg-red-600/20 border-b border-red-500/30 px-8 py-4 rounded-[1.5rem] flex items-center justify-between gap-3 backdrop-blur-md animate-in fade-in slide-in-from-top-4 duration-500">
<div class="flex items-center gap-4">
<div class="p-3 bg-red-500 rounded-2xl shadow-lg shadow-red-500/20">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</div>
<div>
<h3 class="text-sm font-black text-red-400 uppercase tracking-widest leading-none">CONTRAT REFUSÉ PAR LE CLIENT</h3>
<p class="text-sm text-red-100/80 mt-1 font-medium italic">
Motif du refus : "{{ contrat.refusedRaison|default('Aucune raison spécifiée') }}"
</p>
</div>
</div>
<div class="px-4 py-2 bg-red-500 text-white rounded-xl text-[10px] font-black uppercase shadow-lg shadow-red-500/20">
Action Requise
</div>
</div>
{% endif %}
{# --- 1. BANDEAU DE STATUT RAPIDE --- #}
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 {{ contrat.refused ? 'opacity-75 grayscale' : '' }}">
<div class="p-4 rounded-[1.5rem] bg-white/5 border border-white/10 backdrop-blur-md flex items-center justify-between">
<span class="text-[10px] font-black uppercase text-slate-300 tracking-widest">État Juridique</span>
{% if contrat.signed %}
{% if contrat.refused %}
<span class="px-3 py-1 bg-red-500/10 text-red-400 text-[9px] font-black rounded-lg border border-red-500/20">REFUSÉ</span>
{% elseif contrat.signed %}
<span class="px-3 py-1 bg-emerald-500/10 text-emerald-400 text-[9px] font-black rounded-lg border border-emerald-500/20">SIGNÉ</span>
{% else %}
<span class="px-3 py-1 bg-amber-500/10 text-amber-400 text-[9px] font-black rounded-lg border border-amber-500/20 animate-pulse">EN ATTENTE</span>
@@ -89,7 +126,7 @@
</div>
{# --- 2. INFOS CLIENT & ÉVÉNEMENT --- #}
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 {{ contrat.refused ? 'opacity-75 grayscale' : '' }}">
<div class="relative group">
<div class="absolute -inset-0.5 bg-gradient-to-br from-blue-500/20 to-purple-500/20 rounded-[2.5rem] blur opacity-50"></div>
<div class="relative h-full p-8 bg-slate-900/40 border border-white/10 backdrop-blur-xl rounded-[2.5rem]">
@@ -98,7 +135,7 @@
<svg class="w-7 h-7 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" /></svg>
</div>
<div>
<h2 class="text-xl font-black text-white italic tracking-tighter uppercase">{{ contrat.customer.surname }} {{ contrat.customer.name }}</h2>
<h2 class="text-xl font-black text-white italic tracking-tighter uppercase {{ contrat.refused ? 'line-through decoration-red-500/50' : '' }}">{{ contrat.customer.surname }} {{ contrat.customer.name }}</h2>
<p class="text-slate-500 font-bold text-[10px] uppercase tracking-widest">Locataire</p>
</div>
</div>
@@ -131,7 +168,7 @@
{# --- 3. SECTION LOGISTIQUE & ÉTAT DES LIEUX --- #}
{% if contrat.etatLieux %}
<div class="space-y-4">
<div class="space-y-4 {{ contrat.refused ? 'opacity-75 grayscale' : '' }}">
<h3 class="px-2 text-sm font-black text-slate-400 uppercase tracking-[0.3em]">Logistique & État des lieux</h3>
{% if contrat.etatLieux.status == 'edl_return_refused' %}
@@ -225,7 +262,7 @@
{% endif %}
{# --- 4. ÉTAT DES PAIEMENTS --- #}
<div class="p-8 bg-white/[0.02] border border-white/10 rounded-[2.5rem] backdrop-blur-md">
<div class="p-8 bg-white/[0.02] border border-white/10 rounded-[2.5rem] backdrop-blur-md {{ contrat.refused ? 'opacity-75 grayscale' : '' }}">
<div class="flex flex-col md:flex-row gap-8 justify-around items-start">
{# ACOMPTE #}
<div class="flex flex-col items-center gap-4 text-center w-full">
@@ -305,7 +342,7 @@
</div>
{# --- 5. PRODUITS ET OPTIONS --- #}
<div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
<div class="grid grid-cols-1 xl:grid-cols-2 gap-8 {{ contrat.refused ? 'opacity-75 grayscale' : '' }}">
<div class="space-y-4">
<h3 class="px-2 text-sm font-black text-slate-400 uppercase tracking-[0.3em]">Équipements loués</h3>
<div class="bg-white/[0.02] border border-white/10 rounded-[2rem] divide-y divide-white/5 overflow-hidden">
@@ -340,7 +377,7 @@
</div>
{# --- 6. HISTORIQUE FINANCIER --- #}
<div class="space-y-4">
<div class="space-y-4 {{ contrat.refused ? 'opacity-75 grayscale' : '' }}">
<h3 class="px-2 text-sm font-black text-slate-400 uppercase tracking-[0.3em]">Historique des transactions</h3>
<div class="bg-white/[0.02] border border-white/10 rounded-[2.5rem] overflow-hidden">
<table class="w-full text-left">