@extends('layouts.exat') @section('title', 'Tableau de bord') @section('subtitle', 'Vue d\'ensemble des avances') @php $fcfa = fn ($n) => number_format((float) $n, 0, ',', ' '); $statutMeta = [ 'BROUILLON' => ['Brouillon', '#94a3b8'], 'SOUMISE' => ['Soumise', '#3b82f6'], 'EN_VALIDATION' => ['En validation', '#f59e0b'], 'VALIDEE' => ['Validée', '#10b981'], 'REJETEE' => ['Rejetée', '#ef4444'], 'ANNULEE' => ['Annulée', '#cbd5e1'], 'DECAISSEE' => ['Décaissée', '#6366f1'], 'EN_REMBOURSEMENT' => ['En remboursement', '#06b6d4'], 'SOLDEE' => ['Soldée', '#22c55e'], 'EN_DEFAUT' => ['En défaut', '#f43f5e'], ]; @endphp @section('content') {{-- Filtre date --}}
@include('partials._filtre-date') @if(request()->hasAny(['periode', 'date', 'date_debut', 'date_fin', 'semaine', 'mois', 'annee'])) Réinitialiser @endif
{{-- Tuiles --}}
Total demandes
{{ $fcfa($total) }}
Montant demandé
{{ $fcfa($montantTotal) }}FCFA
{{ $enAttente }} en attente · {{ $validees }} validées
Montant décaissé
{{ $fcfa($montantDecaisse) }}FCFA
Remboursé : {{ $fcfa($montantRembourse) }} FCFA
Taux de recouvrement
{{ number_format($taux, 1, ',', ' ') }} %
{{-- Graphes --}}
{{-- Donut répartition par statut --}}

Répartition par statut

@php $somme = array_sum($repartition); @endphp @if($somme > 0)
@php $r = 54; $c = 2 * M_PI * $r; $cum = 0; @endphp @foreach($repartition as $statut => $n) @php $frac = $n / $somme; $len = $frac * $c; $startDeg = $cum * 360 - 90; $cum += $frac; $color = $statutMeta[$statut][1] ?? '#94a3b8'; @endphp @endforeach {{ $somme }} demandes
@foreach($repartition as $statut => $n)
{{ $statutMeta[$statut][0] ?? $statut }} {{ $n }} {{ round($n / $somme * 100) }}%
@endforeach
@else

Aucune donnée pour le moment.

@endif
{{-- Barres évolution mensuelle --}}

Évolution mensuelle (montants demandés)

@php $maxM = max(array_map(fn ($m) => $m['montant'], $mois)) ?: 1; @endphp @foreach($mois as $i => $m) @php $bw = 34; $gap = 20; $x = 44 + $i * ($bw + $gap); $h = $maxM > 0 ? round($m['montant'] / $maxM * 108) : 0; $y = 140 - $h; @endphp {{ $m['label'] }} @if($m['montant'] > 0) {{ round($m['montant'] / 1000) }}k @endif @endforeach
{{-- Top objets + récentes --}}

Top objets (par montant)

@php $maxObj = $topObjets->max('m') ?: 1; @endphp @forelse($topObjets as $o)
{{ $o->objet }} {{ $fcfa($o->m) }} FCFA · {{ $o->n }}
@empty

Aucun objet renseigné.

@endforelse

Demandes récentes

Voir tout
@forelse($recentes as $d)
{{ $d->planteur->nom ?? '—' }}
{{ $d->reference }} · {{ $d->objet ?? '—' }}
{{ $fcfa($d->montant) }}
@empty

Aucune demande.

@endforelse
@endsection