{% extends "panel_base.html" %}
{% import '_macros.html' as macros %}
{% block header_title %}{{gettext("Users 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("Users")}}</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.users_create')}}">{{gettext("Add Admin")}}</a>

        {{macros.paginate(page, pages, 'panel.users_list')}}
        <div class="table-responsive">
          <table class="table table-striped jambo_table bulk_action">
            <thead>
              <tr>
                <td>{{gettext("ID")}}</td>
                <td>{{gettext("email")}}</td>
                <td>{{gettext("first name")}}</td>
                <td>{{gettext("last name")}}</td>
                <td>{{gettext("is admin")}}</td>
                <td>{{gettext("group name")}}</td>
                <td>{{gettext("is confirmed")}}</td>
                <td>{{gettext("settings")}}</td>
              </tr>
            </thead>
            <tbody>
              {% for u in users %}
              <tr>
                <td>{{u.id}}</td>
                <td>{{u.email}}</td>
                <td>{{u.get_first_name()}}</td>
                <td>{{u.get_last_name()}}</td>
                <td>{% if u.is_admin %}{{gettext("Yes")}}{% else %}{{gettext("No")}}{% endif %}</td>
                <td>
                  {% for g in u.groups %}
                  {{g.name}}<br>
                  {% endfor %}
                </td>
                <td>{% if u.confirmed %}{{gettext("Yes")}}{% else %}{{gettext("No")}}{% endif %}</td>
                <td><a class="btn btn-warning"
                    href="{{url_for('panel.users_edit', user_id=u.id)}}">{{gettext("Edit")}}</a></td>
              </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}