<ul class="navbar-nav bg-gradient-success sidebar sidebar-dark accordion" id="accordionSidebar">
    <!-- Sidebar - Brand -->
    <a class="sidebar-brand d-flex align-items-center justify-content-center" href="{{ route('admin.index') }}">
        <div class="sidebar-brand-icon rotate-n-15"></div>
        <div class="sidebar-brand-text mx-3">
            <img src="{{url("img/logo-bw.png")}}" alt="" style="height: 60px; width:150px;">
        </div>
    </a>

    <hr class="sidebar-divider my-0">

    <li class="nav-item shadow">
        <a class="nav-link" href="{{ route('admin.index') }}">
            <i class="fas fa-fw fa-tachometer-alt"></i>
            <span>{{__("Dashboard")}}</span></a>
    </li>
    <hr class="sidebar-divider">


    <div class="sidebar-heading">
        Interface
    </div>

{{--    @dd(auth()->user()->privileges,auth()->user()->can('setting-list'))--}}

     @php $links = config("admin-links-menus") @endphp
    <!-- Nav Item - Pages Collapse Menu -->
    @forelse($links as $link)
        @if(isset($link['sub-menus']))

            @canany($link['permissions'])
                @if(isset($link['active']) and $link['active'])
                  {{-- <hr class="sidebar-divider my-0"> --}}
                    <li class="nav-item shadow">
                        <a class="nav-link collapsed" href="#"
                           data-toggle="collapse"
                           data-target="#collapse{{ $link['as'] }}"
                           aria-expanded="true"
                           aria-controls="collapse{{ $link['as'] }}">
                            <i class="{{ $link['icon'] }}"></i>
                            <span>{{ __($link['title']) }}</span>
                        </a>
                        <div id="collapse{{ $link['as'] }}" class="collapse"
                             aria-labelledby="headingTwo"
                             data-parent="#accordionSidebar">
                            <div class="bg-white py-2 collapse-inner rounded">
                                @foreach($link['sub-menus'] as $sub)
                                    {{--                                <h6 class="collapse-header">Custom Components:</h6>--}}
                                    @canany($sub['permissions'])
                                      @if(in_array($sub['to'], $routes_name))

                                          @if(isset($link['active']) and $link['active'])
                                              @php
                                                  $route = (isset($sub['routeParams'])) ? route($sub['to'],$sub['routeParams']) : route($sub['to']);
                                              @endphp
                                              <a class="collapse-item" href="{{ $route }}">
                                                  <i class="{{ $sub['icon'] ?? ""}}"></i>
                                                  <span>{{ __($sub['title']) }}</span>
                                              </a>
                                          @endif
                                      @endcanany
                                  @endif
                              @endforeach

                          </div>
                      </div>
                  </li>
                  {{-- <hr class="sidebar-divider"> --}}
              @endif
            @endcanany
      @else
          @if(isset($link['active']) and $link['active'])
              @canany($link['permissions'])
              {{-- <hr class="sidebar-divider my-0"> --}}
                <li class="nav-item shadow">
                    <a class="nav-link {{(Route::currentRouteName() == $link['to']) ? "active":""}}"
                       href="{{ (in_array($link['to'], $routes_name))? route($link['to']) :"#" }}">
                        <i class="{{ $link['icon']}}"></i>
                        <span>{{__($link['title'])}}</span>
                    </a>
                </li>
                {{-- <hr class="sidebar-divider"> --}}
            @endcanany
        @endif
    @endif

@empty
@endforelse
<!-- Divider -->
<hr class="sidebar-divider">
<!-- Heading -->
<div class="sidebar-heading"></div>
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
    <button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
