{% extends "admin_app.html" %}
{% from "library.j2" import action_button, icon, value_or_hint, custom_form_button %}
{% block content %}
<h1>{% trans %}Manage users{% endtrans %}</h1>
<div class="elevated el-2"><table>
	<thead>
		<tr>
			<th>{% trans %}Login name{% endtrans %}</th>
			<th>{% trans %}Display name{% endtrans %}</th>
			<th>{% trans %}Actions{% endtrans %}</th>
		</tr>
	</thead>
	<tbody>
{% for user in users %}
		<tr>
			<td>
				{{- user.localpart -}}
				{%- if user.has_admin_role -%}
					<span class="with-tooltip above" data-tooltip="{% trans %}The user is an administrator.{% endtrans %}">{% call icon("admin") %}{% trans %} (Administrator){% endtrans %}{% endcall %}</span>
				{%- endif -%}
				{%- if user.has_restricted_role -%}
					<span class="with-tooltip above" data-tooltip="{% trans %}The user is restricted.{% endtrans %}">{% call icon("lock") %}{% trans %} (Restricted){% endtrans %}{% endcall %}</span>
				{%- endif -%}
			</td>
			<td>{% call value_or_hint(user.display_name) %}{% endcall %}</td>
			<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 -%}
				</form>
			</td>
		</tr>
{% endfor %}
	</tbody>
</table></div>
{%- include "admin_create_invite_form.html" -%}
{% endblock %}
