@extends('layouts.app') @section('content')

Tableau de bord Administrateur

Total Clients

{{ $totalClients }}

Agents

{{ $totalAgents }}

Abonnements Actifs

{{ $abonnementsActifs }}

Expirent bientôt

{{ $abonnementsExpirant }}

Indicateurs de Chiffre d'Affaires

Analyse comparative abonnements vs paiements

CA Abonnements

{{ number_format($caAbonnements, 0, ',', ' ') }} FCFA

Valeur des abonnements souscrits

CA Paiements

{{ number_format($caPaiements, 0, ',', ' ') }} FCFA

Paiements effectivement perçus

Différence

@php $difference = $caAbonnements - $caPaiements; $couleur = $difference > 0 ? 'text-orange-600' : 'text-purple-600'; $icon = $difference > 0 ? 'fa-arrow-up' : 'fa-arrow-down'; $texte = $difference > 0 ? 'En attente' : 'Avoir'; @endphp

{{ number_format(abs($difference), 0, ',', ' ') }} FCFA

{{ $texte }}

Comprendre les indicateurs

CA Abonnements: Montant total des abonnements souscrits ce mois
CA Paiements: Montant réellement encaissé ce mois
Différence: Écart entre le théorique et le réel (impayés ou avoirs)

Actions rapides

Nouveau Client

Voir Clients

Abonnements

Rapports

État des Abonnements Clients

Visualisation en temps réel de la progression

@foreach($clients as $client) @php // Récupérer tous les abonnements actifs du client $abonnementsActifs = $client->abonnements_actifs; $hasMultipleAbonnements = $abonnementsActifs->count() > 1; $principalAbonnement = $abonnementsActifs->first(); // Préparer les données pour le modal $abonnementsData = []; foreach ($abonnementsActifs as $abonnement) { $now = \Carbon\Carbon::now(); $dateFin = \Carbon\Carbon::parse($abonnement->date_fin); $joursTotal = $abonnement->date_debut->diffInDays($abonnement->date_fin); $joursRestants = $now->diffInDays($dateFin, false); $pourcentageTemps = $joursRestants > 0 ? min(100, ($joursTotal - $joursRestants) / $joursTotal * 100) : 100; $totalPaye = $abonnement->paiements->sum('montant'); $difference = $totalPaye - $abonnement->prix; if ($joursRestants < 0) { $couleur = 'text-red-500'; $icon = 'fa-exclamation-triangle'; } elseif ($joursRestants <= 7) { $couleur = 'text-orange-500'; $icon = 'fa-clock'; } else { $couleur = 'text-green-500'; $icon = 'fa-check-circle'; } if ($joursRestants < 0) { $formatJours = 'Expiré'; } else { $mois = floor($joursRestants / 30); $semaines = floor(($joursRestants % 30) / 7); $jours = $joursRestants % 7; $formatJours = ''; if ($mois > 0) $formatJours .= $mois . 'M '; if ($semaines > 0) $formatJours .= $semaines . 'S '; if ($jours > 0 || ($mois == 0 && $semaines == 0)) $formatJours .= $jours . 'J'; $formatJours = trim($formatJours); } $abonnementsData[] = [ 'id' => $abonnement->id, 'type_abonnement' => $abonnement->type_abonnement, 'prix' => number_format($abonnement->prix, 0, '', ' '), 'total_paye' => number_format($totalPaye, 0, '', ' '), 'difference' => $difference, 'date_debut' => $abonnement->date_debut->format('d/m/Y'), 'date_fin' => $abonnement->date_fin->format('d/m/Y'), 'pourcentage_temps' => round($pourcentageTemps), 'couleur' => $couleur, 'icon' => $icon, 'jours_restants' => $formatJours, 'prix_num' => $abonnement->prix, 'total_paye_num' => $totalPaye ]; } if ($principalAbonnement) { $now = \Carbon\Carbon::now(); $dateFin = \Carbon\Carbon::parse($principalAbonnement->date_fin); $joursTotal = $principalAbonnement->date_debut->diffInDays($principalAbonnement->date_fin); $joursRestants = $now->diffInDays($dateFin, false); // Calcul du pourcentage de progression temporelle $pourcentageTemps = $joursRestants > 0 ? min(100, ($joursTotal - $joursRestants) / $joursTotal * 100) : 100; // Calcul du ratio paiement/abonnement $totalPaye = $principalAbonnement->paiements->sum('montant'); $prixAbonnement = $principalAbonnement->prix; $ratioPaiement = $prixAbonnement > 0 ? min(100, ($totalPaye / $prixAbonnement) * 100) : 0; $difference = $totalPaye - $prixAbonnement; // Format des jours restants if ($joursRestants < 0) { $formatJours = 'Expiré'; } else { $mois = floor($joursRestants / 30); $semaines = floor(($joursRestants % 30) / 7); $jours = $joursRestants % 7; $formatJours = ''; if ($mois > 0) $formatJours .= $mois . 'M '; if ($semaines > 0) $formatJours .= $semaines . 'S '; if ($jours > 0 || ($mois == 0 && $semaines == 0)) $formatJours .= $jours . 'J'; $formatJours = trim($formatJours); } // Déterminer la couleur en fonction des jours restants if ($joursRestants < 0) { $couleur = 'text-red-500'; $couleurBg = 'bg-red-500'; $couleurStatut = 'bg-red-100 text-red-800'; $texteStatut = 'Expiré'; $icon = 'fa-exclamation-triangle'; } elseif ($joursRestants <= 7) { $couleur = 'text-orange-500'; $couleurBg = 'bg-orange-500'; $couleurStatut = 'bg-orange-100 text-orange-800'; $texteStatut = $formatJours; $icon = 'fa-clock'; } else { $couleur = 'text-green-500'; $couleurBg = 'bg-green-500'; $couleurStatut = 'bg-green-100 text-green-800'; $texteStatut = $formatJours; $icon = 'fa-check-circle'; } } @endphp
@if($hasMultipleAbonnements)
@endif
@if($principalAbonnement)
{{ number_format($pourcentageTemps, 0) }}%
@else
@endif

{{ $client->prenom }} {{ $client->nom }}

{{ $client->contact }}

{{ $client->engin_type }}

@if($principalAbonnement) {{ $texteStatut }}

{{ $principalAbonnement->date_fin->format('d/m/Y') }}

@else Sans abonnement @endif
@if($principalAbonnement)
Payé: {{ number_format($totalPaye, 0) }} F Abmt: {{ number_format($prixAbonnement, 0) }} F
@if($totalPaye >= $prixAbonnement)
@if($difference > 0)
@endif @else
@endif
@if($difference >= 0) Solde: +{{ number_format($difference, 0) }} F @else Dû: {{ number_format(abs($difference), 0) }} F @endif
@endif
@if($principalAbonnement) @else Abonnement @endif @if($abonnementsActifs->count() > 0) @endif
@endforeach

Guide de lecture

Cercles de progression

Temps écoulé
70% du temps passé
Presque expiré
20% du temps restant

Barres de progression

Payé: 15 000 F Abmt: 10 000 F
Solde: +5 000 F
Excédent de paiement (bleu)
Payé: 7 000 F Abmt: 10 000 F
Dû: 3 000 F
Paiement incomplet
@endsection