kaauh_ats/templates/interviews/interview_list.html

466 lines
21 KiB
HTML

{% extends 'base.html' %}
{% load static i18n %}
{% block title %}{% trans "Interviews" %} - 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;
--kaauh-gray-light: #f8f9fa; /* Added for consistency */
}
/* Primary Color Overrides */
.text-primary-theme { color: var(--kaauh-teal) !important; }
.bg-primary-theme { background-color: var(--kaauh-teal) !important; }
/* 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;
}
/* Filter Controls */
.filter-controls {
border-radius: 0.75rem;
padding: 1.5rem;
margin-bottom: 2rem;
border: 1px solid var(--kaauh-border);
}
/* Button Styling */
.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);
}
/* Interview Table Styling */
.interview-table {
table-layout: fixed;
width: 100%;
border-collapse: separate;
border-spacing: 0;
background-color: white;
border-radius: 0.5rem;
overflow: hidden;
}
.interview-table thead {
background-color: var(--kaauh-border);
}
.interview-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;
}
.interview-table td {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--kaauh-border);
vertical-align: middle;
font-size: 0.9rem;
}
.interview-table tbody tr:hover {
background-color: #f1f3f4;
}
/* Column Widths */
.interview-table thead th:nth-child(1) { width: 18%; }
.interview-table thead th:nth-child(2) { width: 15%; }
.interview-table thead th:nth-child(3) { width: 15%; }
.interview-table thead th:nth-child(4) { width: 10%; }
.interview-table thead th:nth-child(5) { width: 10%; }
.interview-table thead th:nth-child(6) { width: 10%; }
/* Candidate and Job Info */
.candidate-name {
font-weight: 600;
color: var(--kaauh-primary-text);
}
.candidate-details {
font-size: 0.8rem;
color: #6c757d;
}
.job-title {
font-weight: 500;
color: var(--kaauh-teal-dark);
}
/* Badges and Statuses */
.status-badge {
font-size: 0.75rem;
padding: 0.3em 0.7em;
border-radius: 0.35rem;
font-weight: 700;
}
.interview-type-badge {
font-size: 0.7rem;
padding: 0.25rem 0.5rem;
border-radius: 0.3rem;
font-weight: 600;
}
/* Custom Height Optimization */
.form-control-sm,
.btn-sm {
padding-top: 0.2rem !important;
padding-bottom: 0.2rem !important;
height: 28px !important;
font-size: 0.8rem !important;
}
</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" %}
</h1>
<h2 class="h5 text-muted mb-0">
{# Using count() instead of length filter if interviews is the Paginator Page Object #}
{% trans "Total Interviews:" %} <span class="fw-bold">{{ interviews.paginator.count }}</span>
</h2>
</div>
<div class="d-flex gap-2">
<a href="{% url 'dashboard' %}" class="btn btn-outline-secondary">
<i class="fas fa-arrow-left me-1"></i> {% trans "Back to Dashboard" %}
</a>
</div>
</div>
<div class="card mb-4 shadow-sm no-hover">
<div class="card-body">
<div class="row g-4">
<div class="col-md-4">
<label for="search" class="form-label small text-muted">{% trans "Search by Name or Email" %}</label>
<div class="input-group input-group-lg mb-3">
<form method="get" action="" class="w-100">
{% include 'includes/search_form.html' %}
</form>
</div>
</div>
<div class="col-md-8">
<form method="GET" class="row g-2 align-items-end h-100">
{# Keep search query context when filtering #}
{% if request.GET.search %}<input type="hidden" name="search" value="{{ request.GET.search }}">{% endif %}
<div class="col-md-4">
<label for="job_filter" class="form-label small text-muted">{% trans "Filter by Job" %}</label>
<select name="job" id="job_filter" class="form-select form-select-sm">
<option value="">{% trans "All Jobs" %}</option>
{% for job in jobs %}
<option value="{{ job.slug }}" {% if request.GET.job == job.slug %}selected{% endif %}>{{ job.title }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<label for="status_filter" class="form-label small text-muted">{% trans "Status" %}</label>
<select name="status" id="status_filter" class="form-select form-select-sm">
<option value="">{% trans "All" %}</option>
<option value="scheduled" {% if request.GET.status == "scheduled" %}selected{% endif %}>{% trans "Scheduled" %}</option>
<option value="confirmed" {% if request.GET.status == "confirmed" %}selected{% endif %}>{% trans "Confirmed" %}</option>
<option value="cancelled" {% if request.GET.status == "cancelled" %}selected{% endif %}>{% trans "Cancelled" %}</option>
<option value="completed" {% if request.GET.status == "completed" %}selected{% endif %}>{% trans "Completed" %}</option>
</select>
</div>
<div class="col-md-2">
<label for="type_filter" class="form-label small text-muted">{% trans "Type" %}</label>
<select name="type" id="type_filter" class="form-select form-select-sm">
<option value="">{% trans "All" %}</option>
<option value="Remote" {% if request.GET.type == "Remote" %}selected{% endif %}>{% trans "Remote" %}</option>
<option value="Onsite" {% if request.GET.type == "Onsite" %}selected{% endif %}>{% trans "Onsite" %}</option>
</select>
</div>
<div class="col-md-3">
<div class="d-flex gap-1">
<button type="submit" class="btn btn-main-action btn-sm flex-grow-1 text-nowrap">
<i class="fas fa-filter me-1"></i> {% trans "Apply Filters" %}
</button>
{% if request.GET.search or request.GET.job or request.GET.status or request.GET.type %}
<a href="{% url 'interview_list' %}" class="btn btn-outline-secondary btn-sm" title="{% trans 'Clear Filter' %}">
<i class="fas fa-times me-1"></i>{% trans 'Clear Filter' %}
</a>
{% endif %}
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% if interviews %}
<div id="interview-list">
{# View Switcher (kept the name for simplicity) #}
{% include "includes/_list_view_switcher.html" with list_id="interview-list" %}
{# Table View #}
<div class="table-view active d-none d-lg-block">
<div class="table-responsive">
<table class="table interview-table table-hover align-middle mb-0">
<thead>
<tr>
<th>{% trans "Candidate" %}</th>
<th>{% trans "Job" %}</th>
<th>{% trans "Date & Time" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Status" %}</th>
<th class="text-end">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for interview in interviews %}
<tr>
<td>
<div class="candidate-name">{{ interview.application.name }}</div>
<div class="application-details">
<i class="fas fa-envelope me-1"></i> {{ interview.application.email }}<br>
<i class="fas fa-phone me-1"></i> {{ interview.application.phone }}
</div>
</td>
<td>
<div class="job-title">{{ interview.job.title }}</div>
<div class="candidate-details">{{ interview.job.department }}</div>
</td>
<td>
<div class="candidate-details">
<i class="fas fa-calendar-day me-1"></i> {{ interview.interview_date|date:"d-m-Y" }}<br>
<i class="fas fa-clock me-1"></i> {{ interview.interview_time|date:"h:i A" }}
</div>
</td>
<td>
{# Assuming interview.interview.location_type is meant to be interview.location_type #}
{% if interview.interview.location_type == 'Remote' %}
<span class="badge interview-type-badge bg-primary-theme">
<i class="fas fa-video me-1"></i> {% trans "Remote" %}
</span>
{% else %}
<span class="badge interview-type-badge bg-primary-theme">
<i class="fas fa-building me-1"></i> {% trans "Onsite" %}
</span>
{% endif %}
</td>
<td>
<span class="badge bg-primary-theme">
{{ interview.status|upper }}
</span>
</td>
<td class="text-end">
<a href="{% url 'interview_detail' interview.slug %}"
class="btn btn-outline-secondary btn-sm"
title="{% trans 'View Details' %}">
<i class="fas fa-eye"></i>
</a>
{# Actions for Reschedule/Cancel (Commented out in original, kept commented) #}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{# Card View (Mobile/Tablet) #}
<div class="card-view row g-4 d-lg-none">
{% for interview in interviews %}
<div class="col-md-6 col-sm-12">
<div class="card kaauh-card h-100 shadow-sm">
<div class="card-body d-flex flex-column">
<div class="d-flex justify-content-between align-items-start mb-2">
<h5 class="card-title flex-grow-1 me-3">
<a href="{% url 'interview_detail' interview.slug %}" class="text-decoration-none text-primary-theme">{{ interview.application.name }}</a>
</h5>
<span class="status-badge bg-primary-theme text-white">
{{ interview.status|title }}
</span>
</div>
<p class="card-text text-muted small mb-3">
<i class="fas fa-briefcase"></i> {% trans "Job" %}:
<a class="text-secondary text-decoration-none" href="{% url 'job_detail' interview.job.slug %}">{{ interview.job.title }}</a><br>
<i class="fas fa-calendar-day"></i> {% trans "Date" %}: {{ interview.interview_date|date:"M d, Y" }}<br>
<i class="fas fa-clock"></i> {% trans "Time" %}: {{ interview.interview_time|time:"H:i A" }}<br>
{# --- Type/Location --- #}
<i class="fas {% if interview.interview.location_type == 'Remote' %}fa-globe{% else %}fa-map-marker-alt{% endif %}"></i>
{% trans "Type" %}: {{ interview.interview.location_type }}
{% comment %} {% if interview.interview.location_type == 'Remote' %}<br>
{# Using interview.join_url directly if available, assuming interview is the full object #}
<i class="fas fa-link"></i> {% trans "Link" %}: {% if interview.interview.join_url %}<a href="{{ interview.interview.join_url }}" target="_blank">Join Meeting</a>{% else %}N/A{% endif %}
{% else %}<br>
<i class="fas fa-building"></i> {% trans "Location" %}: {{ interview.interview.location_details|default:"Onsite" }}
{% endif %} {% endcomment %}
</p>
<div class="mt-auto pt-2 border-top">
<div class="d-flex gap-2">
<a href="{% url 'interview_detail' interview.slug %}" class="btn btn-sm btn-main-action">
<i class="fas fa-eye"></i> {% trans "View" %}
</a>
{# Join button logic simplified #}
{% if interview.interview.location_type == 'Remote' and interview.interview.join_url %}
<a href="{{ interview.interview.join_url }}" target="_blank" class="btn btn-sm btn-outline-secondary">
<i class="fas fa-link"></i> {% trans "Join" %}
</a>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{# FIX: Added the missing pagination include here #}
{% include "includes/paginator.html" %}
{% else %}
<div class="text-center py-5 kaauh-card">
<div class="card-body">
<i class="fas fa-calendar fa-4x text-muted" style="color: var(--kaauh-teal-dark) !important;"></i>
<h4 class="text-muted mt-3 mb-3">
{% if search_query or job_filter or request.GET.status or request.GET.type %}
{% trans "There are no interviews matching your filters." %}
{% else %}
{% trans "There are no interviews scheduled." %}
{% endif %}
</h4>
<p class="text-muted mb-4">
{% trans "Start by setting the interview stage for an application." %}
</p>
{# Add button if needed, otherwise rely on the header button #}
</div>
</div>
{% endif %}
</div>
<div class="modal fade" id="actionModal" tabindex="-1" aria-labelledby="actionModalLabel" 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="actionModalLabel" style="color: var(--kaauh-teal-dark);">
{% trans "Interview Action" %}
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="actionModalBody" class="modal-body">
<div class="text-center py-5 text-muted">
<i class="fas fa-spinner fa-spin fa-2x"></i><br>
{% trans "Loading..." %}
</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 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;
}
}
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();
});
rowCheckboxes.forEach(function (checkbox) {
checkbox.addEventListener('change', updateSelectAllState);
});
updateSelectAllState();
}
// Clear modal content when hidden
const actionModal = document.getElementById('actionModal');
actionModal.addEventListener('hidden.bs.modal', function () {
const modalBody = actionModal.querySelector('#actionModalBody');
if (modalBody) {
modalBody.innerHTML = `
<div class="text-center py-5 text-muted">
<i class="fas fa-spinner fa-spin fa-2x"></i><br>
{% trans "Loading..." %}
</div>
`;
}
});
});
</script>
{% endblock %}