kaauh_ats/templates/recruitment/applications_document_review_view.html
2025-11-27 16:25:34 +03:00

513 lines
21 KiB
HTML

{% extends 'base.html' %}
{% load static i18n %}
{% block title %}{% blocktrans %} Document Review - {{ job.title }} - University ATS{%endblocktrans %}{% endblock %}
{% block customCSS %}
<style>
/* KAAT-S UI Variables */
:root {
--kaauh-teal: #00636e;
--kaauh-teal-dark: #004a53;
--kaauh-border: #eaeff3;
--kaauh-primary-text: #343a40;
--kaauh-success: #28a745;
--kaauh-info: #17a2b8;
--kaauh-danger: #dc3545;
--kaauh-warning: #ffc107;
}
/* Primary Color Overrides */
.text-primary-theme { color: var(--kaauh-teal) !important; }
.bg-primary-theme { background-color: var(--kaauh-teal) !important; }
/* 1. Main Container & Card Styling */
.kaauh-card {
border: 1px solid var(--kaauh-border);
border-radius: 0.75rem;
box-shadow: 0 4px 12px rgba(0,0,0,0.06);
background-color: white;
}
/* Dedicated style for filter block */
.filter-controls {
background-color: #f8f9fa;
border-radius: 0.75rem;
padding: 1.5rem;
margin-bottom: 2rem;
border: 1px solid var(--kaauh-border);
}
/* 2. Button Styling (Themed for Main Actions) */
.btn-main-action {
background-color: var(--kaauh-teal);
border-color: var(--kaauh-teal);
color: white;
font-weight: 600;
transition: all 0.2s ease;
}
.btn-main-action:hover {
background-color: var(--kaauh-teal-dark);
border-color: var(--kaauh-teal-dark);
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.btn-outline-secondary {
color: var(--kaauh-teal-dark);
border-color: var(--kaauh-teal);
}
.btn-outline-secondary:hover {
background-color: var(--kaauh-teal-dark);
color: white;
border-color: var(--kaauh-teal-dark);
}
/* 3. Application Table Styling (Aligned with KAAT-S) */
.application-table {
table-layout: fixed;
width: 100%;
border-collapse: separate;
border-spacing: 0;
background-color: white;
border-radius: 0.5rem;
overflow: hidden;
}
.application-table thead {
background-color: var(--kaauh-border);
}
.application-table th {
padding: 0.75rem 1rem;
font-weight: 600;
color: var(--kaauh-teal-dark);
border-bottom: 2px solid var(--kaauh-teal);
font-size: 0.9rem;
vertical-align: middle;
}
.application-table td {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--kaauh-border);
vertical-align: middle;
font-size: 0.9rem;
}
.application-table tbody tr:hover {
background-color: #f1f3f4;
}
.application-table thead th:nth-child(1) { width: 40px; }
.application-table thead th:nth-child(4) { width: 10%; }
.application-table thead th:nth-child(7) { width: 100px; }
.application-name {
font-weight: 600;
color: var(--kaauh-primary-text);
}
.application-details {
font-size: 0.8rem;
color: #6c757d;
}
/* 4. Badges and Statuses */
.ai-score-badge {
background-color: var(--kaauh-teal-dark) !important;
color: white;
font-weight: 700;
padding: 0.4em 0.8em;
border-radius: 0.4rem;
}
.status-badge {
font-size: 0.75rem;
padding: 0.3em 0.7em;
border-radius: 0.35rem;
font-weight: 700;
}
.bg-applicant { background-color: #6c757d !important; color: white; }
.bg-application { background-color: var(--kaauh-success) !important; color: white; }
/* Stage Badges */
.stage-badge {
font-size: 0.75rem;
padding: 0.25rem 0.6rem;
border-radius: 0.3rem;
font-weight: 600;
display: inline-block;
margin-bottom: 0.2rem;
}
.stage-Applied { background-color: #e9ecef; color: #495057; }
.stage-Screening { background-color: var(--kaauh-info); color: white; }
.stage-Exam { background-color: var(--kaauh-warning); color: #856404; }
.stage-Interview { background-color: #17a2b8; color: white; }
.stage-Offer { background-color: var(--kaauh-success); color: white; }
/* Timeline specific container */
.applicant-tracking-timeline {
margin-bottom: 2rem;
}
/* Document specific styles */
.document-list {
max-height: 200px;
overflow-y: auto;
border: 1px solid var(--kaauh-border);
border-radius: 0.5rem;
background-color: #f8f9fa;
padding: 0.5rem;
}
.document-item {
padding: 0.5rem 0;
border-bottom: 1px solid #e9ecef;
display: flex;
justify-content: space-between;
align-items: center;
}
.document-item:last-child {
border-bottom: none;
}
.document-info {
flex: 1;
min-width: 0;
}
.document-name {
font-weight: 600;
color: var(--kaauh-primary-text);
margin-bottom: 0.25rem;
}
.document-meta {
font-size: 0.8rem;
color: #6c757d;
}
.document-actions {
display: flex;
gap: 0.5rem;
align-items: center;
}
.no-documents {
text-align: center;
padding: 2rem;
color: #6c757d;
font-style: italic;
}
/* --- CUSTOM HEIGHT OPTIMIZATION (MAKING INPUTS/BUTTONS SMALLER) --- */
.form-control-sm,
.btn-sm {
/* Reduce vertical padding even more than default Bootstrap 'sm' */
padding-top: 0.2rem !important;
padding-bottom: 0.2rem !important;
/* Ensure a consistent, small height for both */
height: 28px !important;
font-size: 0.8rem !important; /* Slightly smaller font */
}
</style>
{% endblock %}
{% block content %}
<div class="container-fluid py-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h1 class="h3 mb-1 page-header">
<i class="fas fa-file-alt me-2"></i>
{% trans "Document Review" %}
</h1>
<h2 class="h5 text-muted mb-0">
{% trans "Job:" %} {{ job.title }}
<span class="badge bg-secondary ms-2 fw-normal">{{ job.internal_job_id }}</span>
</h2>
</div>
<div class="d-flex gap-2">
{% comment %} <a href="{% url 'export_applications_csv' job.slug 'document_review' %}"
class="btn btn-outline-secondary"
title="{% trans 'Export document review applications to CSV' %}">
<i class="fas fa-download me-1"></i> {% trans "Export CSV" %}
</a> {% endcomment %}
<a href="{% url 'job_detail' job.slug %}" class="btn btn-outline-secondary">
<i class="fas fa-arrow-left me-1"></i> {% trans "Back to Job" %}
</a>
</div>
</div>
<div class="applicant-tracking-timeline mb-4">
{% include 'jobs/partials/applicant_tracking.html' %}
</div>
<!-- Search and Filter Controls -->
<div class="filter-controls">
<h4 class="h6 mb-3 fw-bold">
<i class="fas fa-search me-1"></i> {% trans "Search Applications" %}
</h4>
<form method="GET" class="mb-0">
<div class="row g-3 align-items-end">
<div class="col-auto">
<input type="text"
name="q"
class="form-control form-control-sm"
value="{{ search_query }}"
placeholder="{% trans 'Search by name, email...' %}"
style="min-width: 250px;">
</div>
<div class="col-auto">
<button type="submit" class="btn btn-main-action btn-sm">
<i class="fas fa-search me-1"></i> {% trans "Search" %}
</button>
</div>
</div>
</form>
</div>
<h2 class="h4 mb-3" style="color: var(--kaauh-primary-text);">
<i class="fas fa-users me-1"></i> {% trans "Applications Ready for Document Review" %}
<span class="badge bg-primary-theme ms-2">{{ applications|length }}</span>
</h2>
<div class="kaauh-card p-3">
{% if applications %}
<div class="bulk-action-bar p-3 bg-light border-bottom">
{# Use d-flex to align the entire contents (two forms and the separator) horizontally #}
<div class="d-flex align-items-end gap-3">
{# Form 1: Status Update #}
<form hx-boost="true" hx-include="#application-form" action="{% url 'application_update_status' job.slug %}" method="post" class="d-flex align-items-end gap-2 action-group">
{% csrf_token %}
{# Select Input Group - No label needed for this one, so we just flex the select and button #}
<select name="mark_as" id="update_status" class="form-select form-select-sm" style="width: 120px;">
<option selected>
----------
</option>
<option value="Interview">
{% trans "To Interview" %}
</option>
<option value="Offer">
{% trans "To Offer" %}
</option>
</select>
<button type="submit" class="btn btn-main-action btn-sm">
<i class="fas fa-arrow-right me-1"></i> {% trans "Change Stage" %}
</button>
</form>
{# Separator (Vertical Rule) - Aligns automatically at the bottom with align-items-end #}
<div class="vr" style="height: 28px;"></div>
<button type="button" class="btn btn-outline-primary btn-sm"
data-bs-toggle="modal"
hx-boost='true'
data-bs-target="#emailModal"
hx-get="{% url 'compose_application_email' job.slug %}"
hx-target="#emailModalBody"
hx-include="#application-form"
title="Email Participants">
<i class="fas fa-envelope"></i>
</button>
</div>
</div>
<div class="table-responsive">
<form id="application-form" action="{% url 'application_update_status' job.slug %}" method="get">
<table class="table application-table align-middle">
<thead>
<tr>
<th scope="col" style="width: 2%;">
{% if applications %}
<div class="form-check">
<input type="checkbox" class="form-check-input" id="selectAllCheckbox">
</div>
{% endif %}
</th>
<th scope="col" style="width: 20%;">
<i class="fas fa-user me-1"></i> {% trans "Name" %}
</th>
<th scope="col" style="width: 15%;">
<i class="fas fa-envelope me-1"></i> {% trans "Contact Info" %}
</th>
<th scope="col" style="width: 15%;">
<i class="fas fa-briefcase me-1"></i> {% trans "Current Stage" %}
</th>
<th scope="col" style="width: 28%;">
<i class="fas fa-file-alt me-1"></i> {% trans "Documents" %}
</th>
<th scope="col" style="width: 10%;">
<i class="fas fa-cog me-1"></i> {% trans "Actions" %}
</th>
</tr>
</thead>
<tbody>
{% for application in applications %}
<tr>
<td>
<div class="form-check">
<input name="candidate_ids" value="{{ application.id }}" type="checkbox" class="form-check-input rowCheckbox" id="application-{{ application.id }}">
</div>
</td>
<td>
<div class="application-name">
{{ application.person.first_name }} {{ application.person.last_name }}
</div>
</td>
<td><div class="application-details">
<i class="fas fa-envelope me-1"></i> {{ application.person.email }}<br>
<i class="fas fa-phone me-1"></i> {{ application.person.phone|default:"--" }}
</div></td>
<td>
<span class="stage-badge stage-Interview">
{% trans "Interview Completed" %}
</span>
</td>
<td>
{% with documents=application.documents.all %}
{% if documents %}
<table class="table table-sm table-hover">
<thead>
<tr>
</tr>
</thead>
<tbody>
{% for document in documents %}
<tr>
<td>
<div class="document-name">
<i class="fas fa-file me-1"></i>
{{ document.get_document_type_display }}
</div>
</td>
<td>
<small class="text-muted">
{% trans "Uploaded" %} {{ document.created_at|date:"M d, Y" }}
</small>
</td>
<td>
<div class="document-actions">
<a href="{{ document.file.url }}"
target="_blank"
class="btn btn-sm btn-outline-primary"
title="{% trans 'Download document' %}">
<i class="fas fa-download"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="no-documents">
<i class="fas fa-exclamation-triangle me-2"></i>
{% trans "No documents uploaded" %}
</div>
{% endif %}
{% endwith %}
</td>
<td class="text-center">
<button type="button" class="btn btn-outline-secondary btn-sm"
data-bs-toggle="modal"
data-bs-target="#candidateviewModal"
hx-get="{% url 'application_criteria_view_htmx' application.pk %}"
hx-target="#candidateviewModalBody"
title="View Profile">
<i class="fas fa-eye ms-1"></i>
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info text-center" role="alert">
<i class="fas fa-info-circle me-1"></i>
{% trans "No applications are currently ready for document review." %}
</div>
{% endif %}
</form>
</div>
</div>
<div class="modal fade modal-xl" id="candidateviewModal" tabindex="-1" aria-labelledby="candidateviewModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content kaauh-card"> <div class="modal-header" style="border-bottom: 1px solid var(--kaauh-border);">
<h5 class="modal-title" id="candidateviewModalLabel" style="color: var(--kaauh-teal-dark);">
{% trans "Application Details / Bulk Action Form" %}
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="candidateviewModalBody" class="modal-body">
<div class="text-center py-5 text-muted">
<i class="fas fa-spinner fa-spin fa-2x"></i><br>
{% trans "Loading content..." %}
</div>
</div>
</div>
</div>
</div>
<!-- Email Modal -->
<div class="modal fade" id="emailModal" tabindex="-1" aria-labelledby="emailModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content kaauh-card">
<div class="modal-header" style="border-bottom: 1px solid var(--kaauh-border);">
<h5 class="modal-title" id="emailModalLabel" style="color: var(--kaauh-teal-dark);">
<i class="fas fa-envelope me-2"></i>{% trans "Compose Email" %}
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="emailModalBody" class="modal-body">
<div class="text-center py-5 text-muted">
<i class="fas fa-spinner fa-spin fa-2x"></i><br>
{% trans "Loading email form..." %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block customJS %}
<script>
document.addEventListener('DOMContentLoaded', function () {
const selectAllCheckbox = document.getElementById('selectAllCheckbox');
const rowCheckboxes = document.querySelectorAll('.rowCheckbox');
if (selectAllCheckbox) {
// Function to safely update header checkbox state
function updateSelectAllState() {
const checkedCount = Array.from(rowCheckboxes).filter(cb => cb.checked).length;
const totalCount = rowCheckboxes.length;
if (checkedCount === 0) {
selectAllCheckbox.checked = false;
selectAllCheckbox.indeterminate = false;
} else if (checkedCount === totalCount) {
selectAllCheckbox.checked = true;
selectAllCheckbox.indeterminate = false;
} else {
selectAllCheckbox.checked = false;
selectAllCheckbox.indeterminate = true;
}
}
// 1. Logic for 'Select All' checkbox (Clicking it updates all rows)
selectAllCheckbox.addEventListener('change', function () {
const isChecked = selectAllCheckbox.checked;
rowCheckboxes.forEach(checkbox => {
checkbox.checked = isChecked;
checkbox.dispatchEvent(new Event('change', { bubbles: true }));
});
updateSelectAllState();
});
// 2. Logic to update 'Select All' state based on row checkboxes
rowCheckboxes.forEach(function (checkbox) {
checkbox.addEventListener('change', updateSelectAllState);
});
// Initial check to set correct state on load
updateSelectAllState();
}
});
</script>
{% endblock %}