@php
$configData = Helper::appClasses();
@endphp
<!-- Horizontal Menu -->

<aside id="layout-menu" class="layout-menu-horizontal menu-horizontal  menu bg-menu-theme flex-grow-0">
    <div class="{{$containerNav}} d-flex h-100">
        <ul class="menu-inner">
            @foreach ($menuData[1]->menu as $menu)

            {{-- active menu method --}}
            @php
            $activeClass = null;
            $currentRouteName = Route::currentRouteName();

            if ($currentRouteName === $menu->slug) {
            $activeClass = 'active';
            } elseif (isset($menu->submenu)) {
            if (gettype($menu->slug) === 'array') {
            foreach ($menu->slug as $slug) {
            if (str_contains($currentRouteName, $slug) and strpos($currentRouteName, $slug) === 0) {
            $activeClass = 'active';
            }
            }
            } else {
            if (str_contains($currentRouteName, $menu->slug) and strpos($currentRouteName, $menu->slug) === 0) {
            $activeClass = 'active';
            }
            }

            }
            @endphp

            {{-- main menu --}}
            <li class="menu-item {{$activeClass}}">
                <a href="<?php        echo e(isset($menu->url) ? url($menu->url) : 'javascript:void(0);'); ?>"
                    class="<?php        echo e(isset($menu->submenu) ? 'menu-link menu-toggle' : 'menu-link'); ?>"
                    <?php        if(isset($menu->target) && !empty($menu->target)): ?> target="_blank" <?php endif; ?>>
                    <?php if(isset($menu->icon)): ?>
                    <i class="<?php echo e($menu->icon); ?>"></i>
                    <?php endif; ?>
                    <div><?php echo e(isset($menu->name) ? __($menu->name) : ''); ?></div>
                </a>


                {{-- submenu --}}
                @isset($menu->submenu)
                @include('layouts.sections.menu.submenu',['menu' => $menu->submenu])
                @endisset
            </li>
            @endforeach
        </ul>
    </div>
</aside>

<!--/ Horizontal Menu -->