{{-- Ressources --}}
@php $activeFiltersCount = 0; if (!empty($centre_id) && $centre_id != 0) $activeFiltersCount++; if (!empty($centre_diplome_id) && $centre_diplome_id != 0) $activeFiltersCount++; if (!empty($domaine_id) && $domaine_id != 0) $activeFiltersCount++; if (!empty($filiere_id) && $filiere_id != 0) $activeFiltersCount++; if (!empty($mode_admission) && $mode_admission != 0) $activeFiltersCount++; if (!empty($niveau_id) && $niveau_id != 0) $activeFiltersCount++; if (!empty($diplome_id) && $diplome_id != 0) $activeFiltersCount++; if (!empty($langue_id) && $langue_id != 0) $activeFiltersCount++; $indicLabel = ['CA' => 'Chiffre d\'affaires', 'paiement' => 'Paiements', 'prevision' => 'Prévisions'][$indicateur_show] ?? ''; @endphp
{{-- HEADER --}}
P

CA journalier

Analyse quotidienne du chiffre d'affaires, paiements et prévisions

{{ getAnneeName($annee_id) }}
{{-- FILTRES --}}
@if($centre_id) {{ getCenterName($centre_id) }} @endif @if($centre_diplome_id) {{ getCenterName($centre_diplome_id) }} @endif @if($domaine_id) {{ getDomaineName($domaine_id) }} @endif @if($filiere_id) {{ getFiliName($filiere_id) }} @endif @if($mode_admission) {{ getModeAd($mode_admission) }} @endif @if($niveau_id) {{ getNiveauName($niveau_id) }} @endif @if($diplome_id) {{ getGroupeDiplomeName($diplome_id) }} @endif @if($langue_id) {{ getLangueName($langue_id) }} @endif
{{-- PANEL FILTRES avec wire:key sur tous les selects --}}
{{-- Année --}}
{{-- Centre de formation --}} @if(auth()->user()->user_role_id == 7 || auth()->user()->user_role_id == 1)
@else
{{ $user_centre_nom }}
@endif {{-- Centre de diplôme --}} @if(auth()->user()->user_role_id == 7 || auth()->user()->user_role_id == 1)
@else
{{ $user_centre_nom }}
@endif {{-- Domaine --}}
{{-- Filière --}}
{{-- Niveau --}}
{{-- Diplôme (groupe) --}}
{{-- Mode admission --}}
{{-- Langue --}}
{{-- Indicateur --}}
{{-- KPI --}}
CA — {{ getAnneeName($annee_id) }}
{{ formatedCa($ca_cumule) }}
Chiffre d'affaires cumulé
Paiement — {{ getAnneeName($annee_id) }}
{{ formatedCa($paiement_cumule) }}
Paiement cumulé
Prévision — {{ getAnneeName($annee_id) }}
{{ formatedCa($prevision_cumule) }}
Reste à percevoir
{{-- Construction des sections selon l'indicateur --}} @php if ($indicateur_show == 'CA') { $field = 'can'; $field1 = 'can_1'; $sections = [ ['slug'=>'dom', 'title'=>'CA par Domaine', 'label'=>'Domaine', 'key'=>'dom_nom', 'items'=>$ca_par_domaine, 'totaux'=>$ca_par_domaine_totaux, 'totaux1'=>$ca_par_domaine_totaux1], ['slug'=>'niv', 'title'=>'CA par Niveau', 'label'=>'Niveau', 'key'=>'niv_nom', 'items'=>$ca_par_niveau, 'totaux'=>$ca_par_niveau_totaux, 'totaux1'=>$ca_par_niveau_totaux1], ['slug'=>'dip', 'title'=>'CA par Diplôme', 'label'=>'Diplôme', 'key'=>'gd_nom', 'items'=>$ca_par_diplome, 'totaux'=>$ca_par_diplome_totaux, 'totaux1'=>$ca_par_diplome_totaux1], ]; } elseif ($indicateur_show == 'paiement') { $field = 'paiement'; $field1 = 'paiement_1'; $sections = [ ['slug'=>'dom', 'title'=>'Paiements par Domaine', 'label'=>'Domaine', 'key'=>'dom_nom', 'items'=>$paiement_par_domaine, 'totaux'=>$paiement_par_domaine_totaux, 'totaux1'=>$paiement_par_domaine_totaux1], ['slug'=>'niv', 'title'=>'Paiements par Niveau', 'label'=>'Niveau', 'key'=>'niv_nom', 'items'=>$paiement_par_niveau, 'totaux'=>$paiement_par_niveau_totaux, 'totaux1'=>$paiement_par_niveau_totaux1], ['slug'=>'dip', 'title'=>'Paiements par Diplôme', 'label'=>'Diplôme', 'key'=>'gd_nom', 'items'=>$paiement_par_diplome, 'totaux'=>$paiement_par_diplome_totaux, 'totaux1'=>$paiement_par_diplome_totaux1], ]; } else { // prevision $field = 'prevision'; $field1 = 'prevision_1'; $sections = [ ['slug'=>'dom', 'title'=>'Prévisions par Domaine', 'label'=>'Domaine', 'key'=>'dom_nom', 'items'=>$prevision_par_domaine, 'totaux'=>$prevision_par_domaine_totaux, 'totaux1'=>$prevision_par_domaine_totaux1], ['slug'=>'niv', 'title'=>'Prévisions par Niveau', 'label'=>'Niveau', 'key'=>'niv_nom', 'items'=>$prevision_par_niveau, 'totaux'=>$prevision_par_niveau_totaux, 'totaux1'=>$prevision_par_niveau_totaux1], ['slug'=>'dip', 'title'=>'Prévisions par Diplôme', 'label'=>'Diplôme', 'key'=>'gd_nom', 'items'=>$prevision_par_diplome, 'totaux'=>$prevision_par_diplome_totaux, 'totaux1'=>$prevision_par_diplome_totaux1], ]; } $anneePassee = getAnneeName($annee_passee_id); $anneeCour = getAnneeName($annee_id); $chartPayload = []; foreach ($sections as $sec) { $chartPayload[$sec['slug']] = [ 'labels' => collect($sec['items'])->pluck($sec['key'])->values(), 'pass' => collect($sec['items'])->pluck($field1)->map(fn($v)=>(float)$v)->values(), 'cour' => collect($sec['items'])->pluck($field)->map(fn($v)=>(float)$v)->values(), ]; } @endphp {{-- Boucle sur les sections (Domaine, Niveau, Diplôme) --}} @foreach ($sections as $section) @php $rowCount = max(count($section['items']), 1); $chartH = max(190, $rowCount * 34 + 60); @endphp
{{-- Barres --}}
{{ $section['title'] }}{{ $anneePassee }} vs {{ $anneeCour }}
Barres
{{ $anneePassee }} {{ $anneeCour }}
{{-- Donut --}}
Partition {{ $anneeCour }}Répartition par {{ strtolower($section['label']) }}
Donut
{{-- Tableau détaillé --}}

Détail — {{ $section['title'] }}

@forelse ($section['items'] as $item) @php $val = $item->{$field}; $val1 = $item->{$field1}; $evo = $val1 != 0 ? (($val - $val1) * 100) / $val1 : null; @endphp @empty @endforelse
{{ $section['label'] }} {{ $anneePassee }} Partition {{ $anneeCour }} Partition Évolution
{{ $item->{$section['key']} }} {{ number_format($val1, 2, ',', '.') }} Dhs @if ($section['totaux1'] != 0) {{ number_format(($val1 * 100) / $section['totaux1'], 2, ',', '.') }} % @else — @endif {{ number_format($val, 2, ',', '.') }} Dhs @if ($section['totaux'] != 0) {{ number_format(($val * 100) / $section['totaux'], 2, ',', '.') }} % @else — @endif @if ($evo === null) @else {{ number_format($evo, 2, ',', '.') }} % @endif
Aucune donnée
Totaux {{ number_format($section['totaux1'], 2, ',', '.') }} Dhs {{ number_format($section['totaux'], 2, ',', '.') }} Dhs @php $totalEvo = $section['totaux1'] != 0 ? (($section['totaux'] - $section['totaux1']) * 100) / $section['totaux1'] : 0; @endphp {{ number_format($totalEvo, 2, ',', '.') }} %
@endforeach