@if (config('app.client_name') == 'Alkarim') logo @elseif(config('app.client_name') == 'Upedia') logo @else logo @endif
    @php $currentHost = request()->getHost(); $menuTabs = collect(session('menuTabs_' . $currentHost, [])); $system = 'crm'; if (auth()->user()->hasRole('Super admin')) { $menuTabs = $menuTabs->map(function ($tab) use ($system) { if ($tab->relationLoaded('children')) { $tab->children = $tab->children->filter(function ($child) use ($tab, $system) { return in_array($system, $child->systems ?? []); }); } return in_array($system, $tab->systems ?? []) ? $tab : null; })->filter(); } $currentPath = trim(request()->path(), '/'); $isUrlActive = function ($url) use ($currentPath) { if (empty($url) || $url == '#') { return false; } if (str_contains($url, 'javascript:void(0)')) { return false; } $parsedUrl = parse_url($url); $targetPath = trim($parsedUrl['path'] ?? '', '/'); $isExactPath = $targetPath === $currentPath; $isSubPath = $targetPath !== '' && str_starts_with($currentPath, $targetPath . '/'); if (!$isExactPath && !$isSubPath) { return false; } $targetParams = []; if (!empty($parsedUrl['query'])) { parse_str($parsedUrl['query'], $targetParams); } $currentParams = request()->query(); if ($isExactPath) { if (empty($targetParams) && !empty($currentParams)) { return false; } foreach ($targetParams as $key => $value) { if (!isset($currentParams[$key]) || $currentParams[$key] != $value) { return false; } } } return true; }; @endphp @foreach ($menuTabs as $tab) @php $iconName = !empty($tab->icon) ? $tab->icon : 'mdi:folder-outline'; $isParentActive = $tab->children->count() > 0 && $tab->children->contains(fn($child) => $isUrlActive($child->url)); $isTabActive = $isUrlActive($tab->url); $isDropdownOpen = $isTabActive || $isParentActive; @endphp @if ($tab->children->count() > 0)
  • {{ $tab->label }}
      @foreach ($tab->children as $child) @php $isChildActive = $isUrlActive($child->url); @endphp
    • {{ $child->label }}
    • @endforeach
  • @elseif(!$tab->parent_id && !empty($tab->url))
  • {{ $tab->label }}
  • @endif @endforeach