{% extends "postorius/base.html" %}
{% load i18n %}
{% load pagination %}
{% load date_helpers %}
{% load postorius_helpers %}

{% block head_title %}
{% trans 'Users' %} - {{ block.super }}
{% endblock %}

{% block content %}
<div class="page-header">
  <h1>{% trans 'Users' %}</h1>
</div>

<div class="row mb-2">
  <div class="col-3">
  <form method="GET" action="{% url 'list_users' %}">
    <div class="input-group rounded">
      <input type="search" class="form-control rounded" placeholder="{% trans 'Search' %}" aria-label="Search"
             {% if query %}value="{{query}}"{% endif %}
             aria-describedby="search-addon" name="q" />
      <button type="submit" class="btn btn-primary">
        <i class="fa fa-search"></i>
      </button>
    </div>
  </form>
  </div>
</div>

<div class="table-responsive">
  <table class="table table-bordered table-striped">
    <thead>
      <tr>
        <th>{% trans 'User' %}</th>
        <th>{% trans 'Created' %}</th>
        <th>{% trans 'Manage' %}</th>
      </tr>
    </thead>
    <tbody>
      {% for auser in all_users %}
      <tr>
        <td> {{ auser|user_display }}</td>
        <td> {{ auser.created_on|datetime_parse|date:"DATETIME_FORMAT" }}</td>
        <td>
          <a class="btn btn-primary btn-sm" href={% url 'manage_user' auser.user_id %}>Manage</a>
        </td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>
{% paginator all_users %}
{% endblock %}
