kaauh_ats/templates/recruitment/candidate_screening_view.html
2025-10-19 17:23:06 +03:00

282 lines
13 KiB
HTML

{% extends 'base.html' %}
{% load static i18n %}
{% block title %}Candidate Management - {{ job.title }} - University ATS{% 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-layer-group me-2"></i>
{% trans "Applicant Screening" %}
</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>
<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 class="applicant-tracking-timeline mb-4">
{% include 'jobs/partials/applicant_tracking.html' %}
</div>
<div class="filter-controls">
<h4 class="h6 mb-3 fw-bold">
<i class="fas fa-sort-numeric-up me-1"></i> {% trans "AI Scoring & Top Candidate Filter" %}
</h4>
<form method="GET" class="mb-0">
<div class="row g-3 align-items-end">
<div class="col-auto">
<label for="min_ai_score" class="form-label small text-muted mb-1">
{% trans "Min AI Score" %}
</label>
<input type="number" name="min_ai_score" id="min_ai_score" class="form-control form-control-sm"
value="{{ min_ai_score}}" min="0" max="100" step="1"
placeholder="e.g., 75" style="width: 120px;">
</div>
<div class="col-auto">
<label for="tier1_count" class="form-label small text-muted mb-1">
{% trans "Top N Candidates" %}
</label>
<input type="number" name="tier1_count" id="tier1_count" class="form-control form-control-sm"
value="{{ tier1_count }}" min="1" max="{{ total_candidates }}" style="width: 120px;">
</div>
<div class="col-auto">
<button type="submit" name="update_tiers" class="btn btn-main-action btn-sm">
<i class="fas fa-sync-alt me-1"></i> {% trans "Update Filters" %}
</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 "Candidate List" %}
<span class="badge bg-primary-theme ms-2">{{ candidates|length }} / {{ total_candidates }} Total</span>
</h2>
<div class="kaauh-card p-3">
{% if candidates %}
<div class="bulk-action-bar">
<form hx-boost="true" hx-include="#candidate-form" action="{% url 'candidate_update_status' job.slug %}" method="post" class="action-group">
{% csrf_token %}
<label for="update_status" class="form-label small mb-0 fw-bold">{% trans "Move Selected To:" %}</label>
<select name="mark_as" id="update_status" class="form-select form-select-sm" style="width: auto;">
<option selected>
----------
</option>
<option value="Exam">
{% trans "Exam Stage" %}
</option>
</select>
<button type="submit" class="btn btn-main-action btn-sm">
<i class="fas fa-arrow-right me-1"></i> {% trans "Update Status" %}
</button>
</form>
</div>
{% endif %}
<div class="table-responsive">
<form id="candidate-form" action="{% url 'candidate_update_status' job.slug %}" method="post">
{% csrf_token %}
<table class="table candidate-table align-middle">
<thead>
<tr>
<th scope="col" style="width: 2%;">
{% if candidates %}
<div class="form-check">
<input
type="checkbox" class="form-check-input" id="selectAllCheckbox">
</div>
{% endif %}
</th>
<th scope="col" style="width: 8%;">
<i class="fas fa-user me-1"></i> {% trans "Candidate Name" %}
</th>
<th scope="col" style="width: 10%;">
<i class="fas fa-phone me-1"></i> {% trans "Contact Info" %}
</th>
<th scope="col" style="width: 6%;" class="text-center">
<i class="fas fa-robot me-1"></i> {% trans "AI Score" %}
</th>
<th scope="col" style="width: 15%;" class="text-center">
<i class="fas fa-robot me-1"></i> {% trans "Is Qualified?" %}
</th>
<th scope="col" style="width: 10%;">
<i class="fas fa-graduation-cap me-1"></i> {% trans "Professional Category" %}
</th>
<th scope="col" style="width: 15%;">
<i class="fas fa-graduation-cap me-1"></i> {% trans "Top 3 Skills" %}
</th>
<th scope="col" style="width: 10%;" class="text-center">
<i class="fas fa-cog me-1"></i> {% 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>
<a href="#" class="candidate-name text-primary-theme text-decoration-none">
{{ candidate.name }}
</a>
</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">
{% if candidate.match_score %}
<span class="badge ai-score-badge">
{{ candidate.match_score|default:"0" }}%
</span>
{% endif %}
</td>
<td class="text-center">
{% if candidate.screening_stage_rating %}
<span class="badge ai-score-badge d-inline-block text-wrap">
{{ candidate.screening_stage_rating|default:"--" }}
</span>
{% endif %}
</td>
<td class="text-center">
{% if candidate.professional_category %}
<span class="badge ai-score-badge">
{{ candidate.professional_category }}
</span>
{% endif %}
</td>
<td>
{% if candidate.top_3_keywords %}
<div class="d-flex flex-wrap gap-2">
{% for skill in candidate.top_3_keywords %}
<span class="badge ai-score-badge" style="font-size: smaller;">
{{ skill }}
</span>
{% endfor %}
</div>
{% endif %}
</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 'candidate_criteria_view_htmx' candidate.pk %}"
hx-target="#candidateviewModalBody"
title="View Candidate Profile and Criteria">
<i class="fas fa-eye"></i>
</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 match the current stage and filter criteria." %}
</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 Criteria Review" %}
</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 {
selectAllCheckbox.checked = false;
selectAllCheckbox.indeterminate = true;
}
}
// 1. Logic for the 'Select All' checkbox (Clicking it updates all rows)
selectAllCheckbox.addEventListener('change', function () {
const isChecked = selectAllCheckbox.checked;
rowCheckboxes.forEach(checkbox => checkbox.removeEventListener('change', updateSelectAllState));
rowCheckboxes.forEach(function (checkbox) {
checkbox.checked = isChecked;
checkbox.dispatchEvent(new Event('change', { bubbles: true }));
});
rowCheckboxes.forEach(checkbox => checkbox.addEventListener('change', updateSelectAllState));
updateSelectAllState();
});
// 2. Logic to update 'Select All' state based on row checkboxes
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 %}