parcel/templates/admin/users.html
Blake Rain cd8efa869f
Some checks failed
Check / check (push) Failing after 59s
fix: tidy up layout on smaller screen sizes
2024-08-10 11:37:36 +01:00

126 lines
4.4 KiB
HTML

{% extends "base.html" %}
{% block title %}Users{% endblock %}
{% block content %}
<div class="grow container mx-auto mt-4">
<div id="user-list-container" class="panel gap-4">
<div class="flex flex-row justify-between items-center">
<h1 class="heading">
<a href="/admin">Administration</a> / Users
</h1>
<div class="buttons">
<button
class="button"
type="button"
hx-get="/admin/users"
hx-target="#user-list-container"
hx-select="#user-list-container"
hx-swap="outerHTML">
<span class="icon-refresh-cw"></span>
Refresh
</button>
<button
class="button"
type="button"
hx-get="/admin/users/new"
hx-target="body"
hx-swap="beforeend">
<span class="icon-plus"></span>
Add User
</button>
</div>
</div>
<div class="table">
<table>
<thead>
<tr>
<th class="text-right">ID</th>
<th class="text-left">Username</th>
<th class="text-left">Display Name</th>
<th class="text-center">Enabled</th>
<th class="text-center">MFA</th>
<th class="text-center">Admin</th>
<th class="text-left">Created At</th>
<th class="text-right">Limit</th>
<th />
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td class="text-right">{{ user.id }}</td>
<td class="text-left">
{{ user.username }}
{% if user.id == auth.id %}
<span class="text-sm text-success">(you)</span>
{% endif %}
</td>
<td class="text-left">{{ user.name }}</td>
<td class="text-center {% if user.enabled %}text-success{% else %}text-danger{% endif %}">
{% if user.enabled %}Yes{% else %}No{% endif %}
</td>
<td class="text-center {% if user.totp is string %}text-success{% endif %}">
{% if user.totp is string %}Yes{% else %}No{% endif %}
</td>
<td class="text-center {% if user.admin %}text-success{% else %}text-danger{% endif %}">
{% if user.admin %}Yes{% else %}No{% endif %}
</td>
<td class="text-left">{{ user.created_at|datetime }}</td>
<td class="text-right">
{% if user.limit is number %}
{{ user.limit | filesizeformat }}
{% else %}
<i>No Limit</i>
{% endif %}
</td>
<td class="text-right">
{% if user.id != auth.id %}
<a
href="#"
title="{% if user.enabled %}Disable{% else %}Enable{% endif %} user"
hx-post="/admin/users/{{ user.id }}/{% if user.enabled %}disable{% else %}enable{% endif %}"
hx-trigger="click"
hx-target="#user-list-container"
hx-select="#user-list-container"
hx-swap="outerHTML">
{% if user.enabled %}
<span class="icon-lock"></span>
{% else %}
<span class="icon-lock-open"></span>
{% endif %}
</a>
{% endif %}
<a
href="#"
title="Edit user"
hx-get="/admin/users/{{ user.id }}"
hx-target="body"
hx-swap="beforeend">
<span class="icon-pencil"></span>
</a>
{% if user.id != auth.id %}
<a
href="#"
class="text-danger"
title="Delete user"
hx-delete="/admin/users/{{ user.id }}"
hx-trigger="click"
hx-target="#user-list-container"
hx-select="#user-list-container"
hx-swap="outerHTML"
hx-confirm="Are you sure you want to delete this user?">
<span class="icon-trash"></span>
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}