{% import "admin/macro.html.twig" as admin_macro %}
{% set target = 'recommend_list' %}

{% if course.type == 'open' or course.type == 'liveOpen' %}
  {% set showUrl = path('open_course_show',{courseId:course.id}) %}
  {% set cancelUrl = path('admin_open_course_cancel_recommend', {id:course.id,target:target}) %}
  {% set recommendUrl = path('admin_open_course_recommend', {id:course.id, ref:'recommendList'}) %}
{% else %}
  {% set showUrl = path('course_show',{id:course.id}) %}
  {% set cancelUrl = path('admin_course_cancel_recommend', {id:course.id,target:target}) %}
  {% set recommendUrl = path('admin_course_recommend', {id:course.id, ref:'recommendList'}) %}
{% endif %}

<tr id="course-tr-{{ course.id }}" data-sort="{{ course.recommendedSeq }}">
  <td>{{ course.recommendedSeq }}</td>
  <td>
    <a href="{{ showUrl }}" target="_blank"><strong>{{ course.title }}</strong></a>
    <br>
    <span class="text-muted text-sm">{{'分类：'|trans}}{{ category.name|default('--') }}</span>
  </td>
  {% if course.type not in ['open','liveOpen'] %}
    {% include 'org/parts/table-body-td.html.twig' with {orgCode: course.orgCode}%}
  {% endif %}
  <td>
    {{ admin_macro.user_link(user) }}
    <br>
    <span class="text-muted text-sm">{{ course.createdTime|date('Y-n-d H:i') }}</span>
  </td>
  <td>
    {{ course.recommendedTime|date('Y-m-d') }}
  </td>
  <td>

    <div class="btn-group">
      <a class="btn btn-default btn-sm" href="#modal" data-toggle="modal" data-url="{{ recommendUrl }}">{{'设置序号'|trans}}</a>

      <a href="#" type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
      </a>
      <ul class="dropdown-menu pull-right">

        <li>
          <a class="cancel-recommend-course" href="javascript:" data-url="{{ cancelUrl }}">
          <span class="glyphicon glyphicon-hand-right"></span> {{'取消推荐'|trans}}</a>
        </li>
    
      </ul>
    </div>
  </td>
</tr>