{{-- 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 --}}
{{-- KPI --}}
CA — {{ getAnneeName($annee_id) }}
{{ formatedCa($ca_cumule) }}
Paiement — {{ getAnneeName($annee_id) }}
{{ formatedCa($paiement_cumule) }}
Prévision — {{ getAnneeName($annee_id) }}
{{ formatedCa($prevision_cumule) }}
{{-- 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 --}}
{{ $anneePassee }}
{{ $anneeCour }}
{{-- Donut --}}
{{-- Tableau détaillé --}}
Détail — {{ $section['title'] }}
| {{ $section['label'] }} |
{{ $anneePassee }} |
Partition |
{{ $anneeCour }} |
Partition |
Évolution |
@forelse ($section['items'] as $item)
@php
$val = $item->{$field};
$val1 = $item->{$field1};
$evo = $val1 != 0 ? (($val - $val1) * 100) / $val1 : null;
@endphp
| {{ $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
|
@empty
| Aucune donnée |
@endforelse
| 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