@props(['active' => null]) @php use Illuminate\Support\Facades\Auth; $u = Auth::guard('cmu')->user(); $u?->loadMissing('roles'); $has = fn (array $codes) => $u && $u->hasAnyRole($codes); $current = $active ?? '/'.ltrim(request()->path(), '/'); $isActive = fn (string $href) => str_starts_with($current, rtrim($href, '/')); // ============ Définition des sections ============ // Chaque section : label + liste d'items [href, label, icon, roles éligibles] $sections = []; // ---------- Espace agent (enrôlement + facturation + directeur) ---------- if ($has(['AGENT_CMU_ENROLEMENT', 'AGENT_CMU_FACTURATION', 'DIRECTEUR_ETABLISSEMENT'])) { $items = [ ['href' => '/cmu/tableau-de-bord', 'label' => 'Tableau de bord', 'icon' => ""], ]; if ($has(['AGENT_CMU_ENROLEMENT'])) { $items[] = ['href' => '/cmu/enrolement/nouveau', 'label' => 'Nouvel enrôlement', 'icon' => ""]; } // Historique personnel : enrôlements et encaissements par période, // avec recherche d'un bénéficiaire. Réservé à ceux qui produisent // effectivement cette activité — un directeur n'enrôle pas. if ($has(['AGENT_CMU_ENROLEMENT', 'AGENT_CMU_FACTURATION'])) { $items[] = ['href' => '/cmu/agent/activite', 'label' => 'Mon activité', 'icon' => ""]; } $items[] = ['href' => '/cmu/prise-en-charge/nouvelle', 'label' => 'Nouvelle PEC', 'icon' => ""]; if ($has(['AGENT_CMU_FACTURATION', 'DIRECTEUR_ETABLISSEMENT'])) { $items[] = ['href' => '/cmu/facturation/dashboard', 'label' => 'Facturation', 'icon' => ""]; } $sections[] = ['label' => 'Espace agent', 'items' => $items]; } // ---------- Validation centrale ---------- if ($has(['VALIDATEUR_CENTRAL', 'COMMISSION_RAM', 'AGENT_SOCIAL_RAM', 'SUPER_ADMIN_CMU', 'ADMIN_CMU'])) { $sections[] = ['label' => 'Validation', 'items' => [ ['href' => '/cmu/validation', 'label' => 'File de validation', 'icon' => ""], // Les dossiers traités quittent la file : sans cet écran, un motif // de rejet devient introuvable dès le lendemain. ['href' => '/cmu/validation/historique', 'label' => 'Historique des décisions', 'icon' => ""], ]]; } // ---------- Caisse nationale ---------- if ($has(['CAISSE_NATIONALE', 'SUPER_ADMIN_CMU', 'ADMIN_CMU'])) { $sections[] = ['label' => 'Caisse nationale', 'items' => [ ['href' => '/cmu/caisse/reversements', 'label' => 'Reversements opérateurs', 'icon' => ""], ['href' => '/cmu/caisse/instruction', 'label' => 'Dossiers à instruire', 'icon' => ""], ['href' => '/cmu/caisse/paiements', 'label' => 'Ordonnancement paiements', 'icon' => ""], ['href' => '/cmu/caisse/commissions', 'label' => 'Commissions sociétés', 'icon' => ""], ]]; } // ---------- Espace structures privées conventionnées (addendum v1.1 §3.3) ---------- if ($has(['AGENT_STRUCTURE_PRIV'])) { $items = [ ['href' => '/cmu/structure/agent', 'label' => 'Tableau de bord', 'icon' => ""], ]; if ($u?->etablissement?->type === 'PHARMA') { $items[] = ['href' => '/cmu/structure/pharmacie/dispenser', 'label' => 'Dispenser', 'icon' => ""]; $items[] = ['href' => '/cmu/structure/pharmacie/historique', 'label' => 'Historique dispensations', 'icon' => ""]; } else { // Clinique / laboratoire / imagerie : accès PEC standard. $items[] = ['href' => '/cmu/prise-en-charge/nouvelle', 'label' => 'Nouvelle prise en charge', 'icon' => ""]; } $sections[] = ['label' => 'Structure conventionnée', 'items' => $items]; } // ---------- Espace facturation structure ---------- if ($has(['AGENT_FACTURATION_STRUCTURE'])) { $sections[] = ['label' => 'Facturation structure', 'items' => [ ['href' => '/cmu/structure/facturation', 'label' => 'Dashboard facturation', 'icon' => ""], ]]; } // ---------- Espace agent Société AMU (terrain) ---------- if ($has(['AGENT_SOCIETE_CMU'])) { $sections[] = ['label' => 'Espace agent', 'items' => [ ['href' => '/cmu/societe/agent', 'label' => 'Tableau de bord', 'icon' => ""], ['href' => '/cmu/enrolement/nouveau', 'label' => 'Nouvel enrôlement', 'icon' => ""], ['href' => '/cmu/societe/agent/recherche', 'label' => 'Rechercher un bénéficiaire', 'icon' => ""], ['href' => '/cmu/societe/agent/encaisser', 'label' => 'Encaisser une cotisation', 'icon' => ""], ]]; } // ---------- Espace Société AMU (gérant / superviseur) ---------- if ($has(['GERANT_SOCIETE_CMU', 'SUPERVISEUR_SOCIETE_CMU'])) { $items = []; if ($has(['GERANT_SOCIETE_CMU'])) { $items[] = ['href' => '/cmu/societe/tableau-gerant', 'label' => 'Tableau de bord', 'icon' => ""]; $items[] = ['href' => '/cmu/societe/points', 'label' => 'Mes Points AMU', 'icon' => ""]; $items[] = ['href' => '/cmu/societe/agents', 'label' => 'Mes agents', 'icon' => ""]; $items[] = ['href' => '/cmu/societe/commissions', 'label' => 'Commissions', 'icon' => ""]; } $items[] = ['href' => '/cmu/societe/pre-validation', 'label' => 'Pré-validation', 'icon' => ""]; $sections[] = ['label' => 'Société AMU', 'items' => $items]; } // ---------- Pilotage national ---------- if ($has(['SUPER_ADMIN_CMU', 'ADMIN_CMU', 'SUPERVISEUR_REGIONAL'])) { $sections[] = ['label' => 'Pilotage', 'items' => [ ['href' => '/cmu/supervision', 'label' => 'Supervision nationale', 'icon' => ""], ['href' => '/cmu/supervision/rapports', 'label' => 'Rapports officiels', 'icon' => ""], ]]; } // ---------- Écosystème (Sociétés AMU & structures privées) ---------- if ($has(['SUPER_ADMIN_CMU', 'ADMIN_CMU'])) { $sections[] = ['label' => 'Écosystème', 'items' => [ ['href' => '/cmu/admin/societes', 'label' => 'Sociétés AMU', 'icon' => ""], ['href' => '/cmu/admin/conventions', 'label' => 'Structures conventionnées', 'icon' => ""], ]]; } // ---------- Administration ---------- if ($has(['SUPER_ADMIN_CMU', 'ADMIN_CMU'])) { $items = [ ['href' => '/cmu/admin/etablissements', 'label' => 'Établissements', 'icon' => ""], ['href' => '/cmu/admin/utilisateurs', 'label' => 'Utilisateurs', 'icon' => ""], ['href' => '/cmu/admin/profils', 'label' => 'Profils cotisants', 'icon' => ""], ['href' => '/cmu/admin/nomenclature', 'label' => 'Nomenclature', 'icon' => ""], ['href' => '/cmu/admin/nomenclature/simulation', 'label' => 'Simulation tarif', 'icon' => ""], ]; if ($has(['SUPER_ADMIN_CMU'])) { $items[] = ['href' => '/cmu/admin/audit', 'label' => 'Journal audit', 'icon' => ""]; } $sections[] = ['label' => 'Administration', 'items' => $items]; } @endphp @foreach($sections as $section)
{{ $section['label'] }}
@foreach($section['items'] as $item) {{ $item['label'] }} @endforeach
@endforeach