feat(ReserverController): Gère les options de produits au panier et en session.

Ajoute la gestion des options de produits lors de l'ajout au panier et dans la session de réservation. Inclut des corrections pour les options orphelines.
```
This commit is contained in:
Serreau Jovann
2026-02-04 11:58:07 +01:00
parent d23e75034c
commit 900b55c07b
8 changed files with 361 additions and 55 deletions

View File

@@ -39,7 +39,9 @@
{% endif %}
<div class="flex-1">
<h4 class="font-bold text-slate-800">{{ item.product.name }}</h4>
<p class="text-xs text-slate-500 line-clamp-1 mb-2">{{ item.product.description }}</p>
<div class="text-xs text-slate-500 mb-2 prose prose-sm max-w-none">
{{ item.product.description|raw }}
</div>
<div class="text-xs text-slate-600 bg-slate-50 p-2 rounded-lg border border-slate-100 inline-block">
<div class="flex flex-wrap gap-x-3 gap-y-1">
@@ -50,6 +52,19 @@
{% endif %}
</div>
</div>
{# Linked Options #}
{% if item.options is defined and item.options|length > 0 %}
<div class="mt-2 space-y-1">
{% for opt in item.options %}
<div class="flex items-center gap-2 text-xs text-slate-500">
<span class="bg-indigo-50 text-indigo-600 px-1.5 py-0.5 rounded text-[10px] font-bold uppercase">Option</span>
<span>{{ opt.name }}</span>
<span class="font-bold text-slate-700">+ {{ opt.price|number_format(2, ',', ' ') }} €</span>
</div>
{% endfor %}
</div>
{% endif %}
</div>
<div class="text-right">
<p class="font-bold text-slate-900">{{ item.totalPriceHT|number_format(2, ',', ' ') }} € HT</p>
@@ -61,6 +76,24 @@
{% else %}
<p class="text-center text-slate-500 py-4">Aucun produit sélectionné.</p>
{% endfor %}
{# Orphan Options #}
{% if cart.options is defined and cart.options|length > 0 %}
<div class="border-t border-slate-100 pt-4 mt-4">
<h4 class="text-sm font-bold text-slate-800 mb-2 uppercase tracking-wide">Autres options</h4>
{% for opt in cart.options %}
<div class="flex items-center justify-between bg-white p-3 rounded-xl border border-slate-200 shadow-sm mb-2">
<div class="flex items-center gap-3">
<div class="h-8 w-8 bg-indigo-50 rounded-lg flex items-center justify-center text-indigo-500">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/></svg>
</div>
<span class="text-sm font-medium text-slate-700">{{ opt.name }}</span>
</div>
<span class="font-bold text-slate-900">{{ opt.price|number_format(2, ',', ' ') }} € HT</span>
</div>
{% endfor %}
</div>
{% endif %}
</div>
<div class="mt-6 border-t border-slate-200 pt-4 space-y-2">