{{ \App\Support\Fg::dateLongueFr(now()) }} · {{ now()->format('H:i') }} @php use App\Support\Fg; $steps = \App\Livewire\Cmu\Facturation\DashboardFacturation::STEPS; // Pour le graphique quotidien : jour max pour le scaling. $maxJour = max($activite_jours ?: [0]) ?: 1; $nbJours = count($activite_jours); // Largeur du SVG 740, bar 20 + gap 4 = 24/bar ; offset initial 10 $largeurBar = 20; $gap = 4; $offsetX = 10; $hauteurChart = 160; // hauteur utile, max bar height // Donut : circonférence = 2πr avec r=44 → 276.46 $circumference = 276.46; $dashoffsetCumul = 0; $moisLabel = \App\Services\Cmu\CaisseService::formaterPeriodeHumaine($periode_active); $moisLabelCap = \Illuminate\Support\Str::ucfirst($moisLabel); @endphp
{{-- ================= Page header ================= --}} Performance AMU {{ $etablissement->nom_officiel }} @if(session('success'))
{{ session('success') }}
@endif {{-- ================= Sélecteur période ================= --}}
— {{ $moisLabelCap }}
{{-- ================= KPI row ================= --}}
Part AMU du mois
{{ number_format($stats['total_cmu_gnf'], 0, ',', "\u{00A0}") }}GNF
RGB {{ Fg::gnfCourt($stats['ventilation_rgb_gnf']) }} · RAM {{ Fg::gnfCourt($stats['ventilation_ram_gnf']) }}
Prises en charge
{{ $stats['nombre_pec'] }}
sur {{ $moisLabelCap }}
Bénéficiaires
{{ $stats['beneficiaires_uniques'] }}
uniques
Ticket moyen AMU
{{ number_format($stats['ticket_moyen_cmu'], 0, ',', "\u{00A0}") }}GNF
@if($delai_moyen_paiement !== null) Délai paiement moyen · {{ $delai_moyen_paiement }} j @else Pas encore de remboursement payé @endif
{{-- ================= Hero remboursement ================= --}}
{{-- pattern or décoratif en haut-droite --}} {{-- Top : titre/description | montant --}}
Dossier de remboursement @if($dossier) · {{ $dossier->numero_dossier }} @endif

{{ $moisLabelCap }} @if($dossier) — {{ str_replace('_', ' ', strtolower($dossier->statut)) }} @else — en cours de constitution @endif

@if($dossier === null) Le dossier sera consolidé automatiquement le 1er du mois suivant. Vous pourrez alors le transmettre à la Caisse nationale AMU pour règlement sous 15 jours ouvrés. @elseif($dossier->statut === 'EN_COURS_DE_FINALISATION') Dossier prêt à être transmis. Vérifiez les {{ $dossier->nombre_pec }} prises en charge puis cliquez sur « Soumettre à la Caisse ». @elseif($dossier->statut === 'SOUMIS_CAISSE') Dossier en cours d'instruction à la Caisse nationale. Délai indicatif : 5 à 10 jours ouvrés. @elseif(in_array($dossier->statut, ['APPROUVE', 'APPROUVE_PARTIELLEMENT'])) Dossier approuvé par la Caisse. Mise en paiement imminente. @elseif($dossier->statut === 'EN_ATTENTE_PAIEMENT') Paiement ordonnancé. Virement bancaire sous quelques jours. @elseif($dossier->statut === 'PAYE') Dossier payé le {{ $dossier->date_paiement ? Fg::dateFr($dossier->date_paiement) : '—' }}. @elseif($dossier->statut === 'RETOURNE_POUR_COMPLEMENT') Dossier retourné pour complément. Motif : {{ $dossier->motif_retour_ou_rejet ?: 'non précisé' }}. @elseif($dossier->statut === 'REJETE') Dossier rejeté. Motif : {{ $dossier->motif_retour_ou_rejet ?: 'non précisé' }}. @endif

Montant à rembourser
{{ number_format($stats['total_cmu_gnf'], 0, ',', "\u{00A0}") }}GNF
{{ $stats['nombre_pec'] }} prise{{ $stats['nombre_pec'] > 1 ? 's' : '' }} en charge · {{ $stats['beneficiaires_uniques'] }} bénéficiaire{{ $stats['beneficiaires_uniques'] > 1 ? 's' : '' }} unique{{ $stats['beneficiaires_uniques'] > 1 ? 's' : '' }}
{{-- Stepper 6 états --}}
@foreach($steps as $idx => $label) @php $isDone = $idx < $etape_courante; $isActive = $idx === $etape_courante; $isPending = $idx > $etape_courante; @endphp
{{-- Ligne de liaison (sauf dernier) --}} @if(! $loop->last)
$isDone, 'bg-white/15' => ! $isDone, ]) style="top: 12px; left: calc(50% + 16px); right: calc(-50% + 16px);">
@endif {{-- Pastille --}}
$isDone, 'bg-white text-cmu-green-900 scale-110 ring-4 ring-white/20' => $isActive, 'bg-white/10 text-white/50 ring-1 ring-white/20' => $isPending, ])> @if($isDone) @else {{ $idx }} @endif
$isDone, 'text-white font-bold' => $isActive, 'text-white/60 font-semibold' => $isPending, ])>{{ $label }}
@endforeach
{{-- CTA row --}}
Étape {{ $etape_courante }}/6 · {{ $steps[$etape_courante] }}
@if($dossier && $dossier->pdf_dossier_chemin) @endif @if($peut_soumettre) @endif
{{-- ================= Work grid ================= --}}
{{-- LEFT : graphique quotidien + PEC récentes --}}
{{-- Graphique quotidien --}}
{{ number_format($stats['total_cmu_gnf'], 0, ',', "\u{00A0}") }}GNF
@if($stats['nombre_pec'] > 0)
Moyenne jour : {{ number_format((int) round($stats['total_cmu_gnf'] / max(1, array_sum(array_map(fn($v) => $v > 0 ? 1 : 0, $activite_jours)))), 0, ',', "\u{00A0}") }} GNF
@endif
@php $aujourdhuiJour = now()->format('Y-m') === $periode_active ? (int) now()->format('j') : null; // Ajuster la largeur de bar pour s'adapter à nbJours (28..31). $barWidth = max(8, (int) floor((740 - 20) / $nbJours) - 4); $barStep = $barWidth + 4; @endphp @foreach($activite_jours as $j => $montant) @php $x = $offsetX + ($j - 1) * $barStep; if ($montant === 0) { $h = 10; $y = 170 - $h; $fill = '#F0F0EC'; } else { $h = max(4, (int) round($montant * $hauteurChart / $maxJour)); $y = 170 - $h; $fill = ($aujourdhuiJour !== null && $j === $aujourdhuiJour) ? 'url(#barG-active-facturation)' : 'url(#barG-facturation)'; } @endphp @endforeach
1 {{ (int) floor($nbJours / 4) }} {{ (int) floor($nbJours / 2) }} {{ (int) floor($nbJours * 3 / 4) }} {{ $nbJours }}
{{-- Prises en charge récentes --}} @if($pecs_recentes->isEmpty())
Aucune prise en charge enregistrée sur la période.
@else @foreach($pecs_recentes as $p) @php $patient = $p->ayantDroit ?: $p->dossier; $nom = trim(($patient->prenoms ?? '').' '.($patient->nom ?? '')); $initiales = mb_strtoupper(mb_substr($patient->prenoms ?? 'X', 0, 1) . mb_substr($patient->nom ?? 'X', 0, 1)); $categories = $p->actes->pluck('acte.categorie')->unique()->values(); @endphp
{{ $initiales }}
{{ $nom }}
{{ Fg::ius($p->dossier->ius) }}
@foreach($categories as $c) @php $tones = [ 'CONS' => 'bg-cmu-blue-50 text-cmu-blue-700', 'BIO' => 'bg-cmu-green-50 text-cmu-green-700', 'IMG' => 'bg-cmu-gold-100 text-cmu-gold-700', 'SOI' => 'bg-cmu-green-100 text-cmu-green-800', 'PHA' => 'bg-cmu-red-100 text-cmu-red-700', 'EXP' => 'bg-cmu-gold-50 text-cmu-gold-700', ][$c] ?? 'bg-gray-100 text-cmu-ink'; $libelle = \App\Enums\Cmu\CategorieActe::tryFrom($c)?->libelle() ?? $c; @endphp {{ $libelle }} @endforeach {{ $p->date_pec->format('d/m H:i') }} {{ number_format($p->part_cmu_gnf, 0, ',', "\u{00A0}") }} {{ number_format($p->part_patient_gnf, 0, ',', "\u{00A0}") }} {{ number_format($p->total_actes_gnf, 0, ',', "\u{00A0}") }}
@if($peut_signaler) @endif
@endforeach
@endif
{{-- RIGHT : donut + historique --}}
{{-- Donut catégories --}} @if($repartition['total'] === 0)
Aucun acte enregistré — pas de ventilation possible.
@else
@php $dashoffsetCumul = 0; @endphp @foreach($repartition['items'] as $item) @php $segment = round($circumference * $item['pct'] / 100, 2); $offset = -$dashoffsetCumul; $dashoffsetCumul += $segment; @endphp @endforeach
Total
{{ Fg::gnfCourt($repartition['total']) }}
GNF · part AMU
@foreach($repartition['items'] as $item)
{{ $item['label'] }} {{ Fg::gnfCourt($item['montant']) }} {{ rtrim(rtrim(number_format($item['pct'], 1, ',', ''), '0'), ',') }} %
@endforeach
@endif
{{-- Historique dossiers --}} @if($historique->isEmpty())
Aucun dossier de remboursement antérieur.
@else
@foreach($historique as $h) @php $statutPaye = $h->statut === 'PAYE'; $moisHist = \App\Services\Cmu\CaisseService::formaterPeriodeHumaine($h->periode_mois); $moisAbbr = explode(' ', $moisHist)[0]; $jourMark = $h->date_paiement ? $h->date_paiement->format('d') : ($h->date_soumission ? $h->date_soumission->format('d') : '—'); @endphp
$statutPaye, 'bg-cmu-gold-100 text-cmu-gold-700' => ! $statutPaye, ])> {{ $jourMark }} {{ mb_substr($moisAbbr, 0, 3) }}
{{ \Illuminate\Support\Str::ucfirst($moisHist) }} {{ number_format($h->total_cmu_gnf, 0, ',', "\u{00A0}") }}
@if($h->date_paiement) · versé le {{ Fg::dateFr($h->date_paiement) }} @elseif($h->date_soumission) · soumis le {{ Fg::dateFr($h->date_soumission) }} @endif
@endforeach
@endif
{{-- ================= Modal détail PEC ================= --}} @if($pec_detail)
Prise en charge

{{ $pec_detail->numero_pec }}

{{ Fg::dateTimeFr($pec_detail->date_pec) }} ·
Bénéficiaire
{{ ($pec_detail->ayantDroit?->prenoms ?? $pec_detail->dossier?->prenoms) }} {{ mb_strtoupper(($pec_detail->ayantDroit?->nom ?? $pec_detail->dossier?->nom)) }}
IUS {{ Fg::ius($pec_detail->dossier->ius) }}
Actes pratiqués
@foreach($pec_detail->actes as $a)
{{ $a->acte->libelle ?? '—' }}
{{ $a->acte->code ?? '' }} · {{ \App\Enums\Cmu\CategorieActe::tryFrom($a->acte->categorie ?? '')?->libelle() ?? $a->acte?->categorie }}
{{ number_format($a->montant_total_gnf, 0, ',', "\u{00A0}") }} GNF
× {{ $a->quantite }}
@endforeach
Total
{{ number_format($pec_detail->total_actes_gnf, 0, ',', "\u{00A0}") }}
Part AMU
{{ number_format($pec_detail->part_cmu_gnf, 0, ',', "\u{00A0}") }}
Patient
{{ number_format($pec_detail->part_patient_gnf, 0, ',', "\u{00A0}") }}
@endif {{-- ================= Modal confirmation soumission Caisse ================= --}} @if($afficher_modal_soumission && $dossier)
Soumission officielle

Transmettre à la Caisse ?

Dossier {{ $dossier->numero_dossier }} · {{ $dossier->nombre_pec }} PEC pour {{ number_format($dossier->total_cmu_gnf, 0, ',', "\u{00A0}") }} GNF. Après soumission, les lignes seront verrouillées et seule la Caisse pourra les instruire.

@error('mot_de_passe_soumission')

{{ $message }}

@enderror
Annuler Confirmer la soumission
@endif {{-- ================= Modal signalement anomalie ================= --}} @if($signaler_pec_id)

Signaler une anomalie

Cette PEC sera marquée SIGNALEE dans le dossier. La Caisse nationale en tiendra compte à l'instruction.

@error('motif_anomalie')

{{ $message }}

@enderror
Annuler Signaler
@endif