{% extends 'admin/hub/layout.html.twig' %} {% set hub_title = 'Avoirs fournisseur' %} {% set hub_breadcrumbs = [ { label: 'Bons de livraison', url: path('app_bl_hub') }, { label: 'Avoirs fournisseur', url: path('app_avoirs_hub') }, { label: 'Liste', url: path('app_avoirs_liste') }, { label: avoir.reference ?? 'Avoir #' ~ avoir.idAsString[:8] } ] %} {% block title %}{{ avoir.reference ?? 'Avoir' }} — Mercuriale.io{% endblock %} {% block stylesheets %} {{ parent() }} {% endblock %} {% block hub_content %}
{# Header #}

{{ avoir.reference ?? 'Avoir #' ~ avoir.idAsString[:8] }}

{{ avoir.fournisseur ? avoir.fournisseur.nom : '' }} — {{ avoir.etablissement.nom }} — Demande le {{ avoir.demandeLe|date('d/m/Y') }}

{% include 'components/_status_badge.html.twig' with { label: avoir.statut.label, variant: avoir.statut.color } only %}
{# Stats row #}
{{ avoir.nombreLignes }}
Lignes
{{ avoir.montantHt ? avoir.montantHt|number_format(2, ',', ' ') ~ ' €' : '—' }}
Montant HT
{% if avoir.montantTtc %}
{{ avoir.montantTtc|number_format(2, ',', ' ') }} €
Montant TTC
{% endif %}
{# Info grid #}
Fournisseur
{{ avoir.fournisseur ? avoir.fournisseur.nom : '—' }}
Etablissement
{{ avoir.etablissement.nom }}
Reference
{{ avoir.reference ?? '—' }}
Motif
{% if avoir.motif %} {% include 'components/_status_badge.html.twig' with { label: avoir.motif.label, variant: avoir.motif.color, size: 'sm' } only %} {% else %} — {% endif %}
BL d'origine
{% if avoir.bonLivraison %} {{ avoir.bonLivraison.numeroBl ?? 'BL #' ~ avoir.bonLivraison.id }} {% else %} — {% endif %}
Demande le
{{ avoir.demandeLe|date('d/m/Y') }}
{% if avoir.recuLe %}
Recu le
{{ avoir.recuLe|date('d/m/Y') }}
{% endif %} {% if avoir.imputeLe %}
Impute le
{{ avoir.imputeLe|date('d/m/Y') }}
{% endif %} {% if avoir.montantTva %}
Montant TVA
{{ avoir.montantTva|number_format(2, ',', ' ') }} €
{% endif %} {% if avoir.createdBy %}
Cree par
{{ avoir.createdBy.prenom ?? '' }} {{ avoir.createdBy.nom ?? avoir.createdBy.email }}
{% endif %} {% if avoir.validatedBy %}
Valide par
{{ avoir.validatedBy.prenom ?? '' }} {{ avoir.validatedBy.nom ?? avoir.validatedBy.email }}
{% endif %}
{# Commentaire #} {% if avoir.commentaire %}
Commentaire

{{ avoir.commentaire }}

{% endif %} {# Lines table #}
Lignes de l'avoir ({{ avoir.nombreLignes }})
{% if avoir.lignes|length > 0 %}
{% for ligne in avoir.lignes %} {% endfor %}
Designation Quantite PU ecart Montant
{{ ligne.designation }} {{ ligne.quantite|number_format(2, ',', ' ') }} {{ ligne.prixUnitaire|number_format(4, ',', ' ') }} € {{ ligne.montantLigne|number_format(2, ',', ' ') }} €
Total HT : {{ avoir.montantHt ? avoir.montantHt|number_format(2, ',', ' ') ~ ' €' : '—' }}
{% else %}
Aucune ligne enregistree.
{% endif %}
{# Flash messages #} {% for message in app.flashes('success') %}
{{ message }}
{% endfor %} {% for message in app.flashes('error') %}
{{ message }}
{% endfor %} {# Actions #}
Retour a la liste {% if is_granted('MANAGE', avoir.etablissement) %} {% if avoir.statut.value == 'DEMANDE' %} Enregistrer la reception {% endif %} {% if avoir.statut.value == 'RECU' %}
{% endif %} {% endif %}
{# Hidden forms — refuser / annuler #} {% if is_granted('MANAGE', avoir.etablissement) %} {% if avoir.statut.value == 'DEMANDE' %} {% endif %} {% if avoir.statut.value in ['DEMANDE', 'RECU'] %} {% endif %} {% endif %}
{% endblock %}