<!-- Main Header -->
<header class="main-header">

    <!-- Logo -->
    <a href="{{ admin_base_path('/') }}" class="logo">
        <!-- mini logo for sidebar mini 50x50 pixels -->
        <span class="logo-mini">{!! '<img src="'.upload_asset(subsite_config('aix.system.site.site.logo_white_mini')).'" border="0" style="max-width:50px;max-height:50px;padding:8px;"/>' !!}</span>
        <!-- logo for regular state and mobile devices -->
        <span class="logo-lg">{!! '<img src="'.upload_asset(subsite_config('aix.system.site.site.logo_white')).'" border="0" style="max-width:200px;max-height:50px;padding:5px 0px;" />' !!}</span>
    </a>

    <!-- Header Navbar -->
    <nav class="navbar navbar-static-top" role="navigation">
        <!-- Sidebar toggle button-->
        <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
        </a>


        {!! Admin::getNavbar()->render('left') !!}

        <!-- Navbar Right Menu -->
        <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">

                {!! Admin::getNavbar()->render() !!}

                <!-- User Account Menu -->
                <li class="dropdown user user-menu">
                    <!-- Menu Toggle Button -->
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <!-- The user image in the navbar-->
                        <img src="{{ Admin::user()->avatar }}" class="user-image">
                        <!-- hidden-xs hides the username on small devices so only the image appears. -->
                        <span class="hidden-xs">{{ Admin::user()->name }}</span>
                    </a>
                    <ul class="dropdown-menu">
                        <!-- The user image in the menu -->
                        <li class="user-header">
                            <img src="{{ Admin::user()->avatar }}" class="img-circle" alt="User Image">

                            <p>
                                {{ Admin::user()->name }}
                                <small>Member since admin {{ Admin::user()->created_at }}</small>
                            </p>
                        </li>
                        <li class="user-footer">
                            <div class="pull-left">
                                <a href="{{ admin_base_path('auth/setting') }}" class="btn btn-default btn-flat">{{ trans('admin.setting') }}</a>
                            </div>
                            <div class="pull-right">
                                <a href="{{ admin_base_path('auth/logout') }}" class="btn btn-default btn-flat">{{ trans('admin.logout') }}</a>
                            </div>
                        </li>
                    </ul>
                </li>
                <!-- Control Sidebar Toggle Button -->
                {{--<li>--}}
                    {{--<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>--}}
                {{--</li>--}}
            </ul>
        </div>
        {{--go back home--}}
        <a href="/" target="_blank" class="navicon" title="返回前台首页">
            <i class="fa fa-home fa-lg"></i>
        </a>
        {{--subsite select--}}
        @if(!is_null($subsites))
        <div class="dropdown" style="float: right;min-width:142px;margin-top: 7px;">
            <label for="subsite" class="col-sm-2  control-label"  style="width: 72px;padding: 7px 0px 0px  0px;color: #fff;">分站选择：</label>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" style=" padding: 8px 10px;min-width: 70px;color: #fff;font-weight: 700;float: left">
                {{$subsites[get_subsite_id()]['sitename']}}
                <span class="caret"></span>
            </a>
            <ul class="dropdown-menu" role="menu" style="min-width: 70px;left:72px;">
                @foreach($subsites as $site)
                    <li><a href="{{get_subsite_domain($site['id'])}}{{admin_base_path()}}" style="padding: 3px 10px;">{{$site['sitename']}}</a></li>
                @endforeach
            </ul>
        </div>
        @endif
        @php
            $is_caiqing = false;
            if (Admin::user()->isAdministrator()) {
                $is_caiqing = true;
            } else {
                $roles = array_column(Admin::user()->roles->toArray(), 'slug');
                if ($roles && in_array('caiqing', $roles)) {
                    $is_caiqing = true;
                }
            }
        @endphp
        @if($is_caiqing)
        <div style="float: right;line-height: 50px;color: #fff;margin-right: 20px;">
            <a href="{{route('statistics.home')}}" style="color: #fff;" target="_blank"><i class="fa fa-area-chart"></i> 才情监测平台入口</a>
        </div>
        @endif
    </nav>
</header>