{% if courseSet.type == 'open' or courseSet.type == 'liveOpen' %}
  {% set layout = 'open-course-manage/layout.html.twig' %}
{% else %}
  {% set layout = 'courseset-manage/layout.html.twig' %}
{% endif %}
{% extends layout %}
{% do script(['app/js/course-manage-file/index/index.js']) %}

{% block title %}{{'课程文件'|trans}} - {{ parent() }}{% endblock %}

{% set side_nav = 'files' %}
{% set tab = 'courseLesson' %}



{% block main %}

  <style type="text/css">
  .tooltip-inner{
  max-width: 600px;
  }
  </style>
  {% if courseSet.type in ['open','liveOpen'] %}
    {% set targetType = 'opencoursematerial' %}
  {% else %}
    {% set targetType = 'coursematerial' %}
  {% endif %}
  <div class="panel panel-default" role="courseset-manage-file">
    <div class="panel-heading">
      <a class="btn btn-info btn-sm pull-right"
        data-toggle="modal" data-target="#modal"
        data-url="{{path('uploader_batch_upload', {token:uploader_token(targetType, courseSet.id, 'private')}) }}"
      >
        <i class="glyphicon glyphicon-cloud-upload"></i>{{'添加课程文件'|trans}}
      </a>
      {{'课程文件'|trans}}
    </div>

    <div class="panel-body" id="file-manage-panel" data-file-status-url="{{path('course_set_manage_file_status')}}">
      <table class="table table-striped table-hover" id="course-lesson-table">
        <thead>
          <tr>
            <th width="5%"><input type="checkbox"  data-role="batch-select"></th>
            <th width="30%">{{'文件名'|trans}}</th>
            <th>{{'类型'|trans}}</th>
            <th>{{'大小'|trans}}</th>
            <th>{{'使用'|trans}}</th>
            <th>{{'最后更新'|trans}}</th>
            <th>{{'操作'|trans}}</th>
          </tr>
        </thead>
        <tbody>

          {% for uploadFile in files if uploadFile %}
            {% include 'courseset-manage/file/tbody-tr.html.twig' %}
          {% else %}
            <tr class="empty"><td colspan="20">{{'无文件记录'|trans}}</td></tr>
          {% endfor %}
          
        </tbody>
      </table>

      <label class="checkbox-inline mrm mbm"><input type="checkbox" data-role="batch-select"> {{'全选'|trans}}</label>

      <div class="btn-group mbm">
        {% if courseSet.type == 'normal' or courseSet.type =='live'  %}
          <button class="btn btn-danger btn-sm" data-role="batch-delete" data-name="{{'文件记录'|trans}}" data-url="{{ path('course_set_manage_delete_materials_show', {id:courseSet.id, type:tab}) }}">
        {% elseif courseSet.type == 'open' or courseSet.type == 'liveOpen' %}
          <button class="btn btn-danger btn-sm" data-role="batch-delete" data-name="{{'文件记录'|trans}}" data-url="{{ path('open_course_manage_delete_materials_show', {id:courseSet.id, type:tab}) }}">
        {% endif %}
        <i class="glyphicon glyphicon-trash"></i>
        {{'移除'|trans}}</button>
      </div>

      <nav class="text-center">
        {{ web_macro.paginator(paginator) }}
      </nav>

    </div>
  </div>
{% endblock %}