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

{% set menu = 'admin_v2_operation_group' %}

{% set script_controller='group/group' %}

{% block main %}

  <form id="message-search-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.groupstatus_option'|trans) }}
      </select>

    </div>

    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'admin.operation_group.group_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.ownerName.placeholer'|trans}}" name="ownerName" value="{{ app.request.get('ownerName') }}">
    </div>

    <button class="btn btn-primary">{{'form.btn.search'|trans}}</button>

  </form>
  {% if groupinfo%}
  <table class="table table-striped table-hover" id="group-table">
    <thead>
    <tr>
      <th>{{'admin.operation_group.group_number_th'|trans}}</th>
      <th width="20%">{{'admin.operation_group.group_name_th'|trans }}</th>
      <th>{{'admin.operation_group.ownerName_th'|trans}}</th>
      <th>{{'admin.operation_group.memberNum_th'|trans}}</th>
      <th>{{'admin.operation_group.threadNum_th'|trans}}</th>
      <th>{{'admin.operation_group.postNum_th'|trans}}</th>
      <th>{{'admin.operation_group.status_th'|trans}}</th>
      <th>{{'admin.operation_group.operation_th'|trans}}</th>
    </tr>
    </thead>
    <tbody>

   {% for group in groupinfo %}

      {% include 'admin-v2/operating/group/table-tr.html.twig' with {group:group} %}

   {% endfor %}

    </tbody>

  </table>
  {% else %}
    <div class="empty">{{'site.datagrid.empty'|trans}}</div>
  {% endif %}
  <div class="pull-right">
 {{ admin_macro.paginator(paginator) }}
</div><div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">{{'admin.operation_group.modal.enter_user_name'|trans}}</h4>
      </div>          
      <form  class="form-horizontal" method="post" id="transfer-group-form" >
        <div class="modal-body">
              <div class="form-group">
                <label class="col-xs-2 control-label" for="user_nickname">{{'admin.operation_group.modal.transfer_to'|trans }}</label>
                <div class="col-xs-7 controls">
                  <input type="text"  id="username" name="user[nickname]" class="form-control"
                  data-url="{{path('group_thread_check_user')}}" data-display="{{'admin.operation_group.modal.user_name.data_display'|trans}}"  placeholder="{{'admin.operation_group.modal.enter_user_name.placeholer'|trans}}">
                  <div class="help-block" style="display:none;"></div>
                </div>
                <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
              </div>
        </div>
        <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">{{'admin.operation_group.modal.close_btn'|trans}}</button>
              <button type="submit" class="btn btn-primary" >{{'admin.operation_group.modal.confirm_to_transfer_group_btn'|trans}}</button>
        </div>   
      </form>
    </div>
  </div>
</div>
{% endblock %}