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

{% block title %}学生管理 - {{ parent() }}{% endblock %}

{% set menu = 'student' %}

{% set script_controller = 'student/list' %}

{% block main %}
<div class="page-header clearfix">
  <button class="btn btn-info btn-sm pull-right mls" id="add-navigation-btn" data-toggle="modal" data-target="#modal" data-url="{{path('admin_user_create',{type:'student'})}}" >添加</button>
  <a class="btn btn-info btn-sm pull-right" href="{{ path('admin_user_import_check',{type:'student'}) }}">导入</a>
  <h1 class="pull-left">学生管理</h1>
</div>
<form id="user-search-form" class="form-inline well well-sm" action="" method="get" novalidate> 

  <div class="form-group">
    <input type="text" id="class_name" name="class_name" data-url="{{path('admin_class_list')}}" class="form-control" value="{{ app.request.query.get('class_name') }}" placeholder="按班级">

    <input type="hidden" id="class_id" name="class_id" class="form-control" value="{{ app.request.query.get('class_id') }}" >
  </div>

  <div class="form-group">
    <input type="text" id="truename" name="search_truename" class="form-control" value="{{ app.request.query.get('search_truename') }}" placeholder="姓名">
  </div>

  <div class="form-group">
    <input type="text" id="number" name="search_number" class="form-control" value="{{ app.request.query.get('search_number') }}" placeholder="学号">
  </div>

  <button class="btn btn-primary">搜索</button>
</form>

<table id="user-table" class="table table-striped table-hover" data-search-form="#user-search-form">
  <thead>
    <tr>
      <th>学号</th>
      <th>姓名</th>
      <th>所属班级</th>
      <th>最近登录</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    {% for user in users %}
      {% set classStudent = classStudents[user.id]|default(null) %}
      {% if classStudent %}
        {% set class = classes[classStudent.classId]|default(null) %}
      {% else %}
        {% set class = null %}
      {% endif %}
      {% include 'TopxiaAdminBundle:Student:student-table-tr.html.twig' %}
    {% endfor %}
  </tbody>
</table>
 {{ web_macro.paginator(paginator) }} 
{% endblock %}