haikal/templates/users/user_list.html
2025-09-16 17:05:29 +03:00

101 lines
6.1 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% block title %}
{% trans "Staffs" %}
{% endblock title %}
{% block content %}
<div class="container py-5">
{% if users 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-tie me-3 fs-2"></i>
{% trans "Staffs" %}
</h1>
{% if request.user.userplan %}
<div class="d-flex">
<a href="{% url 'user_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 Staff" %}
</a>
<a href="{% url 'group_list' request.dealer.slug %}"
class="btn btn-phoenix-secondary shadow-sm">
<i class="fa-solid fa-users me-2"></i>{% trans "Manage Groups & Permissions" %}
</a>
</div>
{% endif %}
</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 'Email'|capfirst %}</th>
<th class="py-3 px-4">{% trans 'Phone number'|capfirst %}</th>
<th class="py-3 px-4">{% trans 'Role'|capfirst %}</th>
<th class="py-3 px-4 text-center">{% trans 'Actions'|capfirst %}</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr class="border-bottom">
<td class="align-middle py-3 px-4">
<div class="d-flex align-items-center">
<div class="avatar avatar-sm me-3">
{% if user.logo %}
<img class="avatar-img rounded-circle"
src="{{ user.thumbnail.url }}"
onerror="this.src='/static/user-logo.jpg'"
alt="{{ user.fullname }}'s logo">
{% else %}
<div class="rounded-circle bg-light d-flex justify-content-center align-items-center text-secondary"
style="width: 2.5rem;
height: 2.5rem;
font-size: 1rem">
{{ user.fullname|first|upper }}
</div>
{% endif %}
</div>
<a class="fw-bold text-decoration-none"
href="{% url 'user_detail' request.dealer.slug user.slug %}">
{{ user.fullname }}
</a>
</div>
</td>
<td class="align-middle py-3 px-4 text-muted">{{ user.email }}</td>
<td class="align-middle py-3 px-4 text-muted">{{ user.phone_number }}</td>
<td class="align-middle py-3 px-4">
{% for group in user.groups %}
<span class="badge bg-primary-subtle text-primary border border-primary-subtle rounded-pill me-1 fw-normal">{{ group.name|title }}</span>
{% endfor %}
</td>
<td class="align-middle py-3 px-4 text-center">
<a class="btn btn-sm btn-phoenix-secondary"
href="{% url 'user_detail' request.dealer.slug user.slug %}">
<i class="fa-solid fa-eye me-1"></i>{% trans 'View' %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% if is_paginated %}
<div class="d-flex justify-content-center mt-4">{% include 'partials/pagination.html' %}</div>
{% endif %}
{% else %}
{% if request.user.userplan %}
{% url "user_create" request.dealer.slug as create_staff_url %}
{% include "empty-illustration-page.html" with value=no_staff_message url=create_staff_url %}
{% else %}
{% url "pricing_page" request.dealer.slug as pricing_page_url %}
{% include "message-illustration.html" with value1=_("No active plan, Please create a subscription plan.") value2=_("Buy Plan") url=pricing_page_url %}
{% endif %}
{% endif %}
</div>
{% endblock %}