{% import "admin/macro.html.twig" as admin_macro %}

{% import "common/data-dict-macro.html.twig" as dict_macro %}
{% set target = ''~filter~'_index' %}
<tr id="course-tr-{{ courseSet.id }}">
  {% include 'org/parts/table-body-checkbox.html.twig' %}
  <td>{{ courseSet.id }}</td>
  <td>
    <a href="{{ path('course_show', {id: courseSet.defaultCourseId}) }}"
       target="_blank"><strong>{{ courseSet.title }}</strong></a>
    {% if filter == 'classroom' %}
      {% set classroom = classrooms[courseSet.id]|default(null) %}
      {% if not classroom %}
        <span class="label label-danger live-label mls">{{ '已移除'|trans }}</span>
      {% endif %}
    {% endif %}
    {% if courseSet.type == 'live' %}
      <span class="label label-success live-label mls">直播</span>
    {% endif %}
    <br>
    <span class="text-muted text-sm">{{ '分类：'|trans }}{{ category.name|default('--') }}</span>
    {% if courseSet.recommended %}
      <span class="label label-default">{{ '荐:'|trans }}{{ courseSet.recommendedTime|date('Y-m-d') }}
        / {{ '序号:'|trans }}{{ courseSet.recommendedSeq }}</span>
    {% endif %}

  </td>
  <td>{{ courseSet.minCoursePrice|default() }}</td>
  {% include 'org/parts/table-body-td.html.twig' with {orgCode: courseSet.orgCode} %}
  {% if filter != 'open' and filter != 'liveOpen' %}
    <td>
      <span class="text-info">{{ dict_text('courseSerializeMode',courseSet.serializeMode) }}</span>
    </td>
    {% if filter == 'classroom' %}
      <td>
        {% set classroom = classrooms[courseSet.id]|default(null) %}
        {% if classroom %}
          <a href="{{ path('classroom_show',{id:classroom.classroomId}) }}"
             target="_blank">{{ classroom.classroomTitle }}</a>
        {% endif %}
      </td>
    {% else %}
      <td>{{ courseSet.studentNum }}</td>
    {% endif %}
    {% if filter == 'vip' %}
      {% set levels = courseSet['levels'] %}
      {% set length = levels|length %}
      {% if length == 0 %}
        <td>该会员等级已删除</td>
      {% else %}
        <td>{{ levels|first.name }}
          {% if length > 1 %}
            <br>
            <span class="text-muted text-sm">等{{ length }}个会员等级</span>
          {% endif %}
        </td>
      {% endif %}
    {% endif %}
  {% endif %}

  <td> {{ dict_macro.courseStatus( courseSet.status) }}</td>
  <td>
    {{ admin_macro.user_link(user) }}
    <br>
    <span class="text-muted text-sm">{{ courseSet.createdTime|date('Y-n-d H:i') }}</span>
  </td>
  <td>
    <div class="btn-group">

      {% if has_permission('admin_course_content_manage') %}
        <a class="btn btn-default btn-sm" href="{{ path('course_set_manage_base', {id:courseSet.id}) }}"
           target="_blank">{{ '管理'|trans }}</a>
      {% endif %}
      {% include 'admin/role/templates/group-button.html.twig' with {parentCode: 'admin_course_manage', group:'groupButton', courseSet: courseSet} %}
    </div>
  </td>
</tr>