haikal/templates/groups/group_list.html
2025-09-24 13:36:02 +03:00

72 lines
3.8 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% load custom_filters %}
{% load render_table from django_tables2 %}
{% block title %}
{% trans "Groups" %}
{% endblock title %}
{% block content %}
<div class="container py-5">
{% if groups or request.GET.q %}
<div class="d-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-muted d-flex align-items-center">
<i class="fa-solid fa-user-group me-3 fs-2"></i>
{% trans "Groups" %}
</h1>
<div class="d-flex">
<a href="{% url 'group_create' request.dealer.slug %}"
class="btn btn-phoenix-primary me-2 shadow-sm">
<i class="fa-solid fa-plus me-2"></i>{% trans "Add New Group" %}
</a>
<a href="{% url 'user_list' request.dealer.slug %}"
class="btn btn-phoenix-secondary shadow-sm">
<i class="fa-solid fa-arrow-left me-2"></i>{% trans "Back to Staffs" %}
</a>
</div>
</div>
<div class="card border-0 shadow-sm rounded-lg">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover table-borderless mb-0">
<thead class="bg-light">
<tr>
<th class="py-3 px-4">{% trans 'Name'|capfirst %}</th>
<th class="py-3 px-4">{% trans 'Total Users'|capfirst %}</th>
<th class="py-3 px-4">{% trans 'Total Permissions'|capfirst %}</th>
<th class="py-3 px-4 text-center">{% trans 'Actions'|capfirst %}</th>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr class="border-bottom">
<td class="align-middle py-3 px-4">{{ group.name }}</td>
<td class="align-middle py-3 px-4 text-muted">
<i class="fa-solid fa-users me-1"></i> {{ group.users.count }}
</td>
<td class="align-middle py-3 px-4 text-muted">
<i class="fa-solid fa-unlock me-1"></i> {{ group.permissions.count }}
</td>
<td class="align-middle py-3 px-4 text-center">
<a class="btn btn-sm btn-phoenix-secondary"
href="{% url 'group_detail' request.dealer.slug group.id %}">
<i class="fa-solid fa-eye me-1"></i>{% trans 'View Permissions' %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-center mt-4">{% include 'partials/pagination.html' %}</div>
{% endif %}
</div>
{% else %}
{% url "group_create" request.dealer.slug as create_group_url %}
{% include "empty-illustration-page.html" with value="group" url=create_group_url %}
{% endif %}
</div>
{% endblock %}