624 lines
28 KiB
HTML
624 lines
28 KiB
HTML
{% extends 'base.html' %}
|
|
{% load static i18n %}
|
|
|
|
{% block title %}- {{ 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;
|
|
--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 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);
|
|
}
|
|
/* Style for the Bulk Move button */
|
|
.btn-bulk-action {
|
|
background-color: var(--kaauh-teal-dark);
|
|
border-color: var(--kaauh-teal-dark);
|
|
color: white;
|
|
font-weight: 500;
|
|
}
|
|
.btn-bulk-action:hover {
|
|
background-color: #00363e;
|
|
border-color: #00363e;
|
|
}
|
|
|
|
/* 3. Candidate Table Styling (Aligned with KAAT-S) */
|
|
.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 1rem;
|
|
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 1rem;
|
|
border-bottom: 1px solid var(--kaauh-border);
|
|
vertical-align: middle;
|
|
font-size: 0.9rem;
|
|
}
|
|
.candidate-table tbody tr:hover {
|
|
background-color: #f1f3f4;
|
|
}
|
|
.candidate-table thead th:nth-child(1) { width: 40px; }
|
|
.candidate-table thead th:nth-child(4) { width: 10%; }
|
|
.candidate-table thead th:nth-child(7) { width: 100px; }
|
|
|
|
.candidate-name {
|
|
font-weight: 600;
|
|
color: var(--kaauh-primary-text);
|
|
}
|
|
.candidate-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-candidate { 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;
|
|
}
|
|
|
|
/* --- 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" style="color: var(--kaauh-teal-dark); font-weight: 700;">
|
|
<i class="fas fa-calendar-alt me-2"></i>
|
|
{% trans "Interview Management" %} - {{ job.title }}
|
|
</h1>
|
|
<h2 class="h5 text-muted mb-0">
|
|
{% trans "Candidates in Interview Stage:" %} <span class="fw-bold">{{ candidates|length }}</span>
|
|
</h2>
|
|
</div>
|
|
<div class="d-flex gap-2">
|
|
<a href="{% url 'export_candidates_csv' job.slug 'interview' %}"
|
|
class="btn btn-outline-secondary"
|
|
title="{% trans 'Export interview candidates to CSV' %}">
|
|
<i class="fas fa-download me-1"></i> {% trans "Export CSV" %}
|
|
</a>
|
|
<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">
|
|
{% include 'jobs/partials/applicant_tracking.html' %}
|
|
</div>
|
|
|
|
<div class="kaauh-card shadow-sm p-3">
|
|
{% if candidates %}
|
|
<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="#candidate-form" action="{% url 'candidate_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="Offer">
|
|
{% trans "To Offer" %}
|
|
</option>
|
|
<option value="Exam">
|
|
{% trans "To Exam" %}
|
|
</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>
|
|
|
|
{# Form 2: Schedule Interviews #}
|
|
<form hx-boost="true" hx-include="#candidate-form" action="{% url 'schedule_interviews' job.slug %}" method="get" class="action-group">
|
|
<button type="submit" class="btn btn-main-action btn-sm">
|
|
<i class="fas fa-calendar-plus me-1"></i> {% trans "Schedule Interviews" %}
|
|
</button>
|
|
</form>
|
|
<div class="vr" style="height: 28px;"></div>
|
|
|
|
|
|
<button type="button" class="btn btn-outline-info btn-sm"
|
|
data-bs-toggle="modal"
|
|
hx-boost='true'
|
|
data-bs-target="#emailModal"
|
|
hx-get="{% url 'compose_candidate_email' job.slug %}"
|
|
hx-target="#emailModalBody"
|
|
hx-include="#candidate-form"
|
|
title="Email Participants">
|
|
<i class="fas fa-envelope"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
<div class="table-responsive">
|
|
<form id="candidate-form" action="{% url 'candidate_update_status' job.slug %}" method="get">
|
|
{% csrf_token %}
|
|
<table class="table candidate-table align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 2%">
|
|
{% if candidates %}
|
|
<div class="form-check">
|
|
<input
|
|
type="checkbox" class="form-check-input" id="selectAllCheckbox">
|
|
</div>
|
|
{% endif %}
|
|
</th>
|
|
<th style="width: 13%"><i class="fas fa-user me-1"></i> {% trans "Name" %}</th>
|
|
<th style="width: 15%"><i class="fas fa-phone me-1"></i> {% trans "Contact" %}</th>
|
|
<th style="width: 15%"><i class="fas fa-tag me-1"></i> {% trans "Topic" %}</th>
|
|
<th style="width: 15%"><i class="fas fa-clock me-1"></i> {% trans "Duration" %}</th>
|
|
<th style="width: 10%"><i class="fas fa-calendar me-1"></i> {% trans "Meeting Date" %}</th>
|
|
<th style="width: 7%"><i class="fas fa-video me-1"></i> {% trans "Link" %}</th>
|
|
<th style="width: 8%"><i class="fas fa-check-circle me-1"></i> {% trans "Meeting Status" %}</th>
|
|
<th style="width: 5%"><i class="fas fa-check-circle me-1"></i> {% trans "Interview Result"%}</th>
|
|
<th style="width: 10%"><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>
|
|
<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">
|
|
{{ candidate.name }}<i class="fas fa-eye ms-1"></i>
|
|
</button>
|
|
{% comment %} <div class="candidate-name">
|
|
{{ candidate.name }}
|
|
</div> {% endcomment %}
|
|
</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="candidate-details text-muted">
|
|
{% if candidate.get_latest_meeting %}
|
|
{{ candidate.get_latest_meeting }}
|
|
{% else %}
|
|
--
|
|
{% endif %}
|
|
</td>
|
|
<td class="candidate-details text-muted"><div class="d-block">
|
|
{% if candidate.get_latest_meeting.duration %}
|
|
{{ candidate.get_latest_meeting.duration }} {% trans _("Minutes") %}
|
|
{% else %}
|
|
--
|
|
{% endif %}
|
|
</div></td>
|
|
<td class="candidate-details text-muted">
|
|
{% with latest_meeting=candidate.get_latest_meeting %}
|
|
{% if latest_meeting %}
|
|
{{ latest_meeting.start_time|date:"d-m-Y h:i A" }}
|
|
{% else %}
|
|
<span class="text-muted">--</span>
|
|
{% endif %}
|
|
{% endwith %}
|
|
</td>
|
|
<td>
|
|
{% with latest_meeting=candidate.get_latest_meeting %}
|
|
{% if latest_meeting and latest_meeting.join_url %}
|
|
<a href="{{ latest_meeting.join_url }}" target="_blank" class="btn btn-sm bg-primary-theme text-white" title="Join Interview"
|
|
{% if latest_meeting.status == 'ended' %}disabled{% endif %}>
|
|
join
|
|
<i class="fas fa-video me-1"></i>
|
|
</a>
|
|
{% else %}
|
|
<span class="text-muted">--</span>
|
|
{% endif %}
|
|
{% endwith %}
|
|
</td>
|
|
<td>
|
|
{{ latest_meeting.status }}
|
|
{% with latest_meeting=candidate.get_latest_meeting %}
|
|
{% if latest_meeting %}
|
|
<span class="badge {% if latest_meeting.status == 'waiting' %}bg-warning{% elif latest_meeting.status == 'started' %}bg-success{% elif latest_meeting.status == 'ended' %}bg-danger{% endif %}">
|
|
{% if latest_meeting.status == 'started' %}
|
|
<i class="fas fa-circle me-1 text-success"></i>
|
|
{% endif %}
|
|
{{ latest_meeting.status|title }}
|
|
</span>
|
|
{% else %}
|
|
<span class="text-muted">--</span>
|
|
{% endif %}
|
|
{% endwith %}
|
|
</td>
|
|
<td class="text-center" id="interview-result-{{ candidate.pk }}">
|
|
{% if not candidate.interview_status %}
|
|
<button type="button" class="btn btn-warning btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'update_candidate_status' job.slug candidate.slug 'interview' 'passed' %}"
|
|
hx-target="#candidateviewModalBody"
|
|
title="Pass Exam">
|
|
<i class="fas fa-plus"></i>
|
|
</button>
|
|
{% else %}
|
|
{% if candidate.interview_status %}
|
|
<button type="button" class="btn btn-{% if candidate.interview_status == 'Passed' %}success{% else %}danger{% endif %} btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'update_candidate_status' job.slug candidate.slug 'interview' 'passed' %}"
|
|
hx-target="#candidateviewModalBody"
|
|
title="Pass Exam">
|
|
{{ candidate.interview_status }}
|
|
</button>
|
|
{% else %}
|
|
--
|
|
{% endif %}
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
|
|
{% if candidate.get_latest_meeting %}
|
|
{% if candidate.get_latest_meeting.location_type == 'Remote'%}
|
|
|
|
<button type="button" class="btn btn-outline-secondary btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'reschedule_meeting_for_candidate' job.slug candidate.pk candidate.get_latest_meeting.pk %}"
|
|
hx-target="#candidateviewModalBody"
|
|
title="Reschedule">
|
|
<i class="fas fa-redo-alt"></i>
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-outline-danger btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'delete_meeting_for_candidate' job.slug candidate.pk candidate.get_latest_meeting.pk %}"
|
|
hx-target="#candidateviewModalBody"
|
|
title="Delete Meeting">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
{% else%}
|
|
|
|
<button type="button" class="btn btn-outline-secondary btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'reschedule_onsite_meeting' job.slug candidate.pk candidate.get_latest_meeting.pk %}"
|
|
hx-target="#candidateviewModalBody"
|
|
title="Reschedule">
|
|
<i class="fas fa-redo-alt"></i>
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-outline-danger btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'delete_onsite_meeting_for_candidate' job.slug candidate.pk candidate.get_latest_meeting.pk %}"
|
|
hx-target="#candidateviewModalBody"
|
|
title="Delete Meeting">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
<button type="button" class="btn btn-main-action btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
hx-get="{% url 'schedule_meeting_for_candidate' job.slug candidate.pk %}"
|
|
hx-target="#candidateviewModalBody"
|
|
data-modal-title="{% trans 'Schedule Interview' %}"
|
|
title="Schedule Interview">
|
|
<i class="fas fa-video"></i>
|
|
</button>
|
|
<button type="button" class="btn btn-main-action btn-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#candidateviewModal"
|
|
{# UPDATED: Points to the specific Onsite scheduling URL #}
|
|
hx-get="{% url 'schedule_onsite_meeting_for_candidate' job.slug candidate.pk %}"
|
|
hx-target="#candidateviewModalBody"
|
|
data-modal-title="{% trans 'Schedule Onsite Interview' %}"
|
|
title="Schedule Onsite Interview">
|
|
<i class="fas fa-building"></i>
|
|
</button>
|
|
{% endif %}
|
|
|
|
</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 Interview stage for this job." %}
|
|
</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 "Candidate 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 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;
|
|
}
|
|
}
|
|
|
|
// 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;
|
|
|
|
// Dispatch event for the framework (data-bind-selections)
|
|
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();
|
|
}
|
|
});
|
|
|
|
// Handle Meeting Modal Opening (Rescheduling/Scheduling)
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Renamed to candidateviewModal as that's the ID in the template
|
|
const candidateviewModalElement = document.getElementById('candidateviewModal');
|
|
const candidateviewModalLabel = candidateviewModalElement.querySelector('#candidateviewModalLabel');
|
|
|
|
// Event listener for dynamic buttons using delegation
|
|
document.addEventListener('click', function(event) {
|
|
// Targetting buttons with hx-get that also targets the modal body
|
|
const button = event.target.closest('button[data-bs-toggle="modal"][data-bs-target="#candidateviewModal"]');
|
|
if (button) {
|
|
// Do NOT preventDefault here as hx-get needs to fire.
|
|
// hx-get will load the content into #candidateviewModalBody.
|
|
|
|
const modalTitle = button.getAttribute('data-modal-title');
|
|
|
|
// Update the modal title if a custom one is provided (used for scheduling)
|
|
if (modalTitle && candidateviewModalLabel) {
|
|
candidateviewModalLabel.textContent = modalTitle;
|
|
}
|
|
}
|
|
});
|
|
|
|
// Clear HTMX target content when modal is hidden
|
|
candidateviewModalElement.addEventListener('hidden.bs.modal', function () {
|
|
const modalBody = candidateviewModalElement.querySelector('#candidateviewModalBody');
|
|
if (modalBody) {
|
|
// Reset to the loading state message, matching the initial content
|
|
modalBody.innerHTML = `
|
|
<div class="text-center py-5 text-muted">
|
|
<i class="fas fa-spinner fa-spin fa-2x"></i><br>
|
|
{% trans "Loading content..." %}
|
|
</div>
|
|
`;
|
|
// Reset the modal title to its default state for next use
|
|
const defaultTitle = "{% trans "Candidate Details / Bulk Action Form" %}";
|
|
candidateviewModalLabel.textContent = defaultTitle;
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
$(document).ready(function() {
|
|
// Check the flag passed from the Django view
|
|
var shouldOpenModal = {{ show_modal_on_load|yesno:"true,false" }};
|
|
|
|
// If the view detected an invalid form submission (POST request), open the modal
|
|
if (shouldOpenModal) {
|
|
// Use the native Bootstrap 5 JS function to show the modal
|
|
var myModal = new bootstrap.Modal(document.getElementById('jobAssignmentModal'));
|
|
myModal.show();
|
|
}
|
|
});
|
|
|
|
</script>
|
|
{% endblock %}
|