{# Fragment: BL detail panel for pending split layout #}
{# Header #}

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

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

{% include 'components/_status_badge.html.twig' with { label: bonLivraison.statut.label, variant: bonLivraison.statut.color, size: 'sm' } only %}
{# Stats #}
{{ bonLivraison.lignes|length }} Lignes
{{ alertCount }} Alertes
{{ bonLivraison.totalHt ? bonLivraison.totalHt|number_format(2, ',', ' ') ~ ' €' : '—' }} Total HT
{# Lines table #}
Lignes BL a valider
{% if bonLivraison.statut.value == 'ANOMALIE' and is_granted('MANAGE', bonLivraison.etablissement) %} {% endif %} {% set showCheckboxes = bonLivraison.statut.value == 'ANOMALIE' and is_granted('MANAGE', bonLivraison.etablissement) %} {% for ligne in bonLivraison.lignes %} {% set hasAlert = ligne.alertes|length > 0 %} {% set isEcart = false %} {% set prixMercuriale = null %} {% set ecartPct = null %} {% for alerte in ligne.alertes %} {% if alerte.typeAlerte.value in ['ECART_PRIX', 'ECART_QUANTITE'] %} {% set isEcart = true %} {% endif %} {% if alerte.valeurAttendue %} {% set prixMercuriale = alerte.valeurAttendue %} {% endif %} {% if alerte.ecartPct %} {% set ecartPct = alerte.ecartPctAsFloat %} {% endif %} {% endfor %} {% if showCheckboxes %} {% endif %} {% else %} {% endfor %}
Code Designation Qte PU BL PU Mercuriale Ecart Total HT
{{ 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, ',', ' ') }} €
Aucune ligne extraite
{# Actions #}
{% if bonLivraison.statut.value == 'BROUILLON' and is_granted('MANAGE', bonLivraison.etablissement) %}
{% endif %} {% if bonLivraison.statut.value == 'ANOMALIE' and is_granted('MANAGE', bonLivraison.etablissement) %}
Avoir {% else %} {% endif %}
{% if bonLivraison.statut.value == 'ANOMALIE' and is_granted('MANAGE', bonLivraison.etablissement) %} {% endif %}