{% block side %}
  {% set side_nav = side_nav|default(null) %}
  {% set menuType = 'course' %}
  {% if side_nav in ['base', 'detail', 'cover', 'question', 'testpaper', 'files', 'plan', 'question_plus'] %}
    {% set menuType = 'courseSet' %}
  {% endif %}
  {% set coursesLength =  courses|length %}
  {% set courseListIntroCookie = app.request.cookies.get('COURSE_LIST_INTRO_COOKIE')|default(null)  %}
  {% set isShowCourseMenu  = (curCourse and (menuType != 'courseSet' or coursesLength <= 1  or courseListIntroCookie)) %}
  {% set isShowCourseList =  ( courseSet.type != 'live' and courseSet.parentId|default(0) <= 0  and (menuType == 'courseSet' or coursesLength <= 1 or courseListIntroCookie|default(null) )) %}

  {#只有一个教学计划#}
  <div class="sidenav locked js-sidenav" data-course-length="{{coursesLength}}">
    <ul class="list-group">
      {#为courseSet 或者 长度小于 1 #}
      {% if menuType == 'courseSet' or coursesLength <= 1 %}
        <li class="list-group-item {% if side_nav == 'base' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'base'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '基本信息'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_base', {id: courseSet.id}) }}">
              {{ '基本信息'|trans }}
            </a>
          {% endif %}
        </li>
        <li class="list-group-item {% if side_nav == 'detail' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'detail'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '详细信息'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_detail', {id: courseSet.id}) }}">
              {{ '详细信息'|trans }}
            </a>
          {% endif %}
        </li>
        <li class="list-group-item {% if side_nav == 'cover' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'cover'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '课程封面'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_cover', {id: courseSet.id}) }}">
              {{ '封面图片'|trans }}
            </a>
          {% endif %}
        </li>
        <hr class="mv5 mh10 bg-border-color"/>
        <li class="list-group-item {% if side_nav == 'files' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'files'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '课程文件'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_files', {id: courseSet.id}) }}">
              {{ '课程文件'|trans }}
            </a>
          {% endif %}
        </li>
        <li class="list-group-item {% if side_nav == 'testpaper' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'testpaper'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '试卷管理'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_testpaper', {id: courseSet.id}) }}">
              {{ '试卷管理'|trans }}
            </a>
          {% endif %}
        </li>
        <li class="list-group-item {% if side_nav == 'question' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'question'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '题目管理'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_question', {id: courseSet.id}) }}">
              {{ '题目管理'|trans }}
            </a>
          {% endif %}
        </li>
        {{ slot('course_set.menu.extension', {'courseSet':courseSet,'sideNav':side_nav}) }}
      {% endif %}
      {#不为courseSet 或者 长度小于 1 #}
      {% if isShowCourseMenu %}
      <div class="js-sidenav-course-menu ">
        {% if coursesLength > 1 and not courseListIntroCookie %}
          <li class="list-group-heading">
            {{ curCourse.title }}
          </li>
        {% else %}
          <hr class="mv5 mh10 bg-border-color"/>
        {% endif %}
        <li class="list-group-item {% if side_nav == 'tasks' %}active{% endif %}" id="step-1">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'tasks'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '计划任务'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_course_tasks', {courseSetId: courseSet.id, courseId: curCourse.id}) }}">
              {{ '计划任务'|trans }}
            </a>
          {% endif %}
        </li>
        <li class="list-group-item {% if side_nav == 'info' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'info'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '计划设置'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_course_info', {courseSetId: courseSet.id, courseId: curCourse.id}) }}">
              {{ '计划设置'|trans }}
            </a>
          {% endif %}
        </li>
        {% if hasLiveTasks or courseSet.type == 'live' %}
          <li class="list-group-item {% if side_nav == 'replay' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'replay'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '录播管理'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_course_replay', {courseSetId: courseSet.id, courseId: curCourse.id}) }}">
              {{ '录播管理'|trans }}
            </a>
          {% endif %}
        {% endif %}
        </li>
        <li class="list-group-item {% if side_nav == 'marketing' %}active{% endif %}" id="step-2">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'marketing'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '营销设置'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_course_marketing', {courseSetId: courseSet.id, courseId: curCourse.id}) }}">
              {{ '营销设置'|trans }}
            </a>
          {% endif %}
        </li>
        <li class="list-group-item {% if side_nav == 'teachers' %}active{% endif %}">
          {% if courseSet.locked %}
            <a class="pl10" href="{{ path('course_set_manage_sync', {id: courseSet.id, sideNav: 'teachers'}) }}">
              <span class="es-icon es-icon-lock mr10" aria-hidden="true"></span>{{ '教师设置'|trans }}
            </a>
          {% else %}
            <a href="{{ path('course_set_manage_course_teachers', {courseSetId: courseSet.id, courseId: curCourse.id}) }}">
              {{ '教师设置'|trans }}
            </a>
          {% endif %}
        </li>
        <li class="list-group-item {% if side_nav == 'students' %}active{% endif %}">
          <a href="{{ path('course_set_manage_course_students', {courseSetId: courseSet.id, courseId: curCourse.id}) }}">
            {{ setting('default.user_name')|default('学员'|trans) }}{{ '管理'|trans }}
          </a>
        </li>
        <hr class="mv5 mh10 bg-border-color"/>
        <li class="list-group-item {% if side_nav == 'testpaper-check' %}active{% endif %}">
          <a href="{{ path('course_manage_testpaper_check_list', {id: curCourse.id}) }}">{{ '试卷批阅'|trans }}
          </a>
        </li>
        <li class="list-group-item {% if side_nav == 'homework-check' %}active{% endif %}">
          <a href="{{ path('course_manage_homework_check_list', {id: curCourse.id}) }}">{{ '作业批阅'|trans }}
          </a>
        </li>
        <hr class="mv5 mh10 bg-border-color"/>
        <li class="list-group-item {% if side_nav == 'dashboard' %}active{% endif %}">
          <a href="{{ path('course_set_manage_course_dashboard',{courseSetId: courseSet.id, courseId: curCourse.id}) }}">
            {{ '学习数据'|trans }}</a>
        </li>

        {#<li class="list-group-item {% if side_nav == 'question_marker' %}active{% endif %}">#}
          {#<a href="{{ path('course_manage_question_marker',{courseSetId: courseSet.id, courseId: curCourse.id}) }}">#}
            {#{{ '弹题统计' }}</a>#}
        {#</li>#}
        {% if app.user.isAdmin() or setting('course.teacher_search_order') == 1 %}
          <li class="list-group-item {% if side_nav == 'orders' %}active{% endif %}">
            <a href="{{ path('course_set_manage_course_orders', {courseSetId: courseSet.id, courseId: curCourse.id}) }}">{{ '订单查询'|trans }}
            </a>
          </li>
        {% endif %}
      </div>
      {% endif %}
      {# 不是直播，不是编辑下得课程，课程编辑或者#}
      {% if isShowCourseList %}
        <div class="js-sidenav-course-list">
          <hr class="mv5 mh10 bg-border-color"/>
          <li class="list-group-item {% if side_nav == 'plan' %}active{% endif %}">
            <a href="{{ path('course_set_manage_courses', {courseSetId: courseSet.id}) }}">
              {{ '教学计划管理'|trans }}
            </a>
          </li>
        </div>
      {% endif %}
    </ul>
  </div>


{% endblock %}