ATS/templates/jobs/job_applicants.html
2026-02-01 13:38:06 +03:00

252 lines
16 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% block title %}{{ job.title }} - {% trans "Applicants" %}{% endblock %}
{% block customCSS %}
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');
body { font-family: 'Inter', sans-serif; }
</style>
{% endblock %}
{% block content %}
<div class="container mx-auto px-3 sm:px-4 lg:px-8 py-6">
<!-- 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 "Dashboard" %}
</a></li>
<li class="text-gray-400">/</li>
<li><a href="{% url 'job_list' %}" class="text-gray-500 hover:text-temple-red transition">{% trans "Jobs" %}</a></li>
<li class="text-gray-400">/</li>
<li><a href="{% url 'job_detail' job.slug %}" class="text-gray-500 hover:text-temple-red transition">{{ job.title }}</a></li>
<li class="text-gray-400">/</li>
<li class="text-temple-red font-semibold">{% trans "Applications" %}</li>
</ol>
</nav>
<!-- Job Header -->
<div class="bg-gradient-to-br from-temple-red to-[#7a1a29] text-white rounded-2xl p-6 mb-6">
<div class="flex flex-col md:flex-row md:items-start md:justify-between gap-4">
<div class="flex-1">
<h1 class="text-2xl font-bold mb-2">{{ job.title }}</h1>
<p class="text-sm text-white/80 mb-3">
{{ job.department|default:"General" }} • {{ job.get_job_type_display }} • {{ job.get_workplace_type_display }}
</p>
<div class="flex flex-wrap gap-4 text-sm">
<div class="flex items-center gap-2">
<i data-lucide="users" class="w-4 h-4"></i>
<span>{{ total_applications }} {% trans "Total Applicantions" %}</span>
</div>
{% if job.max_applications %}
<div class="flex items-center gap-2">
<i data-lucide="briefcase" class="w-4 h-4"></i>
<span>{{ job.max_applications }} {% trans "Positions Available" %}</span>
</div>
{% endif %}
<div class="flex items-center gap-2">
<i data-lucide="calendar" class="w-4 h-4"></i>
<span>{% trans "Posted" %} {{ job.created_at|date:"M d, Y" }}</span>
</div>
</div>
</div>
<a href="{% url 'job_detail' job.slug %}" class="inline-flex items-center gap-2 bg-white/20 hover:bg-white/30 text-white font-medium px-4 py-2 rounded-xl text-sm transition">
<i data-lucide="arrow-left" class="w-4 h-4"></i>
{% trans "Back to Job" %}
</a>
</div>
</div>
<!-- Stats Section -->
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4 mb-6">
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-4 text-center border-l-4 border-temple-red">
<div class="text-3xl font-bold text-temple-red mb-1">{{ total_applications }}</div>
<div class="text-xs text-gray-600">{% trans "Total Applications" %}</div>
</div>
{% for stage_key, stage_data in stage_stats.items %}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-4 text-center">
<div class="text-3xl font-bold text-gray-800 mb-1">{{ stage_data.count }}</div>
<div class="text-xs text-gray-600">{{ stage_data.label }}</div>
</div>
{% endfor %}
{% if ai_score_stats.average %}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-4 text-center">
<div class="text-3xl font-bold text-gray-800 mb-1">{{ ai_score_stats.average|floatformat:1 }}</div>
<div class="text-xs text-gray-600">{% trans "Avg AI Score" %}</div>
</div>
{% endif %}
</div>
<!-- Filters Section -->
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-6 mb-6">
<form method="GET">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 mb-4">
<div>
<label for="search" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Search Applicants" %}</label>
<input type="text" id="search" name="q" value="{{ search_query }}"
placeholder="{% trans 'Search by name, email, or phone...' %}"
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">
</div>
<div>
<label for="stage" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Application Stage" %}</label>
<select id="stage" name="stage" 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 Stages" %}</option>
{% for key, value in stage_choices %}
<option value="{{ key }}" {% if stage_filter == key %}selected{% endif %}>
{{ value }}
</option>
{% endfor %}
</select>
</div>
<div>
<label for="min_ai_score" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Min AI Score" %}</label>
<input type="number" id="min_ai_score" name="min_ai_score" value="{{ min_ai_score }}"
placeholder="0" min="0" max="100"
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">
</div>
<div>
<label for="max_ai_score" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Max AI Score" %}</label>
<input type="number" id="max_ai_score" name="max_ai_score" value="{{ max_ai_score }}"
placeholder="100" min="0" max="100"
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">
</div>
<div>
<label for="date_from" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "From Date" %}</label>
<input type="date" id="date_from" name="date_from" value="{{ date_from }}"
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">
</div>
<div>
<label for="date_to" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "To Date" %}</label>
<input type="date" id="date_to" name="date_to" value="{{ date_to }}"
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">
</div>
<div>
<label for="sort" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Sort By" %}</label>
<select id="sort" name="sort" 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="-created_at" {% if sort_by == '-created_at' %}selected{% endif %}>{% trans "Newest First" %}</option>
<option value="created_at" {% if sort_by == 'created_at' %}selected{% endif %}>{% trans "Oldest First" %}</option>
<option value="person__first_name" {% if sort_by == 'person__first_name' %}selected{% endif %}>{% trans "Name (A-Z)" %}</option>
<option value="-person__first_name" {% if sort_by == '-person__first_name' %}selected{% endif %}>{% trans "Name (Z-A)" %}</option>
<option value="stage" {% if sort_by == 'stage' %}selected{% endif %}>{% trans "Stage" %}</option>
</select>
</div>
</div>
<div class="flex gap-3">
<button type="submit" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-medium px-4 py-2.5 rounded-xl text-sm transition shadow-sm hover:shadow-md">
<i data-lucide="filter" class="w-4 h-4"></i>
{% trans "Apply Filters" %}
</button>
<a href="{% url 'job_applicants' job.slug %}" class="inline-flex items-center gap-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-medium px-4 py-2.5 rounded-xl text-sm transition">
<i data-lucide="rotate-ccw" class="w-4 h-4"></i>
{% trans "Clear All" %}
</a>
</div>
</form>
</div>
<!-- Applicants Grid -->
{% if page_obj.object_list %}
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6 mb-6">
{% for application in page_obj.object_list %}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-5 hover:shadow-md transition-shadow">
<div class="flex justify-between items-start mb-4">
<div class="flex-1">
<h3 class="text-lg font-bold text-gray-900 mb-1">
{{ application.person.first_name }} {{ application.person.last_name }}
</h3>
<p class="text-sm text-gray-500">{{ application.person.email }}</p>
{% if application.person.phone %}
<p class="text-sm text-gray-500">{{ application.person.phone }}</p>
{% endif %}
</div>
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold uppercase tracking-wide
{% if application.stage == 'APPLIED' %}bg-gray-500 text-white
{% elif application.stage == 'SCREENING' %}bg-cyan-500 text-white
{% elif application.stage == 'EXAM' %}bg-amber-500 text-white
{% elif application.stage == 'INTERVIEW' %}bg-blue-500 text-white
{% elif application.stage == 'DOCUMENT_REVIEW' %}bg-purple-500 text-white
{% elif application.stage == 'OFFER' %}bg-green-500 text-white
{% elif application.stage == 'HIRED' %}bg-teal-500 text-white
{% elif application.stage == 'REJECTED' %}bg-red-500 text-white
{% else %}bg-gray-500 text-white{% endif %}">
{{ application.get_stage_display }}
</span>
</div>
<div class="flex flex-wrap gap-3 mb-4 text-sm text-gray-600">
<div class="flex items-center gap-1.5">
<i data-lucide="clock" class="w-4 h-4"></i>
<span>{% trans "Applied" %} {{ application.created_at|date:"M d, Y" }}</span>
</div>
{% if application.ai_analysis_data.analysis_data_en.match_score %}
<div class="flex items-center gap-1.5">
<i data-lucide="bot" class="w-4 h-4"></i>
<span class="px-2 py-0.5 rounded-md text-xs font-bold
{% if application.ai_analysis_data.analysis_data_en.match_score >= 75 %}bg-green-100 text-green-700
{% elif application.ai_analysis_data.analysis_data_en.match_score >= 50 %}bg-amber-100 text-amber-700
{% else %}bg-red-100 text-red-700{% endif %}">
{{ application.ai_analysis_data.analysis_data_en.match_score }}%
</span>
</div>
{% endif %}
{% if application.person.gpa %}
<div class="flex items-center gap-1.5">
<i data-lucide="graduation-cap" class="w-4 h-4"></i>
<span>{% trans "GPA" %}: {{ application.person.gpa|floatformat:2 }}</span>
</div>
{% endif %}
</div>
<div class="flex flex-wrap gap-2">
<a href="{% url 'application_detail' application.slug %}" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-medium px-3 py-2 rounded-lg text-xs transition">
<i data-lucide="file-text" class="w-3 h-3"></i>
{% trans "Application" %}
</a>
{% if application.stage == 'Interview' %}
<a href="{% url 'interview_list' %}" class="inline-flex items-center gap-2 bg-green-500 hover:bg-green-600 text-white font-medium px-3 py-2 rounded-lg text-xs transition">
<i data-lucide="calendar-check" class="w-3 h-3"></i>
{% trans "Schedule" %}
</a>
{% endif %}
<a href="{% url 'message_create' %}?job={{ job.pk }}&candidate={{ application.pk }}" class="inline-flex items-center gap-2 bg-gray-500 hover:bg-gray-600 text-white font-medium px-3 py-2 rounded-lg text-xs transition">
<i data-lucide="mail" class="w-3 h-3"></i>
{% trans "Email" %}
</a>
</div>
</div>
{% endfor %}
</div>
<!-- Pagination -->
{% if page_obj.has_other_pages %}
{% include "includes/paginator.html" %}
{% endif %}
{% else %}
<!-- No Results -->
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-12 text-center">
<div class="text-6xl mb-4">😔</div>
<h3 class="text-xl font-bold text-gray-900 mb-2">{% trans "No Applicants Found" %}</h3>
<p class="text-gray-500 mb-6">
{% if search_query or stage_filter or min_ai_score or max_ai_score or date_from or date_to %}
{% trans "We couldn't find any applicants matching your current filters. Try adjusting your search criteria or clearing some filters." %}
{% else %}
{% trans "There are currently no applicants for this job." %}
{% endif %}
</p>
<a href="{% url 'job_applicants' job.slug %}" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-medium px-6 py-3 rounded-xl text-sm transition shadow-sm hover:shadow-md">
<i data-lucide="refresh-cw" class="w-5 h-5"></i>
{% trans "Clear Filters" %}
</a>
</div>
{% endif %}
</div>
{% endblock %}
{% block customJS %}
<script>
lucide.createIcons();
</script>
{% endblock %}