HealthGuard-AI / templates /admin /appointments.html
kalyan9's picture
Upload 35 files
9876bd8 verified
Raw History Blame Contribute Delete
11.9 kB
{% extends "base.html" %}
{% block title %}Manage Appointments - Admin Dashboard{% endblock %}
{% block content %}
<div class="row">
<div class="col-12">
<h2><i class="bi bi-calendar-check"></i> Manage Appointments</h2>
<p class="lead">Review and manage patient appointments</p>
</div>
</div>
<div class="row mt-4">
<div class="col-12">
<ul class="nav nav-tabs" id="appointmentTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="pending-tab" data-bs-toggle="tab" data-bs-target="#pending" type="button" role="tab">Pending Appointments</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="confirmed-tab" data-bs-toggle="tab" data-bs-target="#confirmed" type="button" role="tab">Confirmed Appointments</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="schedule-tab" data-bs-toggle="tab" data-bs-target="#schedule" type="button" role="tab">My Schedule</button>
</li>
</ul>
<div class="tab-content" id="appointmentTabsContent">
<div class="tab-pane fade show active" id="pending" role="tabpanel">
<div class="card mt-3">
<div class="card-header">
<h5 class="card-title mb-0">Pending Appointments</h5>
</div>
<div class="card-body">
{% if pending_appointments %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Patient</th>
<th>Disease/Condition</th>
<th>Doctor</th>
<th>Date & Time</th>
<th>Notes</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for appointment in pending_appointments %}
<tr>
<td>
{{ appointment.patient_name }}<br>
<small class="text-muted">{{ appointment.patient_email }}</small>
</td>
<td>{{ appointment.disease_type }}</td>
<td>{{ appointment.doctor }}</td>
<td>{{ appointment.date.strftime('%Y-%m-%d') }} at {{ appointment.time }}</td>
<td>{{ appointment.notes }}</td>
<td>
<form method="POST" action="/admin/appointments/{{ appointment._id }}/confirm" class="d-inline">
<button type="submit" class="btn btn-sm btn-success">
<i class="bi bi-check-circle"></i> Confirm
</button>
</form>
<form method="POST" action="/admin/appointments/{{ appointment._id }}/reject" class="d-inline">
<button type="submit" class="btn btn-sm btn-danger">
<i class="bi bi-x-circle"></i> Reject
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-muted">No pending appointments found.</p>
{% endif %}
</div>
</div>
</div>
<div class="tab-pane fade" id="confirmed" role="tabpanel">
<div class="card mt-3">
<div class="card-header">
<h5 class="card-title mb-0">Confirmed Appointments</h5>
</div>
<div class="card-body">
{% if confirmed_appointments %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Patient</th>
<th>Disease/Condition</th>
<th>Doctor</th>
<th>Date & Time</th>
<th>Notes</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for appointment in confirmed_appointments %}
<tr>
<td>
{{ appointment.patient_name }}<br>
<small class="text-muted">{{ appointment.patient_email }}</small>
</td>
<td>{{ appointment.disease_type }}</td>
<td>{{ appointment.doctor }}</td>
<td>{{ appointment.date.strftime('%Y-%m-%d') }} at {{ appointment.time }}</td>
<td>{{ appointment.notes }}</td>
<td>
<span class="badge bg-success">Confirmed</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-muted">No confirmed appointments found.</p>
{% endif %}
</div>
</div>
</div>
<div class="tab-pane fade" id="schedule" role="tabpanel">
<div class="card mt-3">
<div class="card-header">
<h5 class="card-title mb-0">My Schedule</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-8">
<div id="calendar"></div>
</div>
<div class="col-md-4">
<h5>Available Time Slots</h5>
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h6 class="mb-1">Morning Slots</h6>
</div>
<small>9:00 AM - 12:00 PM</small>
</a>
<a href="#" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h6 class="mb-1">Afternoon Slots</h6>
</div>
<small>2:00 PM - 5:00 PM</small>
</a>
<a href="#" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h6 class="mb-1">Evening Slots</h6>
</div>
<small>6:00 PM - 8:00 PM</small>
</a>
</div>
<div class="mt-4">
<h5>Quick Actions</h5>
<button class="btn btn-primary w-100 mb-2">
<i class="bi bi-plus-circle"></i> Add Time Slot
</button>
<button class="btn btn-outline-secondary w-100">
<i class="bi bi-calendar"></i> Set Availability
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script>
document.addEventListener('DOMContentLoaded', function() {
// Simple calendar implementation
const calendarEl = document.getElementById('calendar');
if (calendarEl) {
const today = new Date();
const month = today.toLocaleString('default', { month: 'long' });
const year = today.getFullYear();
let calendarHTML = `<h5>${month} ${year}</h5>`;
calendarHTML += '<div class="table-responsive">';
calendarHTML += '<table class="table table-bordered">';
calendarHTML += '<thead><tr><th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr></thead>';
calendarHTML += '<tbody>';
// Generate calendar (simplified)
const daysInMonth = new Date(year, today.getMonth() + 1, 0).getDate();
const firstDay = new Date(year, today.getMonth(), 1).getDay();
let day = 1;
for (let i = 0; i < 6; i++) {
calendarHTML += '<tr>';
for (let j = 0; j < 7; j++) {
if (i === 0 && j < firstDay) {
calendarHTML += '<td></td>';
} else if (day > daysInMonth) {
calendarHTML += '<td></td>';
} else {
const isToday = (day === today.getDate());
calendarHTML += `<td class="${isToday ? 'table-primary' : ''}">${day}</td>`;
day++;
}
}
calendarHTML += '</tr>';
if (day > daysInMonth) break;
}
calendarHTML += '</tbody></table></div>';
calendarEl.innerHTML = calendarHTML;
}
});
</script>
{% endblock %}