Logo Kota

SIMPEG

Sistem Informasi Manajemen Kepegawaian

@if(isset($sidebarMenus)) @foreach($sidebarMenus as $menu) {{-- Gunakan ?? false agar jika key 'show' tidak ada, otomatis bernilai false (tidak error) --}} @if($menu['show'] ?? false) {{-- 1. JIKA TIPE HEADER --}} @if($menu['type'] == 'header')
{{ $menu['label'] }}
{{-- 2. JIKA TIPE LINK BIASA --}} @elseif($menu['type'] == 'link') @php $cleanUrl = ltrim($menu['url'], '/'); $isActive = ($currentPath == $cleanUrl) || request()->is($cleanUrl . '*'); @endphp {{ $menu['label'] }} {{-- 3. JIKA TIPE DROPDOWN (PENGATURAN SUB-MENU) --}} @elseif($menu['type'] == 'dropdown') @php // Cek apakah salah satu child aktif agar dropdown otomatis terbuka dan menu utama menyala $isDropdownActive = collect($menu['children'])->contains(function($child) use ($currentPath) { $cleanChildUrl = ltrim($child['url'], '/'); return ($currentPath == $cleanChildUrl) || request()->is($cleanChildUrl . '*'); }); @endphp
{{ $menu['label'] }}
@foreach($menu['children'] as $child) @if($child['show'] ?? true) @php $cleanChildUrl = ltrim($child['url'], '/'); $isChildActive = ($currentPath == $cleanChildUrl) || request()->is($cleanChildUrl . '*'); @endphp {{ $child['label'] }} @endif @endforeach
@endif @endif @endforeach @endif
Pengaturan
Mode Tampilan