{% extends '@admin/base.html.twig' %} {% block subheader %}

Dashboard

{% endblock %} {% block breadcrumb %}{% endblock %} {% block bodycontent %}
{# ======================== Groupe 1 : Statuts Commandes/Échanges ======================== #}
Commandes & échanges par statut
{# ===== Colonne 1 : Commandes ===== #}
Commandes
{% set cardsCommande = [ {'label':'En Attente','icon':'fa fa-clock','route':path('document_index', {'type':'commande','category':'client','statut':'en-attente','date':'All'}),'count': Globals.getCountDocumentByType("commande","en-attente").count, 'alert':'alert-en-attente'}, {'label':'Accepté','icon':'fa fa-check-circle','route':path('document_index', {'type':'commande','category':'client','statut':'accepte','date':'All'}),'count': Globals.getCountDocumentByType("commande","accepte").count, 'alert':'alert-accepte'}, {'label':'À Expédier','icon':'fa fa-truck','route':path('document_index', {'type':'commande','category':'client','statut':'a-expedier','date':'All'}),'count': Globals.getCountDocumentByType("commande","a-expedier").count, 'alert':'alert-a-expedier'}, {'label':'Retour En Cours','icon':'fa fa-reply','route':path('document_index', {'type':'commande','category':'client','statut':'retour-en-cours','date':'All'}),'count': Globals.getCountDocumentByType("commande","retour-en-cours").count, 'alert':'alert-retour-en-cours'} ] %} {% for item in cardsCommande %} {{ item.label }} {{ item.count }} {% endfor %}
{# ===== Colonne 2 : Échanges ===== #}
Échanges
{% set cardsEchange = [ {'label':'BEC En Attente','icon':'fa fa-clock','route':path('document_index', {'type':'echange','category':'client','statut':'en-attente','date':'All'}),'count': Globals.getCountDocumentByType("echange","en-attente").count, 'alert':'alert-en-attente'}, {'label':'BEC Accepté','icon':'fa fa-check-circle','route':path('document_index', {'type':'echange','category':'client','statut':'accepte','date':'All'}),'count': Globals.getCountDocumentByType("echange","accepte").count, 'alert':'alert-accepte'}, {'label': 'BC À Expédier', 'icon': 'fa fa-truck', 'route': path('document_index', {'type': 'echange', 'category': 'client', 'statut': 'a-expedier', 'date': 'All'}), 'count': Globals.getCountDocumentByType('echange', 'a-expedier').count, 'alert': 'alert-a-expedier' }, {'label':'BEC Non Reçu','icon':'fa fa-exclamation-circle','route':path('document_index', {'type':'echange','category':'client','statut':'expedie','date':'All'}),'count': Globals.getCountDocumentByType("echange","Expédié").count, 'alert':'alert-echange-non-recu'} ] %} {% for item in cardsEchange %} {{ item.label }} {{ item.count }} {% endfor %}
{# ======================== Groupe 2 : KPIs du jour ======================== #}
KPIs du jour : Aujourd'hui
Nb Commandes
{{ nbCommandeJour|default(0) }}
{# ➜ NOUVELLE CARTE : Nb d'échanges aujourd'hui #}
Nb d'Échanges
{{ nbEchangeJour|default(0) }}
{% if is_granted('ROLE_SUPER_ADMIN') or is_granted('STATISTIQUE') %}
Total ventes (Sans frais)
{# === Bases de calcul === #} {% set totalAvec = (totalVenteAvecFrais is defined and totalVenteAvecFrais is not null) ? totalVenteAvecFrais : totalVente %} {% set totalSans = totalVenteSansFrais|default(0) %} {% set fraisLiv = (totalAvec - totalSans)|default(0) %} {# === Montant principal : SANS frais (affiché en premier) === #}
{{ totalSans|number_format(3, '.', ' ') }} TND
{# === Détails : AVEC frais & Frais de livraison === #}
Avec frais
{{ totalAvec|number_format(3, '.', ' ') }} TND
Frais de livraison
{{ (fraisLiv > 0 ? fraisLiv : 0)|number_format(3, '.', ' ') }} TND
{% endif %}
Produits
{{ countProduit|default(0) }}
En stock
{% if is_granted('ROLE_SUPER_ADMIN') or is_granted('STATISTIQUE') %}
Clients
{{ countClient|number_format(0, '.', ',') }}
Total inscrits
{% endif %}
Utilisateurs connectés
{{ nbUsersConnectes|default(0) }}
{% if is_granted('ROLE_SUPER_ADMIN') %} {# ====================== Rangée à 2 colonnes : Activités & Historique connexions ====================== #}
{# ========================= Colonne 1/2 : ACTIVITÉS ÉQUIPE ========================= #}
Activités de votre équipe
{# Barre outil compacte : select étroit + dates en ligne #}
{# Select compact (largeur réduite) #} {# Dates + bouton sur la même ligne (masquées par défaut) #}
{# Contenu remplacé via AJAX #}
{% include '@admin/dashboard/_activities_timeline.html.twig' with {'activities': todayActivities|default([])} %}
{# ========================= Colonne 2/2 : HISTORIQUE CONNEXIONS (AJAX) ========================= #}
Historique de connexion
{# Barre outils en ligne : user + période + dates custom #}
{# Dates custom + bouton (masqué tant que période ≠ custom) #}
{# Conteneur AJAX #}
{% endif %}
{% endblock %} {% block js %} {{ parent() }} {% endblock %}