{{-- resources/views/tableaubord/index.blade.php --}} @extends('layouts.app') @section('title', 'PTA ' . $annee . ' — Tableau de bord') @push('styles') @endpush @section('content')
{{-- ══ EN-TÊTE ══════════════════════════════════════════════════════ --}}

📊 Plan de Travail Annuel — {{ $annee }}

Suivi des prévisions et réalisations trimestrielles · Données au {{ now()->format('d/m/Y') }}

{{-- ══ FILTRES ═══════════════════════════════════════════════════════ --}}
✕ Réinitialiser
{{-- ══ STAT CARDS ════════════════════════════════════════════════════ --}} @php $nbProg = count($arborescence); $nbAct = 0; $nbRes = 0; $nbActiv = 0; $totalMontant = 0; $totalMontantFiltre = 0; $nbActivites = 0; foreach ($arborescence as $prog) { $nbAct += count($prog['actions']); $totalMontant += $prog['montant'] ?? 0; foreach ($prog['actions'] as $act) { $nbRes += count($act['resultats']); foreach ($act['resultats'] as $res) { $nbActiv += count($res['activites']); foreach ($res['activites'] as $av) { // On additionne ici le montant réel de chaque activité filtrée $totalMontantFiltre += $av['montant'] ?? 0; $nbActivites++; } } } } @endphp
Résumé de la selection :
{{ $nbProg }} Programme(s)
{{ $nbAct }} Action(s)
{{ $nbRes }} Résultat(s)
{{ $nbActiv }} Activité(s)
Budget de la selection : {{ number_format($totalMontantFiltre, 0, ',', ' ') }} FCFA
{{-- ══ TABLEAU ════════════════════════════════════════════════════════ --}} @if(empty($arborescence))
📋
Aucune donnée pour {{ $annee }}
Modifiez les filtres ou importez les données pour cette année.
@else
{{-- Code --}} {{-- Libellé --}} {{-- Structure --}} {{-- Extrant --}} {{-- Prév T1 --}} {{-- Prév T2 --}} {{-- Prév T3 --}} {{-- Prév T4 --}} {{-- Réal T1 --}} {{-- Réal T2 --}} {{-- Réal T3 --}} {{-- Réal T4 --}} {{-- Montant --}} {{-- Financement --}} {{-- Ligne 1 : groupes de colonnes --}} {{-- Ligne 2 : trimestres --}} @foreach($arborescence as $prog) {{-- ══ LIGNE PROGRAMME ══ --}} @foreach($prog['actions'] as $act) {{-- ══ LIGNE ACTION ══ --}} @foreach($act['resultats'] as $res) {{-- ══ LIGNE RÉSULTAT ══ --}} @foreach($res['activites'] as $av) {{-- ══ LIGNE ACTIVITÉ ══ --}} {{-- Prévisions T1→T4 --}} @foreach(['prev_t1','prev_t2','prev_t3','prev_t4'] as $pt) @endforeach {{-- Réalisations T1→T4 --}} @foreach(['real_t1','real_t2','real_t3','real_t4'] as $i => $rt) @php $pv = $av['prev_t' . ($i + 1)]; $rv = $av[$rt]; $cls = 'nd'; $pct = 0; if ($rv !== null) { if ($pv !== null && $pv > 0) { $ratio = ($rv / $pv) * 100; $pct = min(100, (int) round($ratio)); $cls = $ratio >= 80 ? 'ok' : ($ratio >= 50 ? 'mid' : 'lo'); } else { $cls = $rv >= 80 ? 'ok' : ($rv >= 50 ? 'mid' : 'lo'); } } @endphp @endforeach @endforeach {{-- /activités --}} @endforeach {{-- /résultats --}} @endforeach {{-- /actions --}} @endforeach {{-- /programmes --}}
Code Programmes / Actions / Résultats / Activités Principaux extrants attendus en {{ $annee }} Structure responsable / partenaires Programmation Physique {{ $annee }} Réalisations {{ $annee }} Montants {{ $annee }}
(FCFA)
Sources de financement
T1 T2 T3 T4 T1 T2 T3 T4
{{ $prog['code'] }} {{ $prog['nom'] }} {{ number_format($prog['montant'] ?? 0, 0, ',', ' ') }}
{{ $act['code'] }} {{ $act['nom'] }} {{ number_format($act['montant'] ?? 0, 0, ',', ' ') }}
Résultat : {{ $res['nom'] }} {{ number_format($res['montant'] ?? 0, 0, ',', ' ') }}
{{ $av['code'] }} {{ $av['nom'] }} {{ $av['ext_nom'] ?? '—' }} {{ $av['struct_code'] }} @if($av[$pt] !== null) {{ (int)$av[$pt] }}% @else @endif @if($rv !== null) {{ (int)$rv }}% @if($pv !== null && $pv > 0)
@endif @else @endif
{{ number_format($av['montant'] ?? 0, 0, ',', ' ') }} {{ $av['fin_nom'] ? Str::limit($av['fin_nom'], 8) : '—' }}
{{ $annee }} · Généré le {{ now()->format('d/m/Y à H:i') }}
@endif
{{-- /pta-page --}} @endsection