{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set menu = 'admin_course_data' %}

{% block main %}

    <form id="message-search-form" class="form-inline well well-sm mtl" action="{{ path('admin_course_data') }}" method="get" novalidate>
      <div class="form-group">
        <select class="form-control" name="categoryId">
          {{ select_options(category_choices('course'), app.request.query.get('categoryId'), '课程分类') }}
        </select>
      </div>
      <div class="form-group">
        <input class="form-control" type="text" placeholder="标题" name="title" value="{{ app.request.get('title') }}">
      </div>
      <div class="form-group">
        <input class="form-control" type="text" placeholder="创建者" name="creator" value="{{ app.request.get('creator') }}">
      </div>
      <button class="btn btn-primary">搜索</button>
    </form>
    <div class="table-responsive">
        <table class="table table-bordered" style="word-break:break-all;text-align:center;">
          <tr class="active">
            <td width="30%">课程名</td>
            <td>课时数</td>
            <td>{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}人数</td>
            <td>完成课程人数</td>
            <td>课程学习时长(分)</td>
            <td>课程收入(元)</td>
            <td>操作</td>
          </tr>
          
          {% if courses %}
            {% for course in courses %}
            <tr>
            <td><a data-toggle="modal" data-target="#modal" data-url="{{path('course_detail_data',{id:course.id})}}" href="javascript:">{{course.title}}</a></td>
            <td>{{course.lessonCount}}</td>
            <td>{{course.studentNum}}</td>
            <td>{{course.isLearnedNum}}</td>
            <td>{{(course.learnTime/60)|round(0, 'floor')}}</td>
            <td>{{course.income}}</td>
            <td><a href="{{path('admin_course_lesson_data',{id:course.id})}}">查看课时数据</a></td>
            </tr>
            {% endfor %}
          {% endif %}
          
         
        </table>
     {{ web_macro.paginator(paginator) }}
      </div>


{% endblock %}