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

{% set menu = 'admin_operation_group_thread' %}

{% set script_controller = 'group/thread' %}
{% block main %}

  <form  class="form-inline well well-sm" action="" method="get" novalidate>

    <div class="form-group">
      <select class="form-control" name="status">
        {{ select_options(dict('groupstatus'), app.request.query.get('status'), 'admin.operation_group.thread.status_option'|trans) }}
      </select>
    </div>
    
    <div class="form-group">
      <select class="form-control" name="threadType">
        {{ select_options(dict('threadProperty'), app.request.get('threadType'), 'admin.operation_group.thread.threadType_option'|trans) }}
      </select>
    </div>

    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'admin.operation_group.thread.groupName.placeholer'|trans}}" name="groupName" value="{{ app.request.get('groupName') }}">
    </div>

    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'admin.operation_group.thread.title.placeholer'|trans}}" name="title" value="{{ app.request.get('title') }}">
    </div>

    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'admin.operation_group.thread.userName.placeholer'|trans}}" name="userName" value="{{ app.request.get('userName') }}">
    </div>
    
    <button class="btn btn-primary">{{'form.btn.search'|trans}}</button>
  </form>
  {% if threadinfo %}
    <form method="post" id="thread-form">
      <div class="table-responsive">
        <table class="table table-striped table-hover" id="thread-table">
          <thead>
            <tr>
              <th nowrap="nowrap"><input type="checkbox"  data-role="batch-select"/> {{'admin.operation_group.thread.thread_number_th'|trans}}</th>
              <th width="30%">{{'admin.operation_group.thread.thread_title_th'|trans}}</th>
              <th nowrap="nowrap">{{'admin.operation_group.thread.thread_type_th'|trans}}</th>
              <th nowrap="nowrap">{{'admin.operation_group.thread.nickname_th'|trans}}</th>
              <th nowrap="nowrap">{{'admin.operation_group.thread.group_title_th'|trans}}</th>
              <th nowrap="nowrap">{{'admin.operation_group.postNum_th'|trans}}</th>
              <th nowrap="nowrap">{{'admin.operation_group.status_th'|trans}}</th>
              <th width="100px" nowrap="nowrap">{{'admin.operation_group.operation_th'|trans}}</th>
            </tr>
          </thead>

          <tbody>
            {% for thread in threadinfo %}  
              {% include 'admin/group/thread-table-tr.html.twig' with {thread:thread} %}
            {% endfor %}
          </tbody>
        </table>
      </div>
      <div>  
        <label class="checkbox-inline">
          <input type="checkbox" data-role="batch-select">{{'form.checkbox.batch_select'|trans}}
        </label>
        <input type="hidden" id="batchDeleteThread" value="{{path('admin_groupThread_batch_delete')}}">
        <button id="thread-delete-btn" data-submiting-text="{{'form.btn.delete.submiting'|trans}}" type="button" class="btn btn-default btn-sm mlm">{{'admin.operation_group.thread.thread_delete_btn'|trans}}</button>
      </div>
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>
  {% else %}
    <div class="empty">{{'admin.operation_group.thread.empty_tips'|trans}}</div>
  {% endif %}
  <div class="pull-right">
    {{ admin_macro.paginator(paginator) }}
  </div>
{% endblock %}