<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
    <!-- BEGIN SIDEBAR -->
    <!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
    <!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
    <div class="page-sidebar navbar-collapse collapse">
        <!-- BEGIN SIDEBAR MENU -->
        <!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
        <!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
        <!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
        <!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
        <!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
        <!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
        <ul class="page-sidebar-menu  page-header-fixed page-sidebar-menu-light " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" style="padding-top: 20px">
            <!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
            <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
            <li class="sidebar-toggler-wrapper hide">
                <div class="sidebar-toggler">
                    <span></span>
                </div>
            </li>
            <!-- END SIDEBAR TOGGLER BUTTON -->
            @foreach($menuitems->where('parent',0)->sortby('position') as $mainitem)
                @if($mainitem->separator)
                    <li class="heading">
                        <h3 class="uppercase">{{ $mainitem->label }}</h3>
                    </li>
                @else
                    @php
                        $subitems = $menuitems->where('parent', $mainitem->id)->sortBy('position')
                    @endphp
                    <li class="nav-item @if( $mainitem->isActiveMenu()) active @endif">
                        <a {!! $mainitem->link?'href="/'.$mainitem->link.'"':'' !!} class="nav-link nav-toggle @if( $mainitem->isActiveMenu()) border-left-{{ Sartoric\ModularCms\Models\Setting::appSetting('app-main-color') }} @endif">
                            <i class="{{ $mainitem->ico }}"></i>
                            <span class="title">{{ ucwords($mainitem->label) }}</span>
                        @if($subitems->first())
                                <span class="arrow @if($mainitem->isActiveMenu()) open @endif"></span>
                        </a>

                        <ul class="sub-menu">
                            @foreach($subitems as $subitem)
                            <li class="nav-item @if( $subitem->isActiveMenu()) active open @endif ">
                                <a href="{{'/'. $subitem->link }}" class="nav-link ">
                                    <i class="{{ $subitem->ico }}"></i>
                                    <span class="title">{{ ucwords($subitem->label) }}</span>
                                </a>
                            </li>
                            @endforeach
                        </ul>
                        @else
                        </a>
                        @endif
                    </li>
                @endif
            @endforeach
        </ul>
        <!-- END SIDEBAR MENU -->
        <!-- END SIDEBAR MENU -->
    </div>
    <!-- END SIDEBAR -->
</div>
<!-- END SIDEBAR -->