{% extends 'admin/hub/layout.html.twig' %} {% set hub_title = 'Bons de livraison' %} {% set hub_breadcrumbs = [ { label: 'Bons de livraison', url: path('app_bl_hub') }, { label: bonLivraison.numeroBl ? 'BL ' ~ bonLivraison.numeroBl : 'BL #' ~ bonLivraison.id } ] %} {% block title %}{{ bonLivraison.numeroBl ? 'BL ' ~ bonLivraison.numeroBl : 'BL #' ~ bonLivraison.id }} — Mercuriale.io{% endblock %} {% block stylesheets %} {{ parent() }} {% endblock %} {% block hub_content %}
{# Header #}

{{ bonLivraison.numeroBl ? 'BL ' ~ bonLivraison.numeroBl : 'BL #' ~ bonLivraison.id }}

{% if bonLivraison.fournisseur %}{{ bonLivraison.fournisseur.nom }} — {% endif %} {{ bonLivraison.etablissement.nom }} {% if bonLivraison.dateLivraison %} — {{ bonLivraison.dateLivraison|date('d/m/Y') }}{% endif %}

{% include 'components/_status_badge.html.twig' with { label: bonLivraison.statut.label, variant: bonLivraison.statut.color } only %}
{# Stats row #}
{{ bonLivraison.lignes|length }}
Lignes
{{ alertCount }}
Alertes
{{ bonLivraison.totalHt ? bonLivraison.totalHt|number_format(2, ',', ' ') ~ ' €' : '—' }}
Total HT
{# Lines table #}
Lignes du bon de livraison
{% for ligne in bonLivraison.lignes %} {% set hasAlert = ligne.alertes|length > 0 %} {% set prixMercuriale = null %} {% set ecartPct = null %} {% for alerte in ligne.alertes %} {% if alerte.valeurAttendue %} {% set prixMercuriale = alerte.valeurAttendue %} {% endif %} {% if alerte.ecartPct %} {% set ecartPct = alerte.ecartPctAsFloat %} {% endif %} {% endfor %} {% endfor %}
Code Designation Qte PU BL PU Mercuriale Ecart Total HT Statut
{{ ligne.codeProduitBl ?? '—' }} {{ ligne.designationBl }} {{ ligne.quantiteLivree|number_format(2, ',', ' ') }} {% if ligne.unite %}{{ ligne.unite }}{% endif %} {{ ligne.prixUnitaire|number_format(4, ',', ' ') }} € {% if prixMercuriale %} {{ prixMercuriale|number_format(4, ',', ' ') }} € {% else %} {% endif %} {% if ecartPct is not null %} {% include 'components/_variance_indicator.html.twig' with { value: ecartPct, threshold: 5.0, size: 'sm' } only %} {% else %} {% endif %} {{ ligne.totalLigne|number_format(2, ',', ' ') }} € {% include 'components/_status_badge.html.twig' with { label: ligne.statutControle.label, variant: ligne.statutControle.color, size: 'sm' } only %}
{# Action buttons #}
{% if bonLivraison.statut.value == 'BROUILLON' and is_granted('MANAGE', bonLivraison.etablissement) %}
{% endif %} {% if bonLivraison.avoirs is not empty %} {% for avoir in bonLivraison.avoirs %} Avoir {{ avoir.reference ?? '#' ~ avoir.idAsString[:8] }} — {{ avoir.demandeLe|date('d/m/Y') }} {% endfor %} {% elseif bonLivraison.statut.value == 'ANOMALIE' and is_granted('MANAGE', bonLivraison.etablissement) %} Demander un avoir {% endif %}
{% endblock %}