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

{% set menu = 'admin_v2_login_record' %}

{% set script_controller = 'login-record/list' %}

{% block main %}

<div class="well well-sm">
  <form id="login-record-search-form" class="form-inline" action="" method="get" novalidate> 
    
    {% include 'org/org-tree-select.html.twig' with {orgCode: app.request.get('orgCode'), modal: 'list'} %}
    
    <div class="form-group controls">
      <select id="keywordType" name="keywordType" class="form-control">
        {{ select_options(dict('userKeyWordTypes'), app.request.query.get('keywordType')) }}
      </select>
    </div>

    <div class="form-group">
      <input type="text" id="keyword" name="keyword" class="form-control" value="{{ app.request.query.get('keyword') }}" placeholder="{{'admin.user.form.input_placeholder.keyword'|trans}}">
    </div>

    <div class="form-group">
        <input class="form-control" type="text" id="startDate" name="startDateTime" value="{{app.request.query.get('startDateTime')}}" placeholder="{{'admin.user.form.input_placeholder.startDate'|trans}}" autocomplete="off">
    </div>

    <div class="form-group">
        <input class="form-control" type="text" id="endDate" name="endDateTime" value="{{app.request.query.get('endDateTime')}}" placeholder="{{'admin.user.form.input_placeholder.endDate'|trans}}" autocomplete="off">
    </div>
    <span></span>

    <button class="btn btn-primary">{{'admin.user.form.btn.search_submit_btn'|trans}}</button>
  </form>
</div>

<table id="teacher-table" class="table table-striped table-hover" data-search-form="#user-search-form">
  <thead>
    <tr>
      <th>{{'user.fields.username_label'|trans}}</th>
      {% include 'org/parts/table-thead-tr.html.twig' %}
      <th>{{'admin.user.fields.user_email'|trans}}</th>
      <th>{{'admin.user.login_record.fields.login_time_and_ip_label'|trans}}</th>
      <th>{{'admin.user.login_record.fields.login_address_label'|trans}}</th>
      <th width="12%">{{'admin.user.login_record.fields.view_record_label'|trans}}</th>
    </tr>
  </thead>
  <tbody>
    {% for logRecord in logRecords %}
      {% set user = users[logRecord.userId]|default(null) %}
      {% include 'admin-v2/user/login-record/table-tr.html.twig' with {logRecord:logRecord} %}
    {% endfor %}
  </tbody>
</table>
  {{ admin_macro.paginator(paginator) }} 
{% endblock %}