kaauh_ats/templates/recruitment/candidate_interview_view.html
2025-10-14 14:03:01 +03:00

386 lines
14 KiB
HTML

{% extends 'base.html' %}
{% load static i18n %}
{% block title %}Candidate Tier Management - {{ job.title }} - ATS{% endblock %}
{% block customCSS %}
<style>
/* Minimal Tier Management Styles */
.tier-controls {
background-color: #f8f9fa;
padding: 1rem;
border-radius: 0.375rem;
margin-bottom: 1.5rem;
}
.tier-controls .form-row {
display: flex;
align-items: end;
gap: 0.75rem;
}
.tier-controls .form-group {
flex: 1;
margin-bottom: 0;
}
.bulk-update-controls {
background-color: #f8f9fa;
padding: 1rem;
border-radius: 0.375rem;
margin-bottom: 1.5rem;
}
.stage-groups {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
}
.stage-group {
border: 1px solid #dee2e6;
border-radius: 0.375rem;
overflow: hidden;
}
.stage-group .stage-header {
background-color: #495057;
color: white;
padding: 0.5rem 0.75rem;
font-weight: 500;
font-size: 0.95rem;
}
.stage-group .stage-body {
padding: 0.75rem;
min-height: 80px;
}
.stage-candidate {
padding: 0.375rem;
border-bottom: 1px solid #f1f3f4;
}
.stage-candidate:last-child {
border-bottom: none;
}
.match-score {
font-weight: 600;
color: #0056b3;
}
.btn-sm {
font-size: 0.75rem;
padding: 0.2rem 0.4rem;
}
/* Tab Styles for Tiers */
.nav-tabs {
border-bottom: 1px solid #dee2e6;
margin-bottom: 1rem;
}
.nav-tabs .nav-link {
border: none;
color: #495057;
font-weight: 500;
padding: 0.5rem 1rem;
transition: all 0.2s;
}
.nav-tabs .nav-link:hover {
border: none;
background-color: #f8f9fa;
}
.nav-tabs .nav-link.active {
color: #495057;
background-color: #fff;
border: none;
border-bottom: 2px solid #007bff;
font-weight: 600;
}
.tier-1 .nav-link {
color: #155724;
}
.tier-1 .nav-link.active {
border-bottom-color: #28a745;
}
.tier-2 .nav-link {
color: #856404;
}
.tier-2 .nav-link.active {
border-bottom-color: #ffc107;
}
.tier-3 .nav-link {
color: #721c24;
}
.tier-3 .nav-link.active {
border-bottom-color: #dc3545;
}
/* Candidate Table Styles */
.candidate-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background-color: white;
border-radius: 0.375rem;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.candidate-table thead {
background-color: #f8f9fa;
}
.candidate-table th {
padding: 0.75rem;
text-align: left;
font-weight: 600;
font-size: 0.875rem;
color: #495057;
border-bottom: 1px solid #dee2e6;
}
.candidate-table td {
padding: 0.75rem;
border-bottom: 1px solid #f1f3f4;
vertical-align: middle;
}
.candidate-table tbody tr:hover {
background-color: #f8f9fa;
}
.candidate-table tbody tr:last-child td {
border-bottom: none;
}
.candidate-name {
font-weight: 600;
font-size: 0.95rem;
}
.candidate-details {
font-size: 0.8rem;
color: #6c757d;
}
.candidate-table-responsive {
overflow-x: auto;
margin-bottom: 1rem;
}
.stage-badge {
padding: 0.125rem 0.5rem;
border-radius: 0.5rem;
font-size: 0.7rem;
font-weight: 600;
margin-left: 0.375rem;
}
.stage-Applied {
background-color: #e9ecef;
color: #495057;
}
.stage-Exam {
background-color: #cce5ff;
color: #004085;
}
.stage-Interview {
background-color: #d1ecf1;
color: #0c5460;
}
.stage-Offer {
background-color: #d4edda;
color: #155724;
}
.exam-controls {
display: flex;
align-items: center;
gap: 0.375rem;
margin-top: 0.375rem;
}
.exam-controls select,
.exam-controls input {
font-size: 0.75rem;
padding: 0.125rem 0.25rem;
}
.tier-badge {
font-size: 0.7rem;
padding: 0.125rem 0.375rem;
border-radius: 0.25rem;
background-color: rgba(0,0,0,0.1);
color: #495057;
margin-left: 0.375rem;
}
</style>
{% endblock %}
{% block content %}
<div class="container py-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h1 class="h3 mb-1">
<i class="fas fa-layer-group me-2"></i>
{% trans "Interview" %} - {{ job.title }}
</h1>
</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>
<!-- Tier Display -->
<h2 class="h4 mb-3 mt-5">{% trans "Candidate Tiers" %}</h2>
<div class="candidate-table-responsive" data-signals__ifmissing="{_fetching: false, selections: Array({{ candidates|length }}).fill(false)}">
{% url "schedule_interviews" job.slug as bulk_update_candidate_exam_status_url %}
{% if candidates %}
<button class="btn btn-primary"
data-bs-toggle="modal"
data-bs-target="#candidateviewModal"
data-attr="{disabled: !$selections.filter(Boolean).length}"
hx-get="{{bulk_update_candidate_exam_status_url}}"
hx-target="#candidateviewModalBody"
hx-include="#myform"
hx-select=".interview-schedule"
>Mark as Pass and move to Interview</button>
<button class="btn btn-danger"
data-attr="{disabled: !$selections.filter(Boolean).length}"
data-on-click="@post('{{bulk_update_candidate_exam_status_url}}',{
contentType: 'form',
selector: '#myform',
headers: {'X-CSRFToken': '{{ csrf_token }}','status': 'fail'}
})"
>Mark as Failed</button>
{% endif %}
<form id="myform" action="{{bulk_update_candidate_exam_status_url}}" method="post">
<table class="candidate-table">
<thead>
<tr>
<th>
{% if candidates %}
<div class="form-check">
<input
data-bind-_all
data-on-change="$selections = Array({{ candidates|length }}).fill($_all)"
data-effect="$selections; $_all = $selections.every(Boolean)"
data-attr-disabled="$_fetching"
type="checkbox" class="form-check-input" id="candidate-{{ candidate.id }}">
</div>
{% endif %}
</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Contact" %}</th>
<th>{% trans "Interview Date" %}</th>
<th>{% trans "Interview Link" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for candidate in candidates %}
<tr>
<td>
<div class="form-check">
<input
data-bind-selections
data-attr-disabled="$_fetching"
name="{{ candidate.id }}"
type="checkbox" class="form-check-input" id="candidate-{{ candidate.id }}">
</div>
</td>
<td>
<div class="candidate-name">{{ candidate.name }}</div>
</td>
<td>
<div class="candidate-details">
Email: {{ candidate.email }}<br>
Phone: {{ candidate.phone }}<br>
</div>
</td>
<td>{{candidate.get_latest_meeting.start_time|date:"m-d-Y h:i A"}}</td>
<td><a href="{{candidate.get_latest_meeting.join_url}}">{% include "icons/link.html" %}</a></td>
<td>
<a href="{% url 'schedule_meeting_for_candidate' job.slug candidate.pk %}" class="btn btn-primary btn-sm me-1" title="{% trans 'Schedule Interview' %}">
<i class="fas fa-calendar-plus"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</form>
</div>
<!-- Tab Content -->
<div class="modal fade modal-xl" id="candidateviewModal" tabindex="-1" aria-labelledby="candidateviewModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="candidateviewModalLabel">Form Settings</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="candidateviewModalBody" class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<!-- Main Meeting Schedule/Reschedule Modal -->
<div class="modal fade" id="meetingModal" tabindex="-1" aria-labelledby="meetingModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="meetingModalLabel">
{% trans "Schedule Interview" %} <!-- Default title -->
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="meetingModalBody" class="modal-body">
<!-- HTMX will load the form here -->
<p class="text-center text-muted">{% trans "Loading form..." %}</p>
</div>
<div class="modal-footer">
<!-- HTMX might update the button text or add specific actions here if needed -->
<!-- For now, the form itself has its own submit and cancel buttons -->
<!-- The cancel button inside the form will close the modal -->
</div>
</div>
</div>
</div>
{% block customJS %}
<script>
document.addEventListener('DOMContentLoaded', function() {
const meetingModalElement = document.getElementById('meetingModal');
const meetingModalTitle = meetingModalElement.querySelector('#meetingModalLabel');
// The submit button is now inside the form snippet loaded by HTMX.
// We will pass title info via data-* attributes or rely on the snippet's initial rendering.
// Add event listeners to buttons that trigger this modal
// Using event delegation for dynamically added buttons
document.addEventListener('click', function(event) {
const button = event.target.closest('button[data-bs-toggle="modal"][data-bs-target="#meetingModal"]');
if (button) {
event.preventDefault(); // Prevent default if button has an href or type="submit"
const modalTitle = button.getAttribute('data-modal-title');
const modalSubmitText = button.getAttribute('data-modal-submit-text');
if (meetingModalTitle) {
meetingModalTitle.textContent = modalTitle || "{% trans 'Schedule Interview' %}";
}
// The submit button text is now handled by the meeting_form.html snippet itself,
// based on whether 'scheduled_interview' context is passed.
// Show the modal first, then HTMX will load the content into #meetingModalBody
const modal = new bootstrap.Modal(meetingModalElement);
modal.show();
// HTMX attributes (hx-get, hx-target, hx-swap) on the button will trigger the fetch
// after the modal is shown. HTMX handles this automatically.
}
});
// Optional: Clear HTMX target content if modal is hidden without submission
meetingModalElement.addEventListener('hidden.bs.modal', function () {
const modalBody = meetingModalElement.querySelector('#meetingModalBody');
if (modalBody) {
// Reset to a loading message or clear, so next open fetches fresh
modalBody.innerHTML = '<p class="text-center text-muted">{% trans "Loading form..." %}</p>';
}
});
});
// The old JS functions (loadScheduleMeetingForm, loadRescheduleMeetingForm) are no longer needed
// as HTMX handles fetching the form. They can be removed if not used elsewhere.
</script>
{% endblock %}
{% endblock %}