kaauh_ats/templates/interviews/preview_schedule.html
2025-11-13 14:05:59 +03:00

154 lines
6.4 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block content %}
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 page-header">
<i class="fas fa-calendar-check me-2"></i> Interview Schedule Preview for {{ job.title }}
</h1>
</div>
<div class="card mt-4 shadow-sm">
<div class="card-body">
<h5 class="card-title pb-2 border-bottom">Schedule Details</h5>
<div class="row">
<div class="col-md-6">
<p><strong>Period:</strong> {{ start_date|date:"F j, Y" }} to {{ end_date|date:"F j, Y" }}</p>
<p>
<strong>Working Days:</strong>
{% for day_id in working_days %}
{% if day_id == 0 %}Monday{% endif %}
{% if day_id == 1 %}Tuesday{% endif %}
{% if day_id == 2 %}Wednesday{% endif %}
{% if day_id == 3 %}Thursday{% endif %}
{% if day_id == 4 %}Friday{% endif %}
{% if day_id == 5 %}Saturday{% endif %}
{% if day_id == 6 %}Sunday{% endif %}
{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>
<p><strong>Working Hours:</strong> {{ start_time|time:"g:i A" }} to {{ end_time|time:"g:i A" }}</p>
<p><strong>Interview Duration:</strong> {{ interview_duration }} minutes</p>
<p><strong>Buffer Time:</strong> {{ buffer_time }} minutes</p>
</div>
<div class="col-md-6">
<p class="mb-2"><strong>Daily Break Times:</strong></p>
{% if breaks %}
<!-- New structured display for breaks -->
<div class="d-flex flex-column gap-1 mb-3 p-3 border rounded bg-light">
{% for break in breaks %}
<small class="text-dark">
<i class="far fa-clock me-1 text-muted"></i>
{{ break.start_time|time:"g:i A" }} &mdash; {{ break.end_time|time:"g:i A" }}
</small>
{% endfor %}
</div>
{% else %}
<p class="mb-3"><small class="text-muted">No daily breaks scheduled.</small></p>
{% endif %}
</div>
</div>
</div>
</div>
<div class="card mt-4 shadow-sm">
<div class="card-body">
<h5 class="card-title pb-2 border-bottom">Scheduled Interviews</h5>
<!-- Calendar View -->
<div id="calendar-container">
<div id="calendar"></div>
</div>
<!-- List View -->
<div class="table-responsive mt-4">
<table class="table table-striped">
<thead>
<tr>
<th>Date</th>
<th>Time</th>
<th>Candidate</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{% for item in schedule %}
<tr>
<td>{{ item.date|date:"F j, Y" }}</td>
<td>{{ item.time|time:"g:i A" }}</td>
<td>{{ item.applications.name }}</td>
<td>{{ item.applications.email }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<form method="post" action="{% url 'confirm_schedule_interviews_view' slug=job.slug %}" class="mt-4">
{% csrf_token %}
<button type="submit" name="confirm_schedule" class="btn btn-success">
<i class="fas fa-check"></i> Confirm Schedule
</button>
<a href="{% url 'schedule_interviews' slug=job.slug %}" class="btn btn-secondary">
<i class="fas fa-arrow-left"></i> Back to Edit
</a>
</form>
</div>
</div>
</div>
<!-- Include FullCalendar CSS and JS -->
<link href="https://cdn.jsdelivr.net/npm/fullcalendar@5.10.1/main.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@5.10.1/main.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'dayGridMonth',
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek'
},
events: [
{% for item in schedule %}
{
title: '{{ item.candidate.name }}',
start: '{{ item.date|date:"Y-m-d" }}T{{ item.time|time:"H:i:s" }}',
url: '#',
extendedProps: {
email: '{{ item.candidate.email }}',
time: '{{ item.time|time:"g:i A" }}'
}
},
{% endfor %}
{% for break in breaks %}
{
title: 'Break',
start: '{{ start_date|date:"Y-m-d" }}T{{ break.start_time|time:"H:i:s" }}',
end: '{{ start_date|date:"Y-m-d" }}T{{ break.end_time|time:"H:i:s" }}',
color: '#ff9f89',
display: 'background'
},
{% endfor %}
],
eventClick: function(info) {
// Show candidate details in a modal or alert
if (info.event.title !== 'Break') {
// IMPORTANT: Since alert() is forbidden, using console log as a fallback.
// In a production environment, this would be a custom modal dialog.
console.log('Candidate: ' + info.event.title +
'\nDate: ' + info.event.start.toLocaleDateString() +
'\nTime: ' + info.event.extendedProps.time +
'\nEmail: ' + info.event.extendedProps.email);
}
info.jsEvent.preventDefault();
}
});
calendar.render();
});
</script>
{% endblock %}