@if( !empty($data) )

    <ul class="nav nav-sidebar" data-nav-type="accordion">

    {{-- menu group --}}
    @foreach($data as $menuGroup)

        @if(isset($menuGroup['header']))
            <li class="nav-item-header">
                <div class="text-uppercase font-size-xs line-height-xs">
                    {{ $menuGroup['header'] }}
                </div> <i class="icon-menu" title="Layout options"></i>
            </li>
        @endif

        {{-- main menu --}}
        @foreach($menuGroup['menu'] as $menu)
            <li class="nav-item {{ isset($menu['submenu']) && count($menu['submenu']) > 0 ? 'nav-item-submenu' : '' }}">
                <a href="{{ $menu['link'] ?? '#' }}" class="nav-link">
                    <i class="{{ $menu['icon'] ?? 'icon-primitive-dot' }}"></i>
                    <span>
                    {{ $menu['name'] }}
                    </span>
                </a>

                {{-- sub menu --}}
                @if(isset($menu['submenu']) && count($menu['submenu']) > 0)
                    <ul class="nav nav-group-sub" data-submenu-title="{{ $menu['name'] }}" style="display: none;">
                        @foreach($menu['submenu'] as $submenu)
                            <li class="nav-item">
                                <a href="{{ $submenu['link'] ?? '#' }}" class="nav-link">
                                    <i class="{{ $submenu['icon'] ?? 'icon-primitive-dot' }}"></i>
                                    <span>
                                {{ $submenu['name'] }}
                                </span>
                                </a>
                            </li>
                        @endforeach
                    </ul>
                @endif

            </li>
        @endforeach

    @endforeach
    </ul>

@endif
