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

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

{% block content %}
  
  {% call m_box(title=_("Groups")) %}

    {{ buttons.create_a(url_for('.groups_new'), _('New Group...')) }}

    {% set table_id = next(g.id_generator) %}
    <table class="table table-condensed table-striped" id="{{ table_id }}">
      <thead>
        <tr>
          <th>{{ _("Name") }}</th>
          <th width="10%">{{ _('Public') }}</th>
        </tr>
      </thead>
      <tbody>
      </tbody>
    </table>

    <div class="clearfix"></div>

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