```
✨ feat(Product): Ajoute la publication des produits et les périodes bloquées
Ajoute la possibilité de publier ou masquer un produit.
Permet de bloquer des périodes pour un produit.
Corrige des bugs liés à la suppression des produits du panier.
Mise à jour de l'affichage du calendrier pour les blocages.
```
This commit is contained in:
@@ -5,6 +5,35 @@
|
||||
|
||||
{% block actions %}
|
||||
<div class="flex items-center gap-4">
|
||||
{% if product is defined and product is not null and product.id %}
|
||||
<div class="flex items-center">
|
||||
{% if not product.isPublish %}
|
||||
<div class="flex items-center bg-white/5 backdrop-blur-xl border border-rose-500/30 rounded-2xl overflow-hidden shadow-xl">
|
||||
<div class="flex items-center px-5 py-3 space-x-3 bg-rose-500/5">
|
||||
<div class="w-2 h-2 rounded-full bg-rose-500 shadow-[0_0_8px_rgba(244,63,94,0.8)]"></div>
|
||||
<span class="text-[10px] font-black text-rose-500 uppercase tracking-widest">Hors ligne</span>
|
||||
</div>
|
||||
<a data-turbo="false" href="{{ path('app_crm_product_edit', {id: product.id, act: 'togglePublish', status: 'true'}) }}"
|
||||
class="px-6 py-3 bg-emerald-600 hover:bg-emerald-500 text-white text-[10px] font-black uppercase tracking-widest transition-all active:scale-95 border-l border-white/5">
|
||||
Publier
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="flex items-center bg-white/5 backdrop-blur-xl border border-emerald-500/30 rounded-2xl overflow-hidden shadow-xl">
|
||||
<div class="flex items-center px-5 py-3 space-x-3 bg-emerald-500/5">
|
||||
<div class="w-2 h-2 rounded-full bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.8)] animate-pulse"></div>
|
||||
<span class="text-[10px] font-black text-emerald-400 uppercase tracking-widest">En ligne</span>
|
||||
</div>
|
||||
<a data-turbo="false" href="{{ path('app_crm_product_edit', {id: product.id, act: 'togglePublish', status: 'false'}) }}"
|
||||
onclick="return confirm('Voulez-vous vraiment masquer ce produit ?')"
|
||||
class="px-6 py-3 bg-white/5 hover:bg-rose-600 text-slate-400 hover:text-white text-[10px] font-black uppercase tracking-widest transition-all active:scale-95 border-l border-white/10">
|
||||
Désactiver
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if product.slug != "" %}
|
||||
<a target="_blank" rel="nofollow"
|
||||
href="https://reservation.ludikevent.fr{{ path('reservation_product_show', {id: product.slug}) }}"
|
||||
@@ -172,7 +201,7 @@
|
||||
<div class="flex justify-between items-center mt-1 px-1 {{ form.priceDay.vars.value ? '' : 'hidden' }}">
|
||||
<p class="text-[9px] text-slate-500 italic" title="Pour les cartes standard de l'Espace économique européen">Com. Stripe (EEE) : 1,5% + 0,25€</p>
|
||||
<p class="text-[10px] font-bold text-slate-400 commission-display">
|
||||
~ {{ ((form.priceDay.vars.value * 0.015) + 0.25)|number_format(2, ',', ' ') }} €
|
||||
~ {{ ((form.priceDay.vars.value|default(0) * 0.015) + 0.25)|number_format(2, ',', ' ') }} €
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -186,7 +215,7 @@
|
||||
<div class="flex justify-between items-center mt-1 px-1 {{ form.priceSup.vars.value ? '' : 'hidden' }}">
|
||||
<p class="text-[9px] text-slate-500 italic" title="Pour les cartes standard de l'Espace économique européen">Com. Stripe (EEE) : 1,5% + 0,25€</p>
|
||||
<p class="text-[10px] font-bold text-slate-400 commission-display">
|
||||
~ {{ ((form.priceSup.vars.value * 0.015) + 0.25)|number_format(2, ',', ' ') }} €
|
||||
~ {{ ((form.priceSup.vars.value|default(0) * 0.015) + 0.25)|number_format(2, ',', ' ') }} €
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -425,5 +454,86 @@
|
||||
{{ form_end(formPhoto) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# 07. PÉRIODES BLOQUÉES #}
|
||||
{% if formBlocked is defined %}
|
||||
<div class="backdrop-blur-xl bg-[#1e293b]/40 border border-white/5 rounded-[2.5rem] p-8 shadow-2xl mt-8">
|
||||
<h3 class="text-lg font-bold text-white mb-6 flex items-center">
|
||||
<span class="w-8 h-8 bg-rose-600/20 text-rose-500 rounded-lg flex items-center justify-center mr-3 text-[10px] font-black">07</span>
|
||||
Indisponibilités & Blocages
|
||||
</h3>
|
||||
|
||||
{# LISTE DES BLOCAGES #}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-10">
|
||||
{% for blocked in product.productBlockeds %}
|
||||
<div class="relative group p-6 rounded-2xl border border-white/5 bg-white/5 hover:bg-white/10 transition-all flex flex-col justify-between">
|
||||
<div>
|
||||
<div class="flex items-center gap-3 mb-4">
|
||||
<div class="w-8 h-8 rounded-lg bg-rose-500/20 text-rose-500 flex items-center justify-center">
|
||||
<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 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||
</div>
|
||||
<span class="text-[10px] font-black uppercase tracking-widest text-white">Indisponible</span>
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<p class="text-xs text-slate-400">Du <strong class="text-white">{{ blocked.dateStart|date('d/m/Y H:i') }}</strong></p>
|
||||
<p class="text-xs text-slate-400">Au <strong class="text-white">{{ blocked.dateEnd|date('d/m/Y H:i') }}</strong></p>
|
||||
</div>
|
||||
{% if blocked.reason %}
|
||||
<p class="mt-4 text-[10px] text-slate-500 italic border-l-2 border-slate-700 pl-3">
|
||||
{{ blocked.reason }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# DELETE BUTTON BLOCKED #}
|
||||
<div class="absolute top-3 right-3 opacity-0 group-hover:opacity-100 transition-all">
|
||||
<form data-turbo="false" method="post" action="{{ path('app_crm_product_edit', {'id': product.id, act:'deleteBlocked', idBlocked: blocked.id}) }}"
|
||||
onsubmit="return confirm('Supprimer ce blocage ?');" class="inline-block">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ blocked.id) }}">
|
||||
<button type="submit" class="p-2 text-slate-400 hover:text-rose-500 transition-colors" title="Supprimer">
|
||||
<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="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
||||
</svg>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-span-full py-8 text-center border-2 border-dashed border-white/5 rounded-3xl">
|
||||
<p class="text-[10px] font-black text-slate-600 uppercase tracking-[0.2em]">Aucune période bloquée</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="h-px bg-white/5 w-full mb-10"></div>
|
||||
|
||||
{# FORMULAIRE D'AJOUT BLOCAGE #}
|
||||
{{ form_start(formBlocked) }}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 items-start">
|
||||
<div>
|
||||
{{ form_label(formBlocked.dateStart, 'Début du blocage', {'label_attr': {'class': 'text-[10px] font-black text-slate-300 uppercase tracking-[0.2em] ml-1 mb-2 block'}}) }}
|
||||
{{ form_widget(formBlocked.dateStart, {'attr': {'class': 'w-full bg-slate-900/50 border-white/5 rounded-2xl text-white focus:ring-rose-500/20 focus:border-rose-500 transition-all py-4 px-5 font-bold text-sm'}}) }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ form_label(formBlocked.dateEnd, 'Fin du blocage', {'label_attr': {'class': 'text-[10px] font-black text-slate-300 uppercase tracking-[0.2em] ml-1 mb-2 block'}}) }}
|
||||
{{ form_widget(formBlocked.dateEnd, {'attr': {'class': 'w-full bg-slate-900/50 border-white/5 rounded-2xl text-white focus:ring-rose-500/20 focus:border-rose-500 transition-all py-4 px-5 font-bold text-sm'}}) }}
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2">
|
||||
{{ form_label(formBlocked.reason, 'Raison (Optionnel)', {'label_attr': {'class': 'text-[10px] font-black text-slate-300 uppercase tracking-[0.2em] ml-1 mb-2 block'}}) }}
|
||||
{{ form_widget(formBlocked.reason, {'attr': {'placeholder': 'Ex: Maintenance annuelle, Réparation...', 'class': 'w-full bg-slate-900/50 border-white/5 rounded-2xl text-white focus:ring-rose-500/20 focus:border-rose-500 transition-all py-4 px-5 font-medium text-sm min-h-[100px]'}}) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-8 flex justify-end">
|
||||
<button type="submit" class="group px-8 py-4 bg-rose-600/10 hover:bg-rose-600 text-rose-500 hover:text-white text-[10px] font-black uppercase tracking-widest rounded-2xl transition-all border border-rose-500/20 flex items-center">
|
||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M12 4v16m8-8H4"/></svg>
|
||||
Bloquer cette période
|
||||
</button>
|
||||
</div>
|
||||
{{ form_end(formBlocked) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user