{% extends 'admin/layout.html.twig' %}

{% set script_controller = 'course/recommend-list' %}

{% set menu = 'admin_course_recommend_list' %}

{% block main %}
  
  <form id="message-search-form" class="form-inline well well-sm" action="" method="get" novalidate>
    {% include 'org/org-tree-select.html.twig' with {orgCode: app.request.get('orgCode'), modal: 'list'} %}
    <div class="form-group">
      <select style="width:150px;" class="form-control" name="categoryId">
        {{ select_options(category_choices('course'), app.request.query.get('categoryId'), 'admin.course_manage.category_placeholder'|trans ) }}
      </select>
    </div>
    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'admin.course_manage.title_placeholder'|trans}}" name="title" value="{{ app.request.get('title') }}">
    </div>
    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'admin.course_manage.creator_placeholer'|trans}}" name="creator" value="{{ app.request.get('creator') }}">
    </div>
    <button class="btn btn-primary">{{'form.btn.search'|trans}}</button>

  </form>
  
  <table class="table table-striped table-hover mtl" id="course-recommend-table">
    <thead>
    <tr>
      <th>{{'admin.course_manage.recommend.seq'|trans}}</th>
      <th width="35%">{{'admin.course_manage.recommend.name'|trans}}</th>
      {% include 'org/parts/table-thead-tr.html.twig' %}
      <th>{{'admin.course_manage.recommend.creator'|trans}}</th>
      <th>{{'admin.course_manage.recommend.time'|trans}}</th>
      <th>{{'admin.course_manage.operater'|trans}}</th>
    </tr>
    </thead>
    <tbody>
      {% for course in courses %}
        {% set user = users[course.userId]|default(null) %}
        {% set category = categories[course.categoryId]|default(null) %}
            {% include 'admin/course/course-recommend-tr.html.twig' %}
      {% else %}
        <tr><td colspan="20"><div class="empty">{{'admin.course_manage.recommend.empty'|trans}}</div></td></tr>
      {% endfor %}
    </tbody>
  </table>

  {{ admin_macro.paginator(paginator) }}

{% endblock %}