{% extends "admin/_base.html" %}

{% import "macros/buttons.html" as buttons %}
{% from "macros/box.html" import m_box %}

{% block content %}

  {% call m_box(title=_("Users")) %}

    {{ buttons.create_a(url_for('.users_new'), _('New user...')) }}

    {% set table_id = next(g.id_generator) %}
    <table class="table table-condensed table-striped" id="{{ table_id }}">
      <thead>
      <tr>
        <th></th>
        <th>{{ _("Name") }}</th>
        <th>{{ _('Email') }}</th>
        <th width="10%">{{ _('Login enabled') }}</th>
        <th>{{ _("Groups") }}</th>
        <th>{{ _("Roles") }}</th>
        <th>{{ _('Last connection') }}</th>
      </tr>
      </thead>

      <tbody>
      </tbody>
    </table>

    <div style="clear: both;"></div>


    {%- deferJS %}
      <script type="text/javascript">
        require(
            ['jquery', 'jquery.dataTables'],
            function ($) {
              var id = "#{{ table_id }}"; // Should be unique enough
              $(id).dataTable({{ datatable_options|tojson|safe }});
            });
      </script>
    {%- enddeferJS %}
  {% endcall %}

{% endblock %}
