433 lines
25 KiB
HTML
433 lines
25 KiB
HTML
{% extends 'base.html' %}
|
|
{% load static i18n %}
|
|
|
|
{% block title %}{{ assignment.agency.name }} - {{ assignment.job.title }} - ATS{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="px-4 py-6">
|
|
<!-- Header -->
|
|
<div class="flex flex-col sm:flex-row sm:justify-between sm:items-start gap-4 mb-6">
|
|
<div class="flex-1">
|
|
<h1 class="text-2xl font-bold text-temple-dark mb-1 flex items-center gap-2">
|
|
<i data-lucide="tasks" class="w-7 h-7"></i>
|
|
{{ assignment.agency.name }} - {{ assignment.job.title }}
|
|
</h1>
|
|
<p class="text-gray-600">
|
|
{% trans "Assignment Details and Management" %}
|
|
</p>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
<a href="{% url 'agency_assignment_list' %}"
|
|
class="inline-flex items-center gap-2 border border-gray-300 text-gray-700 hover:bg-gray-50 px-4 py-2 rounded-lg text-sm font-medium transition">
|
|
<i data-lucide="arrow-left" class="w-4 h-4"></i>
|
|
{% trans "Back to Assignments" %}
|
|
</a>
|
|
<a href="{% url 'agency_assignment_update' assignment.slug %}"
|
|
class="inline-flex items-center gap-2 bg-temple-red hover:bg-red-800 text-white font-semibold px-4 py-2 rounded-lg transition shadow-md hover:shadow-lg">
|
|
<i data-lucide="edit" class="w-4 h-4"></i>
|
|
{% trans "Edit Assignment" %}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
<!-- Main Content -->
|
|
<div class="lg:col-span-2 space-y-6">
|
|
<!-- Assignment Details Card -->
|
|
<div class="bg-white rounded-xl shadow-md border border-gray-200">
|
|
<div class="p-6">
|
|
<h5 class="text-lg font-semibold text-temple-dark mb-4 flex items-center gap-2">
|
|
<i data-lucide="info" class="w-5 h-5"></i>
|
|
{% trans "Assignment Details" %}
|
|
</h5>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="text-sm text-gray-500 font-medium block mb-1">{% trans "Agency" %}</label>
|
|
<div class="font-semibold text-gray-900">{{ assignment.agency.name }}</div>
|
|
<div class="text-sm text-gray-600">{{ assignment.agency.contact_person }}</div>
|
|
</div>
|
|
<div>
|
|
<label class="text-sm text-gray-500 font-medium block mb-1">{% trans "Job" %}</label>
|
|
<div class="font-semibold text-gray-900">{{ assignment.job.title }}</div>
|
|
<div class="text-sm text-gray-600">{{ assignment.job.department }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="text-sm text-gray-500 font-medium block mb-1">{% trans "Status" %}</label>
|
|
<span class="status-badge inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-temple-red text-white">
|
|
{{ assignment.get_status_display }}
|
|
</span>
|
|
</div>
|
|
<div>
|
|
<label class="text-sm text-gray-500 font-medium block mb-1">{% trans "Deadline" %}</label>
|
|
<div class="{% if assignment.is_expired %}text-red-600{% else %}text-gray-600{% endif %} flex items-center gap-1">
|
|
<i data-lucide="calendar" class="w-4 h-4"></i>
|
|
{{ assignment.deadline_date|date:"Y-m-d H:i" }}
|
|
</div>
|
|
{% if assignment.is_expired %}
|
|
<span class="text-sm text-red-600 flex items-center gap-1 mt-1">
|
|
<i data-lucide="alert-triangle" class="w-4 h-4"></i>
|
|
{% trans "Expired" %}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if assignment.admin_notes %}
|
|
<div class="mt-6 pt-4 border-t border-gray-200">
|
|
<label class="text-sm text-gray-500 font-medium block mb-2">{% trans "Admin Notes" %}</label>
|
|
<div class="text-gray-700">{{ assignment.admin_notes }}</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Applications Card -->
|
|
<div class="bg-white rounded-xl shadow-md border border-gray-200">
|
|
<div class="p-6">
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h5 class="text-lg font-semibold text-temple-dark flex items-center gap-2">
|
|
<i data-lucide="users" class="w-5 h-5"></i>
|
|
{% trans "Submitted Applications" %} ({{ total_applications }})
|
|
</h5>
|
|
{% if access_link %}
|
|
<a href="{% url 'agency_portal_login' %}" target="_blank"
|
|
class="inline-flex items-center gap-2 border border-blue-500 text-blue-600 hover:bg-blue-50 px-3 py-1.5 rounded-lg text-sm font-medium transition">
|
|
<i data-lucide="external-link" class="w-4 h-4"></i>
|
|
<span class="hidden sm:inline">{% trans "Preview Portal" %}</span>
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if applications %}
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full">
|
|
<thead>
|
|
<tr class="border-b border-gray-200">
|
|
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
{% trans "Application" %}
|
|
</th>
|
|
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
{% trans "Contact" %}
|
|
</th>
|
|
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
{% trans "Stage" %}
|
|
</th>
|
|
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
{% trans "Submitted" %}
|
|
</th>
|
|
<th class="px-4 py-3 text-right text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
{% trans "Actions" %}
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200">
|
|
{% for application in applications %}
|
|
<tr class="hover:bg-gray-50 transition">
|
|
<td class="px-4 py-3">
|
|
<div class="font-semibold text-gray-900">{{ application.name }}</div>
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<div class="text-sm text-gray-600 space-y-1">
|
|
<div class="flex items-center gap-1">
|
|
<i data-lucide="mail" class="w-3 h-3"></i>
|
|
{{ application.email }}
|
|
</div>
|
|
<div class="flex items-center gap-1">
|
|
<i data-lucide="phone" class="w-3 h-3"></i>
|
|
{{ application.phone }}
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-temple-red text-white">
|
|
{{ application.get_stage_display }}
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<span class="text-sm text-gray-600">{{ application.created_at|date:"M d, Y" }}</span>
|
|
</td>
|
|
<td class="px-4 py-3 text-right">
|
|
<a href="{% url 'application_detail' application.slug %}"
|
|
class="inline-flex items-center justify-center p-2 text-temple-red hover:bg-red-50 rounded-lg transition"
|
|
title="{% trans 'View Details' %}">
|
|
<i data-lucide="eye" class="w-4 h-4"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div class="text-center py-12">
|
|
<i data-lucide="users" class="w-16 h-16 text-gray-400 mx-auto mb-4"></i>
|
|
<h6 class="text-lg font-semibold text-gray-600 mb-2">{% trans "No applications submitted yet" %}</h6>
|
|
<p class="text-gray-500 text-sm">
|
|
{% trans "Applications will appear here once agency submits them through their portal." %}
|
|
</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Sidebar -->
|
|
<div class="space-y-6">
|
|
<!-- Progress Card -->
|
|
<div class="bg-white rounded-xl shadow-md border border-gray-200 p-6">
|
|
<h5 class="text-lg font-semibold text-temple-dark mb-4 text-center">
|
|
{% trans "Submission Progress" %}
|
|
</h5>
|
|
|
|
<div class="text-center mb-4">
|
|
<div class="relative inline-block">
|
|
<svg width="120" height="120" class="transform -rotate-90">
|
|
<circle cx="60" cy="60" r="52"
|
|
stroke="#e5e7eb"
|
|
stroke-width="8"
|
|
fill="transparent"/>
|
|
<circle cx="60" cy="60" r="52"
|
|
stroke="#9d2235"
|
|
stroke-width="8"
|
|
fill="transparent"
|
|
stroke-linecap="round"
|
|
style="stroke-dasharray: 326.73; stroke-dashoffset: {{ stroke_dashoffset }};"/>
|
|
</svg>
|
|
<div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-center">
|
|
<div class="text-3xl font-bold text-gray-900">{{ total_applications }}</div>
|
|
<div class="text-xs text-gray-500 uppercase">{% trans "of" %} {{ assignment.max_candidates }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-center mb-4">
|
|
<div class="text-4xl font-bold text-temple-red mb-1">{{ total_applications }}</div>
|
|
<div class="text-gray-600">/ {{ assignment.max_candidates }} {% trans "applications" %}</div>
|
|
</div>
|
|
|
|
{% widthratio total_applications assignment.max_candidates 100 as progress %}
|
|
<div class="w-full bg-gray-200 rounded-full h-2">
|
|
<div class="bg-temple-red h-2 rounded-full transition-all duration-500" style="width: {{ progress }}%"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Actions Card -->
|
|
<div class="bg-white rounded-xl shadow-md border border-gray-200 p-6">
|
|
<h5 class="text-lg font-semibold text-temple-dark mb-4 flex items-center gap-2">
|
|
<i data-lucide="settings" class="w-5 h-5"></i>
|
|
{% trans "Actions" %}
|
|
</h5>
|
|
|
|
<div class="space-y-2">
|
|
<a href="{% url "message_list" %}"
|
|
class="w-full inline-flex items-center justify-center gap-2 border border-gray-300 text-gray-700 hover:bg-gray-50 px-4 py-2.5 rounded-lg text-sm font-medium transition">
|
|
<i data-lucide="mail" class="w-4 h-4"></i>
|
|
{% trans "Send Message" %}
|
|
</a>
|
|
|
|
{% if assignment.is_active and not assignment.is_expired %}
|
|
<button type="button"
|
|
class="w-full inline-flex items-center justify-center gap-2 border border-yellow-500 text-yellow-700 hover:bg-yellow-50 px-4 py-2.5 rounded-lg text-sm font-medium transition"
|
|
onclick="document.getElementById('extendDeadlineModal').classList.remove('hidden')">
|
|
<i data-lucide="clock" class="w-4 h-4"></i>
|
|
{% trans "Extend Deadline" %}
|
|
</button>
|
|
{% endif %}
|
|
|
|
{% if assignment.is_active and assignment.status == 'ACTIVE' %}
|
|
<button type="button"
|
|
class="w-full inline-flex items-center justify-center gap-2 bg-red-500 hover:bg-red-600 text-white px-4 py-2.5 rounded-lg text-sm font-medium transition"
|
|
onclick="document.getElementById('cancelAssignmentModal').classList.remove('hidden')">
|
|
<i data-lucide="x" class="w-4 h-4"></i>
|
|
{% trans "Cancel Assignment" %}
|
|
</button>
|
|
{% endif %}
|
|
|
|
<a href="{% url 'agency_assignment_update' assignment.slug %}"
|
|
class="w-full inline-flex items-center justify-center gap-2 border border-gray-300 text-gray-700 hover:bg-gray-50 px-4 py-2.5 rounded-lg text-sm font-medium transition">
|
|
<i data-lucide="edit-2" class="w-4 h-4"></i>
|
|
{% trans "Edit Assignment" %}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Messages Section -->
|
|
{% if messages_ %}
|
|
<div class="bg-white rounded-xl shadow-md border border-gray-200 p-6 mt-6">
|
|
<h5 class="text-lg font-semibold text-temple-dark mb-4 flex items-center gap-2">
|
|
<i data-lucide="message-square" class="w-5 h-5"></i>
|
|
{% trans "Recent Messages" %}
|
|
</h5>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
{% for message in messages_|slice:":6" %}
|
|
<div class="border-l-4 {% if not message.is_read %}border-blue-500 bg-blue-50{% else %}border-temple-red bg-gray-50{% endif %} rounded-r-lg p-4">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div class="font-semibold text-gray-900">{{ message.subject }}</div>
|
|
<span class="text-sm text-gray-500">{{ message.created_at|date:"Y-m-d H:i" }}</span>
|
|
</div>
|
|
<div class="text-sm text-gray-600 mb-2">
|
|
{% trans "From" %}: {{ message.sender.get_full_name }}
|
|
</div>
|
|
<div class="text-sm text-gray-700">{{ message.message|truncatewords:30 }}</div>
|
|
{% if not message.is_read %}
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 mt-2">
|
|
{% trans "New" %}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if messages_.count > 6 %}
|
|
<div class="text-center mt-4">
|
|
<a href="#" class="inline-flex items-center gap-2 border border-gray-300 text-gray-700 hover:bg-gray-50 px-4 py-2 rounded-lg text-sm font-medium transition">
|
|
{% trans "View All Messages" %}
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Cancel Assignment Modal -->
|
|
<div id="cancelAssignmentModal" class="hidden fixed inset-0 z-50 overflow-y-auto">
|
|
<div class="flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
|
|
<div class="fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75" onclick="document.getElementById('cancelAssignmentModal').classList.add('hidden')"></div>
|
|
|
|
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg w-full">
|
|
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
|
<div class="sm:flex sm:items-start">
|
|
<div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
|
|
<i data-lucide="alert-triangle" class="w-6 h-6 text-red-600"></i>
|
|
</div>
|
|
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
|
<h3 class="text-lg font-semibold text-gray-900 mb-2">
|
|
{% trans "Cancel Assignment" %}
|
|
</h3>
|
|
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-3 mb-4">
|
|
<p class="text-sm text-yellow-800">
|
|
<strong>{% trans "Warning:" %}</strong>
|
|
{% trans "This action cannot be undone. The agency will no longer be able to submit applications." %}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="bg-gray-50 rounded-lg p-4 mb-4">
|
|
<h6 class="text-temple-red font-semibold mb-2 flex items-center gap-2">
|
|
<i data-lucide="building" class="w-4 h-4"></i>
|
|
{{ assignment.agency.name }}
|
|
</h6>
|
|
<p class="text-gray-600 text-sm flex items-center gap-2">
|
|
<i data-lucide="briefcase" class="w-4 h-4"></i>
|
|
{{ assignment.job.title }}
|
|
</p>
|
|
</div>
|
|
|
|
<form method="post" action="{% url 'agency_assignment_cancel' assignment.slug %}">
|
|
{% csrf_token %}
|
|
<div class="mb-4">
|
|
<label for="cancel_reason" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
<i data-lucide="message-square" class="w-4 h-4 inline mr-1"></i>
|
|
{% trans "Cancellation Reason" %}
|
|
<span class="font-normal text-gray-500">({% trans "Optional" %})</span>
|
|
</label>
|
|
<textarea class="w-full px-3 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-temple-red focus:border-transparent transition text-gray-900"
|
|
id="cancel_reason" name="cancel_reason" rows="4"
|
|
placeholder="{% trans 'Enter reason for cancelling this assignment (optional)...' %}"></textarea>
|
|
</div>
|
|
|
|
<div class="flex justify-end gap-3">
|
|
<button type="button"
|
|
class="inline-flex items-center gap-2 border border-gray-300 text-gray-700 hover:bg-gray-50 px-4 py-2 rounded-lg text-sm font-medium transition"
|
|
onclick="document.getElementById('cancelAssignmentModal').classList.add('hidden')">
|
|
<i data-lucide="arrow-left" class="w-4 h-4"></i>
|
|
{% trans "Cancel" %}
|
|
</button>
|
|
<button type="submit"
|
|
class="inline-flex items-center gap-2 bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-lg text-sm font-medium transition">
|
|
<i data-lucide="x-circle" class="w-4 h-4"></i>
|
|
{% trans "Cancel Assignment" %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Extend Deadline Modal -->
|
|
<div id="extendDeadlineModal" class="hidden fixed inset-0 z-50 overflow-y-auto">
|
|
<div class="flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
|
|
<div class="fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75" onclick="document.getElementById('extendDeadlineModal').classList.add('hidden')"></div>
|
|
|
|
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg w-full">
|
|
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
|
<h3 class="text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2">
|
|
<i data-lucide="clock" class="w-5 h-5"></i>
|
|
{% trans "Extend Assignment Deadline" %}
|
|
</h3>
|
|
|
|
<form method="post" action="{% url 'agency_assignment_extend_deadline' assignment.slug %}">
|
|
{% csrf_token %}
|
|
<div class="mb-4">
|
|
<label for="new_deadline" class="block text-sm font-semibold text-gray-700 mb-2">
|
|
{% trans "New Deadline" %} <span class="text-red-600">*</span>
|
|
</label>
|
|
<input type="datetime-local"
|
|
class="w-full px-3 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-temple-red focus:border-transparent transition text-gray-900"
|
|
id="new_deadline" name="new_deadline" required>
|
|
<p class="mt-1 text-sm text-gray-500">
|
|
{% trans "Current deadline:" %} {{ assignment.deadline_date|date:"Y-m-d H:i" }}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="flex justify-end gap-3">
|
|
<button type="button"
|
|
class="inline-flex items-center gap-2 border border-gray-300 text-gray-700 hover:bg-gray-50 px-4 py-2 rounded-lg text-sm font-medium transition"
|
|
onclick="document.getElementById('extendDeadlineModal').classList.add('hidden')">
|
|
{% trans "Cancel" %}
|
|
</button>
|
|
<button type="submit"
|
|
class="inline-flex items-center gap-2 bg-temple-red hover:bg-red-800 text-white px-4 py-2 rounded-lg text-sm font-medium transition">
|
|
<i data-lucide="clock" class="w-4 h-4"></i>
|
|
{% trans "Extend Deadline" %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block customJS %}
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Initialize Lucide icons
|
|
lucide.createIcons();
|
|
|
|
// Set minimum datetime for new deadline
|
|
const deadlineInput = document.getElementById('new_deadline');
|
|
if (deadlineInput) {
|
|
const currentDeadline = new Date('{{ assignment.deadline_date|date:"Y-m-d\\TH:i" }}');
|
|
const now = new Date();
|
|
const minDateTime = new Date(Math.max(currentDeadline, now));
|
|
|
|
const localDateTime = new Date(minDateTime.getTime() - minDateTime.getTimezoneOffset() * 60000)
|
|
.toISOString()
|
|
.slice(0, 16);
|
|
deadlineInput.min = localDateTime;
|
|
deadlineInput.value = localDateTime;
|
|
}
|
|
});
|
|
</script>
|
|
{% endblock %} |