ATS/templates/people/person_list.html
2026-01-29 14:19:03 +03:00

280 lines
18 KiB
HTML

{% extends "base.html" %}
{% load static i18n %}
{% block title %}{% trans "Applicants" %} - {{ block.super }}{% endblock %}
{% block content %}
<div class="space-y-6">
<!-- Desktop Header -->
<div class="hidden lg:block">
<!-- Breadcrumb -->
<nav class="mb-6" aria-label="breadcrumb">
<ol class="flex items-center gap-2 text-sm flex-wrap">
<li><a href="{% url 'dashboard' %}" class="text-gray-500 hover:text-temple-red transition flex items-center gap-1">
<i data-lucide="home" class="w-4 h-4"></i> {% trans "Home" %}
</a></li>
<li class="text-gray-400">/</li>
<li class="text-temple-red font-semibold">{% trans "Applicants" %}</li>
</ol>
</nav>
<div class="flex justify-between items-start mb-6">
<h1 class="text-3xl font-bold text-gray-900 flex items-center gap-3">
<div class="bg-temple-red/10 p-3 rounded-xl">
<i data-lucide="users" class="w-8 h-8 text-temple-red"></i>
</div>
{% trans "Applicants List" %}
</h1>
<a href="{% url 'person_create' %}" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-semibold px-6 py-2.5 rounded-xl transition shadow-sm hover:shadow-md">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "Add New Applicant" %}
</a>
</div>
<!-- Desktop Filters -->
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden mb-6">
<div class="bg-gradient-to-br from-temple-red to-[#7a1a29] text-white p-4">
<h5 class="text-lg font-bold flex items-center gap-2">
<i data-lucide="filter" class="w-5 h-5"></i>
{% trans "Filter Applicants" %}
</h5>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="search" class="block text-xs font-semibold text-gray-600 mb-2">{% trans "Search by Name or Email" %}</label>
{% include 'includes/search_form.html' %}
</div>
<div>
<form method="GET" class="flex flex-col sm:flex-row gap-3 items-end">
<div class="flex-1">
<label for="nationality_filter" class="block text-xs font-semibold text-gray-600 mb-2">{% trans "Filter by Nationality" %}</label>
<select name="nationality" id="nationality_filter" class="w-full px-4 py-2.5 border border-gray-200 rounded-xl text-sm focus:ring-2 focus:ring-temple-red/20 focus:border-temple-red outline-none transition">
<option value="">{% trans "All Nationalities" %}</option>
{% for nationality in nationalities %}
<option value="{{ nationality }}" {% if request.GET.nationality == nationality %}selected{% endif %}>{{ nationality }}</option>
{% endfor %}
</select>
</div>
<div class="flex gap-2">
<button type="submit" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-medium px-5 py-2.5 rounded-xl text-sm transition">
<i data-lucide="filter" class="w-4 h-4"></i> {% trans "Apply Filters" %}
</button>
{% if search_query or request.GET.nationality or request.GET.gender %}
<a href="{% url 'person_list' %}" class="inline-flex items-center gap-2 border border-gray-300 text-gray-600 hover:bg-gray-100 px-4 py-2.5 rounded-xl text-sm transition">
<i data-lucide="x" class="w-4 h-4"></i> {% trans "Clear" %}
</a>
{% endif %}
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Mobile Header -->
<div class="lg:hidden mb-4">
<div class="flex items-center justify-between mb-4">
<h1 class="text-2xl font-bold text-gray-900 flex items-center gap-2">
<div class="bg-temple-red/10 p-2 rounded-lg">
<i data-lucide="users" class="w-6 h-6 text-temple-red"></i>
</div>
{% trans "Applicants" %}
</h1>
<a href="{% url 'person_create' %}" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-semibold px-4 py-2.5 rounded-xl text-sm transition shadow-sm">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "Add" %}
</a>
</div>
<!-- Mobile Filters -->
<div class="space-y-3">
<div>
<label for="search" class="block text-xs font-semibold text-gray-600 mb-2">{% trans "Search Applicants" %}</label>
{% include 'includes/search_form.html' %}
</div>
<div>
<form method="GET">
<div class="flex gap-2">
<select name="nationality" id="nationality_filter" class="flex-1 px-3 py-2.5 border border-gray-200 rounded-xl text-sm focus:ring-2 focus:ring-temple-red/20 focus:border-temple-red outline-none transition">
<option value="">{% trans "All Nationalities" %}</option>
{% for nationality in nationalities %}
<option value="{{ nationality }}" {% if request.GET.nationality == nationality %}selected{% endif %}>{{ nationality }}</option>
{% endfor %}
</select>
</div>
</form>
</div>
</div>
</div>
{% if people_list %}
{# --- MOBILE CARD VIEW --- #}
<div class="lg:hidden grid grid-cols-1 gap-4">
{% for person in people_list %}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="bg-gradient-to-br from-temple-red to-[#7a1a29] text-white p-4">
<div class="flex items-center gap-4">
{% if person.profile_image %}
<img src="{{ person.profile_image.url }}" alt="{{ person.get_full_name }}"
class="w-14 h-14 rounded-full border-3 border-white/30 object-cover">
{% else %}
<div class="w-14 h-14 rounded-full bg-white/30 flex items-center justify-center">
<i data-lucide="user" class="w-7 h-7 text-white"></i>
</div>
{% endif %}
<div class="flex-1">
<h5 class="font-bold text-lg">{{ person.full_name }}</h5>
<p class="text-sm text-white/80">{{ person.email|default:"" }}</p>
</div>
</div>
</div>
<div class="p-4 space-y-3">
{% if person.phone %}
<div class="flex items-center gap-2 text-sm text-gray-600">
<i data-lucide="phone" class="w-4 h-4 text-temple-red"></i>
<span>{{ person.phone }}</span>
</div>
{% endif %}
{% if person.nationality %}
<div class="flex items-center gap-2 text-sm text-gray-600">
<i data-lucide="globe" class="w-4 h-4 text-temple-red"></i>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase bg-temple-red text-white">
{{ person.nationality }}
</span>
</div>
{% endif %}
{% if person.gender %}
<div class="flex items-center gap-2 text-sm text-gray-600">
<i data-lucide="user-2" class="w-4 h-4 text-temple-red"></i>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase bg-temple-red text-white">
{% if person.gender == 'M' %}{% trans "Male" %}{% else %}{% trans "Female" %}{% endif %}
</span>
</div>
{% endif %}
{% if person.agency %}
<div class="flex items-center gap-2 text-sm text-gray-600">
<i data-lucide="building" class="w-4 h-4 text-temple-red"></i>
<span>{{ person.agency.name }}</span>
</div>
{% endif %}
<!-- Actions -->
<div class="flex gap-2 pt-3 border-t border-gray-100">
<a href="{% url 'person_detail' person.slug %}" class="flex-1 inline-flex items-center justify-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-medium px-4 py-2.5 rounded-xl text-sm transition">
<i data-lucide="eye" class="w-4 h-4"></i> {% trans "View" %}
</a>
{% if user.is_staff %}
<a href="{% url 'person_update' person.slug %}" class="inline-flex items-center justify-center gap-2 border border-gray-300 text-gray-600 hover:bg-gray-50 px-4 py-2.5 rounded-xl text-sm transition">
<i data-lucide="edit-2" class="w-4 h-4"></i> {% trans "Edit" %}
</a>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
{# --- DESKTOP TABLE VIEW --- #}
<div class="hidden lg:block bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="bg-gradient-to-br from-temple-red to-[#7a1a29] text-white p-4">
<h5 class="text-lg font-bold flex items-center gap-2">
<i data-lucide="list" class="w-5 h-5"></i>
{% trans "Applicant Listings" %}
</h5>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Photo" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Name" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Email" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Phone" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Nationality" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Gender" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Agency" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Created" %}</th>
<th scope="col" class="px-6 py-3 text-center text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-100">
{% for person in people_list %}
<tr class="hover:bg-gray-50 transition-colors">
<td class="px-6 py-4">
{% if person.profile_image %}
<img src="{{ person.profile_image.url }}" alt="{{ person.get_full_name }}"
class="w-10 h-10 rounded-full border-2 border-temple-red/20 object-cover">
{% else %}
<div class="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center">
<i data-lucide="user" class="w-5 h-5 text-gray-400"></i>
</div>
{% endif %}
</td>
<td class="px-6 py-4">
<a href="{% url 'person_detail' person.slug %}" class="text-temple-red font-semibold hover:text-[#7a1a29] transition-colors">{{ person.full_name }}</a>
</td>
<td class="px-6 py-4 text-sm text-gray-700">{{ person.email|default:"-" }}</td>
<td class="px-6 py-4 text-sm text-gray-700">{{ person.phone|default:"-" }}</td>
<td class="px-6 py-4">
{% if person.nationality %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase bg-temple-red text-white">
{{ person.nationality }}
</span>
{% else %}
-
{% endif %}
</td>
<td class="px-6 py-4">
{% if person.gender %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase bg-temple-red text-white">
{% if person.gender == 'M' %}{% trans "Male" %}{% else %}{% trans "Female" %}{% endif %}
</span>
{% else %}
-
{% endif %}
</td>
<td class="px-6 py-4 text-sm text-gray-700">{{ person.agency.name|default:"-" }}</td>
<td class="px-6 py-4 text-sm text-gray-700">{{ person.created_at|date:"d-m-Y" }}</td>
<td class="px-6 py-4 text-center">
<div class="flex items-center justify-center gap-2">
<a href="{% url 'person_detail' person.slug %}" class="inline-flex items-center justify-center w-9 h-9 rounded-lg bg-temple-red hover:bg-[#7a1a29] text-white transition" title="{% trans 'View' %}">
<i data-lucide="eye" class="w-4 h-4"></i>
</a>
{% if user.is_staff %}
<a href="{% url 'person_update' person.slug %}" class="inline-flex items-center justify-center w-9 h-9 rounded-lg border border-gray-300 hover:bg-gray-100 text-gray-600 transition" title="{% trans 'Edit' %}">
<i data-lucide="edit-2" class="w-4 h-4"></i>
</a>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% include "includes/paginator.html" %}
{% else %}
<!-- No Results -->
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-12 text-center">
<i data-lucide="users" class="w-16 h-16 text-temple-red mx-auto mb-4"></i>
<h3 class="text-xl font-semibold text-gray-900 mb-2">{% trans "No Applicants Found" %}</h3>
<p class="text-gray-500 mb-6">{% trans "Create your first applicant record." %}</p>
{% if user.is_staff %}
<a href="{% url 'person_create' %}" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-semibold px-6 py-3 rounded-xl transition shadow-sm hover:shadow-md">
<i data-lucide="plus" class="w-5 h-5"></i> {% trans "Add First Applicant" %}
</a>
{% endif %}
</div>
{% endif %}
</div>
<script>
lucide.createIcons();
</script>
{% endblock %}