Files
2025-11-18 01:04:39 -03:00

82 lines
3.3 KiB
HTML

{% load hijack %}
{% load i18n %}
<c-ui.fab-single-action
url="{% url 'user_add' %}"
hx_target="#generic-offcanvas">
</c-ui.fab-single-action>
<div class="container px-md-3 py-3 column-gap-5">
<div class="text-3xl font-bold font-mono w-full mb-3">
{% spaceless %}
<div>{% translate 'Users' %}</div>
{% endspaceless %}
</div>
<div class="card card-border bg-base-100 shadow w-full">
<div class="card-body">
<div id="tags-table">
{% if users %}
<div class="overflow-x-auto">
<c-config.search></c-config.search>
<div class="overflow-x-auto">
<table class="table table-zebra">
<thead>
<tr>
<th scope="col" class="table-col-auto"></th>
<th scope="col">{% translate 'Active' %}</th>
<th scope="col">{% translate 'Name' %}</th>
<th scope="col">{% translate 'Email' %}</th>
<th scope="col">{% translate 'Superuser' %}</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr class="tag">
<td class="table-col-auto">
<div class="join" role="group" aria-label="{% translate 'Actions' %}">
<a class="btn btn-secondary btn-sm join-item"
role="button"
hx-swap="innerHTML"
data-tippy-content="{% translate "Edit" %}"
hx-get="{% url 'user_edit' pk=user.id %}"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-pencil fa-fw"></i></a>
{% if request.user|can_hijack:user and request.user != user %}
<a class="btn btn-info btn-sm join-item"
role="button"
data-tippy-content="{% translate "Impersonate" %}"
hx-post="{% url 'hijack:acquire' %}"
hx-vals='{"user_pk":"{{ user.id }}"}'
hx-swap="none"
_="on htmx:afterRequest(event) from me
if event.detail.successful
go to url '/'">
<i class="fa-solid fa-mask fa-fw"></i></a>
{% endif %}
</div>
</td>
<td>
{% if user.is_active %}
<i class="fa-solid fa-solid fa-check text-success"></i>
{% endif %}
</td>
<td>{{ user.first_name }} {{ user.last_name }}</td>
<td>{{ user.email }}</td>
<td>
{% if user.is_superuser %}
<i class="fa-solid fa-solid fa-check text-success"></i>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% else %}
<c-msg.empty title="{% translate "No users" %}" remove-padding></c-msg.empty>
{% endif %}
</div>
</div>
</div>
</div>