{% extends "panel_base.html" %}
{% import '_macros.html' as macros %}
{% block header_title %}{{gettext("Groups List")}} | {{get_sitename()}}{% endblock %}

{% block content %}
<div class="row">
  <div class="col-md-12 col-sm-12 col-xs-12">
    <div class="x_panel">
      <div class="x_title">
        <h2>{{gettext("Groups")}}</h2>
        <ul class="nav navbar-left panel_toolbox">
          <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
          </li>
          <li><a class="close-link"><i class="fa fa-close"></i></a>
          </li>
        </ul>
        <div class="clearfix"></div>
      </div>
      <div class="x_content">
        <p class="text-muted font-13 m-b-30">
        </p>
        <a class="btn btn-info btn-lg" href="{{url_for('panel.groups_create')}}">{{gettext("Add Group")}}</a>

        {{macros.paginate(page, pages, 'panel.groups_list')}}
        <div class="table-responsive">
          <table class="table table-striped jambo_table bulk_action">
            <thead>
              <tr>
                <td>{{gettext("ID")}}</td>
                <td>{{gettext("Name")}}</td>
                <td>{{gettext("Permissions")}}</td>
                <td>{{gettext("Setting")}}</td>
              </tr>
            </thead>
            <tbody>
              {% for g in groups %}
              <tr>
                <td>{{g.id}}</td>
                <td>{{g.name}}</td>
                <td>
                  {% for p in g.permissions %}
                  {{p.name}}<br>
                  {% endfor %}
                </td>
                <td>
                  <a class="btn btn-warning"
                    href="{{url_for('panel.groups_edit', group_id=g.id)}}">{{gettext("Edit")}}</a>
                </td>
              </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}