465 lines
20 KiB
HTML
465 lines
20 KiB
HTML
{% extends 'base.html' %}
|
|
{% load static i18n %}
|
|
|
|
{% block title %}Candidate Tier Management - {{ job.title }} - ATS{% 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; /* Used for Exam stages (Pending status) */
|
|
--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 the tier control block (consistent with .filter-controls) */
|
|
.tier-controls {
|
|
background-color: var(--kaauh-border); /* Light background for control sections */
|
|
border-radius: 0.75rem;
|
|
padding: 1.25rem;
|
|
margin-bottom: 2rem;
|
|
border: 1px solid var(--kaauh-border);
|
|
}
|
|
.tier-controls .form-row {
|
|
display: flex;
|
|
align-items: end;
|
|
gap: 1rem;
|
|
}
|
|
.tier-controls .form-group {
|
|
flex: 1;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
/* 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);
|
|
}
|
|
/* Style for Bulk Pass button */
|
|
.btn-bulk-pass {
|
|
background-color: var(--kaauh-success);
|
|
border-color: var(--kaauh-success);
|
|
color: white;
|
|
font-weight: 500;
|
|
}
|
|
.btn-bulk-pass:hover {
|
|
background-color: #1e7e34;
|
|
border-color: #1e7e34;
|
|
}
|
|
/* Style for Bulk Fail button */
|
|
.btn-bulk-fail {
|
|
background-color: var(--kaauh-danger);
|
|
border-color: var(--kaauh-danger);
|
|
color: white;
|
|
font-weight: 500;
|
|
}
|
|
.btn-bulk-fail:hover {
|
|
background-color: #bd2130;
|
|
border-color: #bd2130;
|
|
}
|
|
|
|
/* 3. Input and Button Height Optimization (Thin look) */
|
|
.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 inputs and buttons */
|
|
height: 28px !important;
|
|
font-size: 0.8rem !important;
|
|
}
|
|
.btn-main-action.btn-sm { font-weight: 600 !important; }
|
|
|
|
/* Container for the timeline include */
|
|
.applicant-tracking-timeline {
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
/* 4. Candidate Table Styling (KAAT-S Look) */
|
|
.candidate-table {
|
|
table-layout: fixed;
|
|
width: 100%;
|
|
border-collapse: separate;
|
|
border-spacing: 0;
|
|
background-color: white;
|
|
border-radius: 0.5rem;
|
|
overflow: hidden;
|
|
}
|
|
.candidate-table thead {
|
|
background-color: var(--kaauh-border);
|
|
}
|
|
.candidate-table th {
|
|
padding: 0.75rem;
|
|
font-weight: 600;
|
|
color: var(--kaauh-teal-dark);
|
|
border-bottom: 2px solid var(--kaauh-teal);
|
|
font-size: 0.9rem;
|
|
vertical-align: middle;
|
|
}
|
|
.candidate-table td {
|
|
padding: 0.75rem;
|
|
border-bottom: 1px solid var(--kaauh-border);
|
|
vertical-align: middle;
|
|
font-size: 0.9rem;
|
|
}
|
|
.candidate-table tbody tr:hover {
|
|
background-color: #f1f3f4;
|
|
}
|
|
.candidate-name {
|
|
font-weight: 600;
|
|
color: var(--kaauh-primary-text);
|
|
}
|
|
.candidate-details {
|
|
font-size: 0.8rem;
|
|
color: #6c757d;
|
|
}
|
|
.candidate-table-responsive {
|
|
overflow-x: auto;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
/* 5. Badges */
|
|
.ai-score-badge {
|
|
background-color: var(--kaauh-teal-dark) !important;
|
|
color: white;
|
|
font-weight: 700;
|
|
padding: 0.4em 0.8em;
|
|
border-radius: 0.4rem;
|
|
font-size: 0.8rem;
|
|
}
|
|
.status-badge { /* Used for Exam Status (Passed/Failed/Pending) */
|
|
font-size: 0.75rem;
|
|
padding: 0.3em 0.7em;
|
|
border-radius: 0.35rem;
|
|
font-weight: 700;
|
|
text-transform: uppercase;
|
|
display: inline-block;
|
|
}
|
|
.bg-success { background-color: var(--kaauh-success) !important; color: white; }
|
|
.bg-danger { background-color: var(--kaauh-danger) !important; color: white; }
|
|
.bg-info-pending { background-color: var(--kaauh-info) !important; color: white; }
|
|
|
|
.tier-badge { /* Used for Tier labels */
|
|
font-size: 0.75rem;
|
|
padding: 0.125rem 0.5rem;
|
|
border-radius: 0.5rem;
|
|
font-weight: 600;
|
|
margin-left: 0.5rem;
|
|
display: inline-block;
|
|
}
|
|
.tier-1-badge { background-color: var(--kaauh-success); color: white; }
|
|
.tier-2-badge { background-color: var(--kaauh-warning); color: #856404; }
|
|
.tier-3-badge { background-color: #d1ecf1; color: #0c5460; }
|
|
|
|
/* Fix table column widths for better layout */
|
|
.candidate-table th:nth-child(1) { width: 40px; } /* Checkbox */
|
|
.candidate-table th:nth-child(4) { width: 10%; } /* AI Score */
|
|
.candidate-table th:nth-child(5) { width: 12%; } /* Exam Status */
|
|
.candidate-table th:nth-child(6) { width: 15%; } /* Exam Date */
|
|
.candidate-table th:nth-child(7) { width: 220px; } /* Actions */
|
|
|
|
.cd_exam{
|
|
color: #00636e;
|
|
}
|
|
</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" style="color: var(--kaauh-teal-dark); font-weight: 700;">
|
|
<i class="fas fa-edit me-2"></i>
|
|
{% trans "Exam Management" %} - {{ job.title }}
|
|
</h1>
|
|
<h2 class="h5 text-muted mb-0">
|
|
{% trans "Candidates in Exam Stage:" %} <span class="fw-bold">{{ total_candidates }}</span>
|
|
</h2>
|
|
</div>
|
|
<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>
|
|
|
|
{# APPLICANT TRACKING TIMELINE INCLUSION #}
|
|
<div class="applicant-tracking-timeline">
|
|
{% include 'jobs/partials/applicant_tracking.html' %}
|
|
</div>
|
|
{# END APPLICANT TRACKING TIMELINE INCLUSION #}
|
|
|
|
{% comment %} <div class="tier-controls kaauh-card shadow-sm">
|
|
<h4 class="h6 mb-3 fw-bold" style="color: var(--kaauh-teal-dark);">
|
|
<i class="fas fa-sort-amount-up me-1"></i> {% trans "Define Top Candidates (Tiers)" %}
|
|
</h4>
|
|
<form method="post" class="mb-0">
|
|
{% csrf_token %}
|
|
<div class="row g-3 align-items-end">
|
|
<div class="col-md-3 col-sm-6">
|
|
<label for="tier1_count" class="form-label small text-muted mb-1">
|
|
{% trans "Number of Tier 1 Candidates (Top N)" %}
|
|
</label>
|
|
<input type="number" name="tier1_count" id="tier1_count" class="form-control form-control-sm"
|
|
value="{{ tier1_count }}" min="1" max="{{ total_candidates }}" placeholder="e.g., 50">
|
|
</div>
|
|
<div class="col-md-3 col-sm-6">
|
|
<button type="submit" name="update_tiers" class="btn btn-main-action btn-sm w-100">
|
|
<i class="fas fa-sync-alt me-1"></i> {% trans "Update Tiers" %}
|
|
</button>
|
|
</div>
|
|
<div class="col-md-6 d-none d-md-block"></div>
|
|
</div>
|
|
</form> {% endcomment %}
|
|
</div>
|
|
|
|
<h2 class="h4 mb-3" style="color: var(--kaauh-primary-text);">
|
|
{% trans "Candidate List" %}
|
|
<span class="badge bg-primary-theme ms-2">{{ candidates|length }} / {{ total_candidates }} Total</span>
|
|
<small class="text-muted fw-normal ms-2">(Sorted by AI Score)</small>
|
|
</h2>
|
|
|
|
<div class="kaauh-card shadow-sm p-3">
|
|
<div class="candidate-table-responsive" data-signals__ifmissing="{_fetching: false, selections: Array({{ candidates|length }}).fill(false)}">
|
|
<div class="col-md-3 col-sm-6 mb-3 d-flex gap-2">
|
|
{% if candidates %}
|
|
<form hx-boost="true" hx-include="#candidate-form" action="{% url 'candidate_update_status' job.slug %}" method="post">
|
|
<div class="d-flex align-items-center">
|
|
<select name="mark_as" id="update_status" class="form-select form-select-sm" style="height: 3rem;">
|
|
<option value="Applied">
|
|
<i class="fas fa-arrow-left me-1"></i> {% trans "Apply" %}
|
|
</option>
|
|
<option value="Interview">
|
|
<i class="fas fa-arrow-right me-1"></i> {% trans "Interview" %}
|
|
</option>
|
|
</select>
|
|
<button type="submit" class="btn btn-main-action btn-mds ms-2">
|
|
<i class="fas fa-arrow-right me-1"></i> {% trans "Update" %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<form id="candidate-form" method="post">
|
|
{% csrf_token %}
|
|
<table class="table candidate-table align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
{% if candidates %}
|
|
<div class="form-check">
|
|
<input
|
|
type="checkbox" class="form-check-input" id="selectAllCheckbox">
|
|
</div>
|
|
{% endif %}
|
|
</th>
|
|
<th>{% trans "Name" %}</th>
|
|
<th>{% trans "Contact" %}</th>
|
|
<th class="text-center">{% trans "AI Score" %}</th>
|
|
<th class="text-center">{% trans "Exam Status" %}</th>
|
|
<th>{% trans "Exam Date" %}</th>
|
|
<th>{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for candidate in candidates %}
|
|
<tr>
|
|
<td>
|
|
<div class="form-check">
|
|
<input
|
|
name="candidate_ids"
|
|
value="{{ candidate.id }}"
|
|
type="checkbox" class="form-check-input rowCheckbox" id="candidate-{{ candidate.id }}">
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<div class="candidate-name">
|
|
{{ candidate.name }}
|
|
{# Tier logic updated to be cleaner #}
|
|
{% if forloop.counter <= tier1_count %}
|
|
<span class="stage-badge tier-1-badge">Tier 1</span>
|
|
{% elif forloop.counter <= tier1_count|default:0|add:tier1_count %}
|
|
<span class="stage-badge tier-2-badge">Tier 2</span>
|
|
{% else %}
|
|
<span class="stage-badge tier-3-badge">Tier 3+</span>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<div class="candidate-details">
|
|
<i class="fas fa-envelope me-1"></i> {{ candidate.email }}<br>
|
|
<i class="fas fa-phone me-1"></i> {{ candidate.phone }}
|
|
</div>
|
|
</td>
|
|
<td class="text-center">
|
|
<span class="badge ai-score-badge">{{ candidate.match_score|default:"0" }}%</span>
|
|
</td>
|
|
<td class="text-center">
|
|
{% if candidate.exam_status == "Passed" %}
|
|
<span class="status-badge bg-success">{{ candidate.exam_status }}</span>
|
|
{% elif candidate.exam_status == "Failed" %}
|
|
<span class="status-badge bg-danger">{{ candidate.exam_status }}</span>
|
|
{% else %}
|
|
<span class="status-badge bg-info-pending">Pending</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{{candidate.exam_date|date:"M d, Y h:i A"|default:"N/A"}}
|
|
</td>
|
|
<td class="d-flex flex-wrap gap-1">
|
|
<button type="button" class="btn btn-outline-secondary btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'candidate_criteria_view_htmx' candidate.pk %}"
|
|
hx-target="#candidateviewModalBody"
|
|
title="View Profile">
|
|
<i class="fas fa-eye"></i> View
|
|
</button>
|
|
<button type="button" class="btn btn-main-action btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'update_candidate_exam_status' candidate.slug %}"
|
|
hx-target="#candidateviewModalBody"
|
|
title="Set Exam Status/Date">
|
|
<i class="fas fa-calendar-alt"></i> Set Exam
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% if not candidates %}
|
|
<div class="alert alert-info text-center mt-3 mb-0" role="alert">
|
|
<i class="fas fa-info-circle me-1"></i>
|
|
{% trans "No candidates are currently in the Exam stage for this job." %}
|
|
</div>
|
|
{% endif %}
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal fade modal-lg" 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 "Candidate Details & Exam Update" %}
|
|
</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 candidate data..." %}
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer" style="border-top: 1px solid var(--kaauh-border);">
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">
|
|
{% trans "Close" %}
|
|
</button>
|
|
</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 the 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 {
|
|
// Set to indeterminate state (partially checked)
|
|
selectAllCheckbox.checked = false;
|
|
selectAllCheckbox.indeterminate = true;
|
|
}
|
|
|
|
// IMPORTANT: We do NOT fire a change event here to prevent the infinite loop.
|
|
// Your existing data-bind-_all logic should handle the bulk action status.
|
|
}
|
|
|
|
// 1. Logic for the 'Select All' checkbox (Clicking it updates all rows)
|
|
selectAllCheckbox.addEventListener('change', function () {
|
|
const isChecked = selectAllCheckbox.checked;
|
|
|
|
// Temporarily disable the change listener on rows to prevent cascading events
|
|
rowCheckboxes.forEach(checkbox => checkbox.removeEventListener('change', updateSelectAllState));
|
|
|
|
// Update all row checkboxes
|
|
rowCheckboxes.forEach(function (checkbox) {
|
|
checkbox.checked = isChecked;
|
|
|
|
// You must still dispatch the event here so your framework's data-bind-selections
|
|
// picks up the change on individual elements. This should NOT trigger the updateSelectAllState.
|
|
checkbox.dispatchEvent(new Event('change', { bubbles: true }));
|
|
});
|
|
|
|
// Re-attach the change listeners to the rows
|
|
rowCheckboxes.forEach(checkbox => checkbox.addEventListener('change', updateSelectAllState));
|
|
|
|
// Ensure the header state is correct after forcing all changes
|
|
updateSelectAllState();
|
|
});
|
|
|
|
// 2. Logic to update 'Select All' state based on row checkboxes
|
|
// Attach the function to be called whenever a row checkbox changes
|
|
rowCheckboxes.forEach(function (checkbox) {
|
|
checkbox.addEventListener('change', updateSelectAllState);
|
|
});
|
|
|
|
// Initial check to set the correct state on load (in case items are pre-checked)
|
|
updateSelectAllState();
|
|
}
|
|
});
|
|
</script>
|
|
{% endblock %} |