{{-- ======================================== BREADCRUMB MODULARE ======================================== Breadcrumb intelligente con auto-generazione basata su route e personalizzazione manuale. Props: - $items (array): Items personalizzati del breadcrumb - $showHome (bool): Mostra link Home - $separator (string): Separatore custom - $autoGenerate (bool): Auto-genera da route corrente Autore: NetGesCon Development Team Data: 2024 ======================================== --}} @props([ 'items' => [], 'showHome' => true, 'separator' => null, 'autoGenerate' => true ]) @php // Auto-genera breadcrumb se non fornito manualmente if (empty($items) && $autoGenerate) { $items = generateBreadcrumbFromRoute(); } // Funzione helper per generare breadcrumb dalla route corrente function generateBreadcrumbFromRoute() { $routeName = request()->route()->getName(); $segments = explode('.', $routeName); $breadcrumb = []; // Mapping delle route ai nomi visualizzati $routeNames = [ 'dashboard' => 'Dashboard', 'admin' => 'Amministrazione', 'superadmin' => 'Super Admin', 'condomino' => 'Area Condomino', 'stabili' => 'Stabili', 'condomini' => 'Condomini', 'tickets' => 'Tickets', 'contabilita' => 'Contabilità', 'fiscale' => 'Fiscale', 'assemblee' => 'Assemblee', 'comunicazioni' => 'Comunicazioni', 'documenti' => 'Documenti', 'fornitori' => 'Fornitori', 'manutentori' => 'Manutentori', 'users' => 'Utenti', 'settings' => 'Impostazioni', 'index' => 'Lista', 'create' => 'Nuovo', 'edit' => 'Modifica', 'show' => 'Dettagli' ]; $path = ''; foreach ($segments as $index => $segment) { $path .= ($index > 0 ? '.' : '') . $segment; // Skip alcuni segmenti finali if (in_array($segment, ['index']) && $index === count($segments) - 1) { continue; } $name = $routeNames[$segment] ?? ucfirst($segment); // Costruisci URL se possibile $url = '#'; try { if ($index < count($segments) - 1) { $testRoute = implode('.', array_slice($segments, 0, $index + 1)) . '.index'; if (Route::has($testRoute)) { $url = route($testRoute); } } } catch (Exception $e) { // Route non esistente, usa # } $breadcrumb[] = [ 'name' => $name, 'url' => $url, 'active' => $index === count($segments) - 1 ]; } return $breadcrumb; } @endphp @if(!empty($items) || $showHome) @endif {{-- CSS per breadcrumb --}} @push('styles') @endpush {{-- JavaScript per funzionalità aggiuntive --}} @push('scripts') @endpush