ATS/templates/jobs/job_list.html
2026-01-29 14:19:03 +03:00

294 lines
20 KiB
HTML

{% extends "base.html" %}
{% load static i18n %}
{% block title %}{% trans "Job Postings" %} - University ATS{% endblock %}
{% block content %}
<div class="space-y-6">
<!-- 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="briefcase" class="w-6 h-6 text-temple-red"></i>
</div>
{% trans "Job Postings" %}
</h1>
<a href="{% url 'job_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 Job" %}
</a>
</div>
<!-- Moibile Filters -->
<div class="space-y-3">
<div>
<label for="search" class="block text-xs font-semibold text-gray-600 mb-2">{% trans "Search Jobs" %}</label>
{% include 'includes/search_form.html' %}
</div>
<div>
<form method="GET">
<div class="flex gap-2">
<div class="flex-1">
<select name="status" id="status" class="w-full px-3 py-2.5 bg-white 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 Statuses" %}</option>
<option value="DRAFT" {% if status_filter == 'DRAFT' %}selected{% endif %}>{% trans "Draft" %}</option>
<option value="ACTIVE" {% if status_filter == 'ACTIVE' %}selected{% endif %}>{% trans "Active" %}</option>
<option value="CLOSED" {% if status_filter == 'CLOSED' %}selected{% endif %}>{% trans "Closed" %}</option>
<option value="CANCELLED" {% if status_filter == 'CANCELLED' %}selected{% endif %}>{% trans "Cancelled" %}</option>
<option value="ARCHIVED" {% if status_filter == 'ARCHIVED' %}selected{% endif %}>{% trans "Archived" %}</option>
</select>
</div>
<button type="submit" class="bg-temple-red hover:bg-[#7a1a29] text-white px-4 py-2.5 rounded-xl transition">
<i data-lucide="search" class="w-4 h-4"></i>
</button>
{% if status_filter or search_query %}
<a href="{% url 'job_list' %}" class="bg-gray-100 hover:bg-gray-200 text-gray-600 px-4 py-2.5 rounded-xl transition">
<i data-lucide="x" class="w-4 h-4"></i>
</a>
{% endif %}
</div>
</form>
</div>
</div>
</div>
<!-- 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 "Job Postings" %}</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="briefcase" class="w-8 h-8 text-temple-red"></i>
</div>
{% trans "Job Postings" %}
</h1>
<a href="{% url 'job_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 "Create New Job" %}
</a>
</div>
<!-- Desktop Filters -->
<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">
<h5 class="text-lg font-bold flex items-center gap-2">
<i data-lucide="filter" class="w-5 h-5"></i>
{% trans "Filter Jobs" %}
</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 Title or Department" %}</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="status" class="block text-xs font-semibold text-gray-600 mb-2">{% trans "Filter by Status" %}</label>
<select name="status" id="status" class="w-full px-4 py-2.5 bg-white 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 Statuses" %}</option>
<option value="DRAFT" {% if status_filter == 'DRAFT' %}selected{% endif %}>{% trans "Draft" %}</option>
<option value="ACTIVE" {% if status_filter == 'ACTIVE' %}selected{% endif %}>{% trans "Active" %}</option>
<option value="CLOSED" {% if status_filter == 'CLOSED' %}selected{% endif %}>{% trans "Closed" %}</option>
<option value="CANCELLED" {% if status_filter == 'CANCELLED' %}selected{% endif %}>{% trans "Cancelled" %}</option>
<option value="ARCHIVED" {% if status_filter == 'ARCHIVED' %}selected{% endif %}>{% trans "Archived" %}</option>
</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 status_filter or search_query %}
<a href="{% url 'job_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 CARD VIEW --- #}
<div class="lg:hidden grid grid-cols-1 gap-4">
{% for job in jobs %}
<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 justify-between items-start">
<h5 class="font-bold text-lg">
<a href="{% url 'job_detail' job.slug %}" class="hover:text-white/80 transition-colors">{{ job.title }}</a>
</h5>
<span class="inline-block text-[10px] font-bold uppercase tracking-wide px-2.5 py-1 rounded-full bg-white/20 backdrop-blur-sm border border-white/30">
{{ job.status }}
</span>
</div>
<p class="text-xs text-white/80 mt-1">ID: {{ job.pk }}</p>
</div>
<div class="p-4 space-y-3">
<div class="flex items-center gap-2 text-sm text-gray-600">
<i data-lucide="building-2" class="w-4 h-4 text-temple-red"></i>
<span>{{ job.get_source }}</span>
</div>
<div class="flex items-center gap-2 text-sm text-gray-600">
<i data-lucide="calendar" class="w-4 h-4 text-temple-red"></i>
<span>{% trans "Deadline" %}: {{ job.application_deadline|date:"d-m-Y" }}</span>
</div>
<!-- Applicant Stats -->
<div class="grid grid-cols-3 gap-2 pt-3 border-t border-gray-100">
<div class="text-center">
<div class="text-2xl font-bold text-temple-red">{{ job.all_applications.count|default:"0" }}</div>
<div class="text-[10px] uppercase text-gray-500 font-semibold">{% trans "Total" %}</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold text-emerald-600">{{ job.offer_applications.count|default:"0" }}</div>
<div class="text-[10px] uppercase text-gray-500 font-semibold">{% trans "Offers" %}</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold text-blue-600">{{ job.hired_applications.count|default:"0" }}</div>
<div class="text-[10px] uppercase text-gray-500 font-semibold">{% trans "Hired" %}</div>
</div>
</div>
<!-- Actions -->
<div class="flex gap-2 pt-3 border-t border-gray-100">
<a href="{% url 'job_detail' job.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 Details" %}
</a>
{% if job.form_template %}
<a href="{% url 'form_template_submissions_list' job.form_template.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="file-text" class="w-4 h-4"></i>
</a>
{% endif %}
</div>
</div>
</div>
{% empty %}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden text-center p-8">
<i data-lucide="briefcase" 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 job postings found" %}</h3>
<p class="text-gray-500 mb-4">{% trans "Create your first job posting to get started." %}</p>
<a href="{% url 'job_create' %}" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-semibold px-5 py-2.5 rounded-xl transition shadow-sm">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "Create Job" %}
</a>
</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 "Job 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 "Job Title / ID" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Source" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Status" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Max Apps" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Deadline" %}</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-bold text-gray-700 tracking-wider whitespace-nowrap">{% trans "Assigned To" %}</th>
<th scope="col" class="px-6 py-3 text-center text-xs font-bold text-temple-red tracking-wider whitespace-nowrap">{% trans "Applicants" %}</th>
<th scope="col" class="px-6 py-3 text-center text-xs font-bold text-emerald-600 tracking-wider whitespace-nowrap">{% trans "Offers" %}</th>
<th scope="col" class="px-6 py-3 text-center text-xs font-bold text-blue-600 tracking-wider whitespace-nowrap">{% trans "Hired" %}</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 job in jobs %}
<tr class="hover:bg-gray-50 transition-colors">
<td class="px-6 py-4">
<a href="{% url 'job_detail' job.slug %}" class="text-temple-red font-semibold hover:text-[#7a1a29] transition-colors">{{ job.title }}</a>
<br>
<span class="text-xs text-gray-500">ID: {{ job.pk }}</span>
</td>
<td class="px-6 py-4 text-sm text-gray-700">{{ job.get_source }}</td>
<td class="px-6 py-4">
<span class="inline-block text-[10px] font-bold uppercase tracking-wide px-2.5 py-1 rounded-full {% if job.status == 'DRAFT' %}bg-gray-100 text-gray-700{% elif job.status == 'ACTIVE' %}bg-temple-red/10 text-temple-red border border-temple-red{% elif job.status == 'CLOSED' %}bg-red-100 text-red-700 border border-red-200{% elif job.status == 'ARCHIVED' %}bg-gray-700 text-white{% elif job.status == 'CANCELLED' %}bg-red-50 text-red-600 border border-red-200{% endif %}">
{{ job.status }}
</span>
</td>
<td class="px-6 py-4 text-sm text-gray-700">{{ job.max_applications }}</td>
<td class="px-6 py-4 text-sm text-gray-700">{{ job.application_deadline|date:"d-m-Y" }}</td>
<td class="px-6 py-4">
{% if job.assigned_to %}
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-temple-red flex items-center justify-center text-white text-xs font-bold">
{{ job.assigned_to.first_name|first|upper }}
</div>
<span class="text-sm text-gray-700">{{ job.assigned_to.first_name }} {{ job.assigned_to.last_name }}</span>
</div>
{% else %}
<span class="text-sm text-gray-400 italic">{% trans "Unassigned" %}</span>
{% endif %}
</td>
<td class="px-6 py-4 text-center">
<a href="{% url 'applications_screening_view' job.slug %}" class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-temple-red/10 hover:bg-temple-red/20 text-temple-red font-bold transition">
{{ job.all_applications.count|default:"0" }}
</a>
</td>
<td class="px-6 py-4 text-center">
<a href="{% url 'applications_offer_view' job.slug %}" class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-emerald-100 hover:bg-emerald-200 text-emerald-600 font-bold transition">
{{ job.offer_applications.count|default:"0" }}
</a>
</td>
<td class="px-6 py-4 text-center">
<a href="{% url 'applications_hired_view' job.slug %}" class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-blue-100 hover:bg-blue-200 text-blue-600 font-bold transition">
{{ job.hired_applications.count|default:"0" }}
</a>
</td>
<td class="px-6 py-4">
<div class="flex items-center gap-2">
<a href="{% url 'job_detail' job.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 job.form_template %}
<a href="{% url 'form_template_submissions_list' job.form_template.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 'Submissions' %}">
<i data-lucide="file-text" class="w-4 h-4"></i>
</a>
{% endif %}
</div>
</td>
</tr>
{% empty %}
<tr>
<td colspan="10" class="px-6 py-12 text-center">
<i data-lucide="briefcase" 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 job postings found" %}</h3>
<p class="text-gray-500 mb-4">{% trans "Create your first job posting to get started." %}</p>
<a href="{% url 'job_create' %}" class="inline-flex items-center gap-2 bg-temple-red hover:bg-[#7a1a29] text-white font-semibold px-5 py-2.5 rounded-xl transition shadow-sm">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "Create Job" %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% include "includes/paginator.html" %}
</div>
<script>
lucide.createIcons();
</script>
{% endblock %}