staff list page ui

This commit is contained in:
Faheed 2025-10-23 02:52:24 +03:00
parent 5227644e52
commit 6fefee7f43
2 changed files with 100 additions and 86 deletions

View File

@ -4,6 +4,7 @@
{% load humanize %} {% load humanize %}
{% block title %}{% trans "Admin Settings" %} - KAAUH ATS{% endblock %} {% block title %}{% trans "Admin Settings" %} - KAAUH ATS{% endblock %}
{% block customCSS %} {% block customCSS %}
<style> <style>
@ -12,17 +13,19 @@
--kaauh-teal: #00636e; --kaauh-teal: #00636e;
--kaauh-teal-dark: #004a53; --kaauh-teal-dark: #004a53;
--kaauh-light-bg: #f9fbfd; --kaauh-light-bg: #f9fbfd;
/* Standard Bootstrap color overrides (for pagination/badges) */ --kaauh-border: #e9ecef;
/* Standardized Colors */
--color-primary: var(--kaauh-teal); --color-primary: var(--kaauh-teal);
--color-primary-dark: var(--kaauh-teal-dark); --color-primary-dark: var(--kaauh-teal-dark);
--color-background-light: #f4f6f9; /* Retaining this lighter shade for page background */ --color-success: #28a745;
--color-secondary: #6c757d;
} }
/* Layout & Card Styling */ /* Layout & Card Styling */
.dashboard-header { .dashboard-header {
color: var(--color-primary-dark); color: var(--color-primary-dark);
border-bottom: 1px solid #e9ecef; border-bottom: 1px solid var(--kaauh-border);
padding-bottom: 1rem; padding-bottom: 1rem;
margin-bottom: 2rem; margin-bottom: 2rem;
} }
@ -31,16 +34,6 @@
.text-accent { .text-accent {
color: var(--color-primary) !important; color: var(--color-primary) !important;
} }
.feature-icon {
font-size: 2.5rem;
color: var(--color-primary);
margin-bottom: 1rem;
}
.feature-title {
color: var(--color-primary-dark);
font-weight: 600;
margin-bottom: 0.5rem;
}
/* Table Specific Styling */ /* Table Specific Styling */
.table-card { .table-card {
@ -49,70 +42,98 @@
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
padding: 1.5rem; padding: 1.5rem;
} }
/* Adjusted table stripe color to use theme variable */
/* Table Rows */
.table-striped > tbody > tr:nth-of-type(odd) > * { .table-striped > tbody > tr:nth-of-type(odd) > * {
background-color: rgba(0, 99, 110, 0.05); /* Light kaauh-teal stripe */ background-color: rgba(0, 99, 110, 0.03); /* Very light kaauh-teal stripe */
} }
.page-link { .table thead th {
color: var(--color-primary-dark); border-bottom: 2px solid var(--kaauh-border);
font-weight: 600;
color: var(--kaauh-primary-text, #343a40);
} }
.page-item.active .page-link {
background-color: var(--color-primary) !important; /* Status Badges */
border-color: var(--color-primary) !important; .badge-active {
color: #fff; background-color: rgba(0, 99, 110, 0.1); /* Light Teal background */
color: var(--kaauh-teal);
font-weight: 600;
padding: 0.4em 0.8em;
}
.badge-inactive {
background-color: rgba(108, 117, 125, 0.1); /* Light Gray background */
color: var(--color-secondary);
font-weight: 600;
padding: 0.4em 0.8em;
} }
/* Action button container for better alignment and spacing */ /* Action button container for better alignment and spacing */
.action-btns { .action-btns {
display: flex; display: flex;
justify-content: center; justify-content: center;
gap: 5px; /* Small space between icons */ gap: 0.5rem; /* Increased space between buttons */
} }
/* --- Main Action Button Style (Teal Theme) --- */ /* --- Main Action Button (Create User) --- */
.btn-main-action { .btn-main-action {
/* Use standard Bootstrap button styles as a base */
background-color: var(--kaauh-teal); background-color: var(--kaauh-teal);
border: 1px solid var(--kaauh-teal); border: 1px solid var(--kaauh-teal);
color: white; color: white;
font-weight: 600; font-weight: 600;
transition: all 0.2s ease;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 0.5rem; /* Standard Bootstrap gap for icon/text */ gap: 0.5rem;
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
border-radius: 0.375rem; /* Standard Bootstrap border radius */
text-decoration: none;
} }
/* Functional Hover State */
.btn-main-action:hover { .btn-main-action:hover {
background-color: var(--kaauh-teal-dark); background-color: var(--kaauh-teal-dark);
border-color: var(--kaauh-teal-dark); border-color: var(--kaauh-teal-dark);
color: white; color: white; /* Ensure text remains white on hover */
text-decoration: none;
} }
/* Active/Focus State (optional but good for accessibility) */ /* --- Secondary Action Buttons (Table Row) --- */
.btn-main-action:focus, .btn-table-action {
.btn-main-action:active { background: none;
box-shadow: 0 0 0 0.25rem rgba(0, 99, 110, 0.5); /* Teal focus ring */ border: none;
background-color: var(--kaauh-teal-dark); padding: 0.5rem; /* Make the click area larger */
border-color: var(--kaauh-teal-dark); color: var(--kaauh-teal); /* Default icon color */
color: white; transition: color 0.2s ease;
}
.btn-table-action:hover {
color: var(--kaauh-teal-dark);
box-shadow: none;
} }
button i.fa-solid { /* Toggle Status Button Styling */
/* Re-enable display if it was hidden */ .btn-toggle-status {
display: inline-block; font-size: 0.85rem;
/* Ensure the correct font family is applied */ font-weight: 500;
font-family: "Font Awesome 6 Free"; padding: 0.375rem 0.75rem;
/* Inherit button color */ border-radius: 0.375rem;
color: inherit; transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 0.3rem;
} }
.text-primary{
color:var(--kaauh-teal) !important;
/* Deactivate (Red/Danger) */
.btn-deactivate {
background-color: #f8d7da; /* Light Red */
color: #721c24; /* Dark Red Text */
border: 1px solid #f5c6cb;
}
.btn-deactivate:hover {
background-color: #f5c6cb;
}
/* Activate (Teal/Primary) */
.btn-activate {
background-color: rgba(0, 99, 110, 0.15); /* Light Teal */
color: var(--kaauh-teal-dark);
border: 1px solid rgba(0, 99, 110, 0.2);
}
.btn-activate:hover {
background-color: rgba(0, 99, 110, 0.25);
} }
</style> </style>
@ -121,11 +142,11 @@
{% block content %} {% block content %}
<div class="container-fluid mt-5"> <div class="container-fluid py-4">
<div class="row px-lg-4"> <div class="row px-lg-4">
<div class="col-12"> <div class="col-12">
<h1 class="h3 fw-bold dashboard-header"> <h1 class="h3 fw-bold dashboard-header">
<i class="fas fa-cogs me-2 text-accent"></i>{% trans "Admin Settings Dashboard" %} <i class="fas fa-cogs me-3 text-accent"></i>{% trans "Admin Settings Dashboard" %}
</h1> </h1>
</div> </div>
</div> </div>
@ -133,7 +154,7 @@
{# --- Paged User Table Section --- #} {# --- Paged User Table Section --- #}
<div class="row px-lg-4" id="user-list"> <div class="row px-lg-4" id="user-list">
<div class="d-flex align-items-center justify-content-between mb-3"> <div class="d-flex align-items-center justify-content-between mb-4">
<h4 class="text-secondary fw-bold mb-0">{% trans "Staff User List" %}</h4> <h4 class="text-secondary fw-bold mb-0">{% trans "Staff User List" %}</h4>
@ -155,7 +176,7 @@
<th scope="col" class="text-center">{% trans "Status" %}</th> <th scope="col" class="text-center">{% trans "Status" %}</th>
<th scope="col" class="text-center">{% trans "First Join" %}</th> <th scope="col" class="text-center">{% trans "First Join" %}</th>
<th scope="col" class="text-center">{% trans "Last Login" %}</th> <th scope="col" class="text-center">{% trans "Last Login" %}</th>
<th scope="col" class="text-center">{% trans "Actions" %}</th> <th scope="col" class="text-center" style="min-width: 250px;">{% trans "Actions" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -164,11 +185,13 @@
<td>{{ user.pk }}</td> <td>{{ user.pk }}</td>
<td>{{ user.get_full_name|default:user.first_name }}</td> <td>{{ user.get_full_name|default:user.first_name }}</td>
<td>{{ user.email }}</td> <td>{{ user.email }}</td>
{# Column: Status Badge (Improved Styling) #}
<td class="text-center"> <td class="text-center">
{% if user.is_active %} {% if user.is_active %}
<span class="badge rounded-pill bg-success-subtle text-success border border-success-subtle">{% trans "Active" %}</span> <span class="badge rounded-pill badge-active">{% trans "Active" %}</span>
{% else %} {% else %}
<span class="badge rounded-pill bg-secondary-subtle text-secondary border border-secondary-subtle">{% trans "Inactive" %}</span> <span class="badge rounded-pill badge-inactive">{% trans "Inactive" %}</span>
{% endif %} {% endif %}
</td> </td>
@ -182,62 +205,53 @@
{% if user.last_login %} {% if user.last_login %}
<span title="{{ user.last_login|date:'DATETIME_FORMAT' }}">{{ user.last_login|naturaltime }}</span> <span title="{{ user.last_login|date:'DATETIME_FORMAT' }}">{{ user.last_login|naturaltime }}</span>
{% else %} {% else %}
{% trans "Never" %}
{% endif %} {% endif %}
</td> </td>
{# Column: Actions #}
<td class="text-center"> <td class="text-center">
<div class="action-btns"> <div class="action-btns">
{% comment %} {# 1. Edit/Detail Button (Pencil Icon) - Added common action #}
<a href="{% url 'edit_staff_user' user.pk %}" class="btn btn-sm btn-outline-secondary" title="{% trans 'Edit User' %}">
<i class="fas fa-pencil"></i>
</a> {% endcomment %}
{# 2. Change Password Button (Key Icon) #} {# 2. Change Password Button (Key Icon) #}
<a href="{% url 'set_staff_password' user.pk %}" class="btn btn-sm btn-outline-info" title="{% trans 'Change Password' %}"> <a href="{% url 'set_staff_password' user.pk %}" class="btn btn-sm btn-outline-info" title="{% trans 'Change Password' %}">
<i class="fas fa-key"></i> <i class="fas fa-key"></i>
{% trans 'Change Password' %}
</a> </a>
{# 3. Delete Button (Trash Icon) #} {# 3. Toggle Status Button (Improved Button Styling) #}
{% if user.is_active %} {% if user.is_active %}
<form method="post" action="{% url 'account_toggle_status' user.pk %}" class="d-inline">
<form method="post" action="{% url 'account_toggle_status' user.pk %}">
{% csrf_token %} {% csrf_token %}
<button type="submit" class="btn-toggle-status btn-deactivate" title="{% trans 'Deactivate User' %}">
{# The button for DEACTIVATION #} <i class="fas fa-times-circle"></i> {% trans "Deactivate" %}
<button type="submit" >
<i class="fas fa-times-circle text-danger"></i> Deactivate
</button> </button>
</form> </form>
{% else %} {% else %}
<form method="post" action="{% url 'account_toggle_status' user.pk %}" class="d-inline">
<form method="post" action="{% url 'account_toggle_status' user.pk %}">
{% csrf_token %} {% csrf_token %}
<button type="submit" class="btn-toggle-status btn-activate" title="{% trans 'Activate User' %}">
{# The button for REACTIVATION #} <i class="fas fa-check-circle"></i> {% trans "Activate" %}
<button type="submit bg-primary" >
<i class="fas fa-check-circle text-primary"></i> Activate
</button> </button>
</form> </form>
{% endif %} {% endif %}
</div> </div>
</td> </td>
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td colspan="8" class="text-center text-muted py-4">{% trans "No staff users found." %}</td> <td colspan="7" class="text-center text-muted py-4">{% trans "No staff users found." %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
{# NOTE: Add Pagination links here if the `staffs` object is a Paginator object #}
</div> </div>
</div> </div>