<nav class="left-menu-wrapper navbar-default navbar-static-side" role="navigation">
  <div class="sidebar-collapse">
    <ul side-navigation class="nav metismenu" id="side-menu">
      <li class="nav-header">
        <div class="profile-element" uib-dropdown>
          <div>
            <img alt="image" class="img-circle" ng-src="{{ $ctrl.logo }}" />
          </div>
          <div>
            <div class="clear font-bold">
              <div>
                您好,{{$ctrl.hidenUserName($ctrl.userInfo.shopName?$ctrl.userInfo.shopName:$ctrl.userInfo.username)}}
                <br>欢迎使用灵犀!
              </div>
            </div>
          </div>
        </div>
        <!-- <div class="logo-element">
          CIL
        </div> -->
      </li>
      <!-- 主页 -->
      <li
        data-ng-class="{'active': $ctrl.$state.includes('home') || $ctrl.$state.includes('case'), 'inActive': !$ctrl.$state.includes('home')}"
        data-ng-if="[1,4,7].indexOf($ctrl.userInfo.userType)>-1">
        <a data-ng-href="{{$ctrl.globalVar.AUTH_URL}}#/home">
          <i class="fa fa-home fa-fw"></i>
          <span class="nav-label">主页</span>
        </a>
      </li>
      <!-- 营销中心 -->
      <li data-ng-class="{'active': $ctrl.$state.includes('activity'), 'inActive': !$ctrl.$state.includes('activity')}"
        data-ng-if="[4].indexOf($ctrl.userInfo.userType)>-1">
        <a href="" toggle-second-menu auto-Expand="true">
          <i class="fa fa-flag fa-fw"></i>
          <span class="nav-label">营销中心</span>
          <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
          <li
            data-ng-class="{'active': $ctrl.$state.includes('activity.verify') || $ctrl.$state.includes('activity.verify')}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/activity/verify">优惠券核销</a>
          </li>
        </ul>
      </li>
      <!-- 营销中心 -->
      <li
        data-ng-class="{'active': $ctrl.$state.includes('activity')  || $ctrl.$state.includes('interests') || $ctrl.$state.includes('equity'), 'inActive': !$ctrl.$state.includes('activity')}"
        data-ng-if="[1,7].indexOf($ctrl.userInfo.userType)>-1">
        <a href="" toggle-second-menu auto-Expand="true">
          <i class="fa fa-flag fa-fw"></i>
          <span class="nav-label">营销中心</span>
          <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
          <li
            data-ng-class="{'active': $ctrl.$state.includes('activity.channel') || $ctrl.$state.includes('activity.create') || $ctrl.$state.includes('activity.discount') || $ctrl.$state.includes('activity.hi') || $ctrl.$state.includes('activity.registration') || $ctrl.$state.includes('activity.share') || $ctrl.$state.includes('activity.birthday') || $ctrl.$state.includes('activity.consumeSend') || $ctrl.$state.includes('activity.laobi') || $ctrl.$state.includes('activity.weixin') || $ctrl.$state.includes('activity.coupon') || $ctrl.$state.includes('activity.tianmao') || $ctrl.$state.includes('activity.jd')}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/activity/channel">创建新活动</a>
          </li>
          <li data-ng-class="{'active':$ctrl.$state.includes('activity.management')}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/activity/management">活动管理</a>
          </li>
          <li
            data-ng-class="{'active': $ctrl.$state.includes('interests.provide') || $ctrl.$state.includes('equity.sendInterests') || $ctrl.$state.includes('interests.memberDetail') || $ctrl.$state.includes('interests.detail')}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/interests/provide">精准投放</a>
          </li>
          <li
            data-ng-class="{'active': $ctrl.$state.includes('activity.channelStatistics') || $ctrl.$state.includes('activity.statistics')}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/activity/statistics">营销统计</a>
          </li>
          <li
            data-ng-class="{'active': $ctrl.$state.includes('activity.verify') || $ctrl.$state.includes('activity.verify')}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/activity/verify">优惠券核销</a>
          </li>
        </ul>
      </li>
      <!-- 电子会员 -->
      <li
        data-ng-class="{'active': $ctrl.$state.includes('membercard'), 'inActive': !$ctrl.$state.includes('membercard')}"
        data-ng-if="[1,7].indexOf($ctrl.userInfo.userType)>-1">
        <a href="" toggle-second-menu>
          <i class="fa fa-id-card"></i>
          <span class="nav-label">电子会员</span>
          <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
          <li data-ng-class="{'active':$ctrl.$state.includes('membercard.management')}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/membercard/management/create">会员卡管理</a>
          </li>
          <li data-ng-class="{'active':$ctrl.$state.includes('membercard.balance')}">
            <a href="" toggle-third-menu>
              <span class="nav-label">会员储值</span>
              <span class="fa arrow"></span>
            </a>
            <ul class="nav nav-third-level">
              <li data-ng-class="{active: $ctrl.$state.includes('membercard.balance.rule')}">
                <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/membercard/balance/rule">储值规则</a>
              </li>
              <li data-ng-class="{active: $ctrl.$state.includes('membercard.balance.management')}">
                <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/membercard/balance/management">储值记录</a>
              </li>
            </ul>
          </li>
        </ul>

      </li>
      <!-- 顾客中心 -->
      <li data-ng-class="{'active': $ctrl.$state.includes('customer'), 'inActive': !$ctrl.$state.includes('customer')}"
        data-ng-if="[7].indexOf($ctrl.userInfo.userType)>-1">
        <a href="" toggle-second-menu>
          <i class="fa fa-user fa-fw"></i>
          <span class="nav-label">顾客中心</span>
          <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
          <li data-ng-class="{active: ('customer.manage' | includedByState) || ('customer.detail' | includedByState)}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/customer/manage">顾客管理</a>
          </li>
          <li data-ng-class="{active: ('customer.portrait' | includedByState)}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/customer/portrait">顾客画像</a>
          </li>
          <li data-ng-class="{active: ('customer.trend' | includedByState)}">
            <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/customer/trend">顾客趋势</a>
          </li>
        </ul>
      </li>
      <!-- 服务中心 -->
      <li
        data-ng-class="{'active': $ctrl.$state.includes('order')||$ctrl.$state.includes('service-center')||  $ctrl.$state.includes('scoremail'), 'inActive': !$ctrl.$state.includes('order') && !$ctrl.$state.includes('service-center') && !$ctrl.$state.includes('scoremail')}"
        data-ng-if="[1,4,7].indexOf($ctrl.userInfo.userType)>-1 && ($ctrl.prevStatus != 'servplat' || $ctrl.userInfo.shopCategoryInfoslist[0].categoryName == '美食')">
        <a href="" toggle-second-menu>
          <i class="fa fa-user-cog fa-fw"></i>
          <span class="nav-label">服务中心</span>
          <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
          <li
            data-ng-class="{active: ('service-center' | includedByState),'inActive':!$ctrl.$state.includes('service-center')}">
            <a data-ng-href="{{$ctrl.globalVar.TASTY_URL}}#/service-center">全部服务</a>
          </li>
          <li data-ng-class="{active: ('order' | includedByState),'inActive': !$ctrl.$state.includes('order')}">
            <a href="" toggle-third-menu>
              <span class="nav-label">扫码点餐</span>
              <span class="fa arrow"></span>
            </a>
            <ul class="nav nav-third-level">
              <li data-ng-class="{active: ('order.menu' | includedByState)}">
                <a data-ng-href="{{$ctrl.globalVar.TASTY_URL}}#/order/menu">菜单管理</a>
              </li>
              <li data-ng-class="{active: ('order.tables' | includedByState)}">
                <a data-ng-href="{{$ctrl.globalVar.TASTY_URL}}#/order/tables">桌台管理</a>
              </li>
              <li data-ng-class="{active: ('order.merInfo' | includedByState)}">
                <a data-ng-href="{{$ctrl.globalVar.TASTY_URL}}#/order/merInfo">门店设置</a>
              </li>
              <li data-ng-class="{active: ('order.manage' | includedByState) || ('order.detail' | includedByState)}">
                <a data-ng-href="{{$ctrl.globalVar.TASTY_URL}}#/order/manage">订单管理</a>
              </li>
            </ul>
          </li>
          <li data-ng-class="{active: ('scoremail' | includedByState),'inActive': !$ctrl.$state.includes('scoremail')}"
            data-ng-if="[1,7].indexOf($ctrl.userInfo.userType)>-1">
            <a href="" toggle-third-menu>
              <span class="nav-label">积分商城</span>
              <span class="fa arrow"></span>
            </a>
            <ul class="nav nav-third-level">
              <li
                data-ng-class="{'active': (($ctrl.$state.includes('scoremail.management') && (!$ctrl.$state.params.channel || $ctrl.$state.params.channel == 9))) || $ctrl.$state.includes('scoremail.discount')}">
                <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/scoremail/management?channel=9">礼品管理</a>
              </li>
              <li
                data-ng-class="{'active': (($ctrl.$state.includes('scoremail.management') && $ctrl.$state.params.channel == 10)) || $ctrl.$state.includes('scoremail.ad')}">
                <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/scoremail/management?channel=10">广告管理</a>
              </li>
              <li data-ng-class="{'active':$ctrl.$state.includes('scoremail.history')}">
                <a data-ng-href="{{$ctrl.globalVar.VOUCHER_URL}}#/scoremail/history">兑换查询</a>
              </li>
            </ul>
          </li>
        </ul>
      </li>
      <!--VIP服务-->
      <li
        data-ng-class="{active: ('account.vipServices' | includedByState),'inActive':!$ctrl.$state.includes('account.vipServices')}"
        data-ng-if="[1,4,7].indexOf($ctrl.userInfo.userType)>-1">
        <a data-ng-href="{{$ctrl.globalVar.AUTH_URL}}#/account/vipServices">
          <i class="fas fa-gem fa-fw"></i>
          <span class="nav-label">VIP服务</span>
        </a>
      </li>
      <!--门店管理-->
      <!-- <li data-ng-class="{'active': $ctrl.$state.includes('store'), 'inActive': !$ctrl.$state.includes('store')}"
        data-ng-if="[7].indexOf($ctrl.userInfo.userType)>-1">
        <a data-ng-href="{{$ctrl.globalVar.AUTH_URL}}#/store/query">
          <i class="fas fa-store fa-fw"></i>
          <span class="nav-label">门店管理</span>
        </a>
      </li> -->
      <!--商户中心-->
      <li
        data-ng-class="{'active': $ctrl.$state.includes('store') || $ctrl.$state.includes('merchant'), 'inActive': !$ctrl.$state.includes('store') && !$ctrl.$state.includes('merchant')}"
        data-ng-if="[7].indexOf($ctrl.userInfo.userType)>-1">
        <a href="" toggle-second-menu>
          <i class="fas fa-store fa-fw"></i>
          <span class="nav-label">商户中心</span>
          <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
          <li data-ng-class="{active: ('merchant' | includedByState)}">
            <a data-ng-href="{{$ctrl.globalVar.AUTH_URL}}#/merchant/accountCenter">
              我的账户
            </a>
          </li>
          <li data-ng-class="{'active': ('store' | includedByState)}">
            <a data-ng-href="{{$ctrl.globalVar.AUTH_URL}}#/store/query">
              门店管理
            </a>
          </li>
        </ul>
      </li>
      <!--开放接口-->
      <li class="inActive"
        data-ng-class="{'active': $ctrl.$state.includes('recommend') || $ctrl.$state.includes('setting'), 'inActive': !$ctrl.$state.includes('recommend') && !$ctrl.$state.includes('setting')}"
        data-ng-if="[1,7].indexOf($ctrl.userInfo.userType)>-1">
        <a href="" toggle-second-menu>
          <i class="fa fa-cog"></i>
          <span class="nav-label">开放接口</span>
          <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
          <li data-ng-class="{active: ('recommend' | includedByState)}">
            <a data-ng-href="{{$ctrl.globalVar.SKIPTONEUSTAR_URL}}#/recommend/dev">
              智能推荐
            </a>
          </li>
          <li data-ng-class="{'active': ('setting.memberbenifit' | includedByState)}">
            <a data-ng-href="{{$ctrl.globalVar.AUTH_URL}}#/setting/memberbenifit">
              会员权益
            </a>
          </li>
        </ul>
      </li>
      <!--Deprecated: 账户管理-->
      <li data-ng-class="{'active': $ctrl.$state.includes('account'), 'inActive': !$ctrl.$state.includes('account')}"
        data-ng-if="false && [4, 7].indexOf($ctrl.userInfo.userType)>-1">
        <a href="" toggle-second-menu>
          <i class="fa fa-user fa-fw"></i>
          <span class="nav-label">账户管理</span>
          <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
          <li ui-sref-active="active">
            <a data-ng-href="{{$ctrl.globalVar.AUTH_URL}}#/account/pwd">账户信息</a>
          </li>
        </ul>
      </li>
    </ul>
  </div>
</nav>