@php
  $admin = Auth::guard('admin')->user();
@endphp

<aside class="main-sidebar sidebar-dark-primary elevation-4">
  <a href="{{ route('admin.dashboard') }}" class="brand-link">
    <img
      src="{{ asset('assets/backend') }}/dist/img/logo.png"
      alt="Ravivari Logo"
      class="brand-image elevation-3"
      style="opacity: 0.8"
      />
    <span class="brand-text font-weight-light">Mini OTT</span>
  </a>
  <div class="sidebar">
    <!-- Sidebar Menu -->
    <nav class="mt-2">
      <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
        @if ($admin && $admin->can('dashboard.view'))
        <li class="nav-item">
          <a href="{{ route('admin.dashboard') }}" class="nav-link  @if(Request::segment(2) == 'dashboard') active @endif">
            <i class="nav-icon fas fa-tachometer-alt"></i>
            <p>Dashboard</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('category.view'))
        <li class="nav-item">
          <a href="{{ route('admin.categories.index') }}" class="nav-link @if(Request::segment(2) == 'categories') active @endif">
            <i class="nav-icon fas fa-th-list"></i>
            <p>Categories</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('video.view'))
        <li class="nav-item">
          <a href="{{ route('admin.videos.index') }}" class="nav-link @if(Request::segment(2) == 'videos') active @endif">
            <i class="nav-icon fas fa-video"></i>
            <p>Videos</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('video.view'))
        <li class="nav-item">
          <a href="{{ route('admin.series.index') }}" class="nav-link @if(Request::segment(2) == 'series') active @endif">
            <i class="nav-icon fas fa-film"></i>
            <p>Series</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('slider.view'))
        <li class="nav-item">
          <a href="{{ route('admin.sliders.index') }}" class="nav-link @if(Request::segment(2) == 'sliders') active @endif">
            <i class="nav-icon fas fa-sliders-h"></i>
            <p>Sliders</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('category.view'))
        <li class="nav-item">
          <a href="{{ route('admin.tv-categories.index') }}" class="nav-link @if(Request::segment(2) == 'tv-categories') active @endif">
            <i class="nav-icon fas fa-list"></i>
            <p>TV Categories</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('video.view'))
        <li class="nav-item">
          <a href="{{ route('admin.tvs.index') }}" class="nav-link @if(Request::segment(2) == 'tvs') active @endif">
            <i class="nav-icon fas fa-tv"></i>
            <p>TV List</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('category.view'))
        <li class="nav-item">
          <a href="{{ route('admin.radio-categories.index') }}" class="nav-link @if(Request::segment(2) == 'radio-categories') active @endif">
            <i class="nav-icon fas fa-list"></i>
            <p>Radio Categories</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('video.view'))
        <li class="nav-item">
          <a href="{{ route('admin.radios.index') }}" class="nav-link @if(Request::segment(2) == 'radios') active @endif">
            <i class="nav-icon fas fa-tv"></i>
            <p>Radio List</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('match.view'))
        <li class="nav-item">
          <a href="{{ route('admin.matches.index') }}" class="nav-link @if(Request::segment(2) == 'matches') active @endif">
            <i class="nav-icon fas fa-trophy"></i>
            <p>Matches</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('notification.send'))
        <li class="nav-item">
          <a href="{{ route('admin.notifications.index') }}" class="nav-link @if(Request::segment(2) == 'notifications') active @endif">
            <i class="nav-icon fas fa-bell"></i>
            <p>Notification</p>
          </a>
        </li>
        @endif

        <li class="nav-item">
          <a href="{{ route('admin.users.index') }}" class="nav-link @if(Request::segment(2) == 'users') active @endif">
            <i class="nav-icon fas fa-user-circle"></i>
            <p>App Users</p>
          </a>
        </li>

        <li class="nav-item @if(in_array(Request::segment(2), ['subscription-plans','user-subscriptions'])) menu-open @endif">
          <a href="#" class="nav-link @if(in_array(Request::segment(2), ['subscription-plans','user-subscriptions'])) active @endif">
            <i class="nav-icon fas fa-crown"></i>
            <p class="text-nowrap">
              Subscriptions
              <i class="right fas fa-angle-left"></i>
            </p>
          </a>
          <ul class="nav nav-treeview">
            <li class="nav-item">
              <a href="{{ route('admin.subscription-plans.index') }}" class="nav-link @if(Request::segment(2) == 'subscription-plans') active @endif">
                <i class="far fa-circle nav-icon"></i>
                <p>Plans</p>
              </a>
            </li>
            <li class="nav-item">
              <a href="{{ route('admin.user-subscriptions.index') }}" class="nav-link @if(Request::segment(2) == 'user-subscriptions') active @endif">
                <i class="far fa-circle nav-icon"></i>
                <p>User Subscriptions</p>
              </a>
            </li>
          </ul>
        </li>

        @if ($admin && $admin->can('admin.view'))
        <li class="nav-item">
          <a href="{{ route('admin.admins.index') }}" class="nav-link @if(Request::segment(2) == 'admins') active @endif">
            <i class="nav-icon fas fa-users-cog"></i>
            <p>Admins</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('role.view'))
        <li class="nav-item">
          <a href="{{ route('admin.roles.index') }}" class="nav-link @if(Request::segment(2) == 'roles') active @endif">
            <i class="nav-icon fas fa-user-shield"></i>
            <p class="text-nowrap">Roles & Permissions</p>
          </a>
        </li>
        @endif

        @if ($admin && $admin->can('page.view'))
        <li class="nav-item">
          <a href="{{ route('admin.pages.index') }}" class="nav-link @if(Request::segment(2) == 'pages') active @endif">
            <i class="nav-icon fas fa-file"></i>
            <p>Pages</p>
          </a>
        </li>
        @endif

        <li class="nav-item">
          <a href="{{ route('admin.payment-gateways.index') }}" class="nav-link @if(Request::segment(3) == 'payment-gateways') active @endif">
            <i class="nav-icon fas fa-credit-card"></i>
            <p>Payment Gateways</p>
          </a>
        </li>

        @if ($admin && $admin->can('email-settings.view'))
        <li class="nav-item @if(Request::segment(2) == 'email') menu-open @endif">
          <a href="#" class="nav-link @if(Request::segment(2) == 'email') active @endif">
            <i class="nav-icon fas fa-envelope"></i>
            <p class="text-nowrap">
              Email Settings
              <i class="right fas fa-angle-left"></i>
            </p>
          </a>
          <ul class="nav nav-treeview">
            <li class="nav-item">
              <a href="{{ route('admin.email.configuration') }}" class="nav-link @if(Request::segment(3) == 'configuration') active @endif">
                <i class="far fa-circle nav-icon"></i>
                <p class="text-nowrap">Email Configuration</p>
              </a>
            </li>
            <li class="nav-item">
              <a href="{{ route('admin.email.templates.index') }}" class="nav-link @if(Request::segment(3) == 'templates') active @endif">
                <i class="far fa-circle nav-icon"></i>
                <p class="text-nowrap">Email Templates</p>
              </a>
            </li>
            <li class="nav-item">
              <a href="{{ route('admin.email.global-template') }}" class="nav-link @if(Request::segment(3) == 'global-template') active @endif">
                <i class="far fa-circle nav-icon"></i>
                <p class="text-nowrap">Global Email Template</p>
              </a>
            </li>
          </ul>
        </li>
        @endif

        @if ($admin && $admin->can('settings.view'))
        <li class="nav-item @if(Request::segment(2) == 'settings') menu-open @endif">
          <a href="#" class="nav-link @if(Request::segment(2) == 'settings') active @endif">
            <i class="nav-icon fas fa-cogs"></i>
            <p class="text-nowrap">
              Settings
              <i class="right fas fa-angle-left"></i>
            </p>
          </a>
          <ul class="nav nav-treeview">
            @if ($admin && $admin->can('advertisement-settings.view'))
              <li class="nav-item">
                <a href="{{ route('admin.settings.advertisement') }}" class="nav-link @if(Request::segment(3) == 'advertisement') active @endif">
                  <i class="far fa-circle nav-icon"></i>
                  <p class="text-nowrap">Advertisement</p>
                </a>
              </li>
            @endif
            @if ($admin && $admin->can('notification-settings.view'))
              <li class="nav-item">
                <a href="{{ route('admin.settings.notification') }}" class="nav-link @if(Request::segment(3) == 'notification') active @endif">
                  <i class="far fa-circle nav-icon"></i>
                  <p class="text-nowrap">Notification</p>
                </a>
              </li>
            @endif
          </ul>
        </li>
        @endif

        <li class="nav-item">
          <a href="{{ route('admin.logout') }}" class="nav-link">
            <i class="nav-icon far fa-user"></i>
            <p>Logout</p>
          </a>
        </li>
      </ul>
    </nav>
  </div>
</aside>