{% extends "admin_app.html" %}
{% from "library.j2" import action_button, avatar, icon, render_user, value_or_hint, custom_form_button with context %}
{% block content %}
<h1>{% trans %}Manage users{% endtrans %}</h1>
<div class="elevated el-2"><table>
	<thead>
		<tr>
			<th>{% trans %}User{% endtrans %}</th>
			<th>{% trans %}Last active{% endtrans %}</th>
			<th>{% trans %}Actions{% endtrans %}</th>
		</tr>
	</thead>
	<tbody>
{% for user in users %}
		<tr>
			<td>
				{%- call render_user(user) -%}{%- endcall -%}
			</td>
			{% if user.enabled %}
			<td>{{ user.last_active | format_last_activity }}</td>
			{% elif user.deletion_request %}
			<td>{% trans %}Deleted{% endtrans %}</td>
			{% else %}
			<td>{% trans %}Locked{% endtrans %}</td>
			{% endif %}
			<td class="nowrap">
				{%- call action_button("edit", url_for(".edit_user", localpart=user.localpart), class="primary") -%}
					{% trans user_name=user.localpart %}Edit user {{ user_name }}{% endtrans %}
				{%- endcall -%}
			</td>
		</tr>
{% endfor %}
	</tbody>
</table></div>
{%- include "admin_create_invite_form.html" -%}
{% endblock %}
