hospital-management/templates/inpatients/surgery_schedule.html
2025-08-12 13:33:25 +03:00

225 lines
13 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block title %}Surgery Schedule - {{ block.super }}{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title mb-0">
<i class="fas fa-procedures me-2"></i>Surgery Schedule
</h4>
</div>
<div class="card-body">
<!-- Filters -->
<div class="row mb-3">
<div class="col-md-2">
<select name="date_filter" class="form-select">
<option value="">All Dates</option>
<option value="today">Today</option>
<option value="tomorrow">Tomorrow</option>
<option value="this_week">This Week</option>
</select>
</div>
<div class="col-md-2">
<select name="status" class="form-select">
<option value="">All Status</option>
{% for value, label in surgery_statuses %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<select name="surgery_type" class="form-select">
<option value="">All Types</option>
{% for value, label in surgery_types %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4">
<input type="text" name="search" class="form-control" placeholder="Search patients, procedures, surgeons...">
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-primary w-100">
<i class="fas fa-search"></i>
</button>
</div>
</div>
<!-- Surgery Schedule Table -->
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Date/Time</th>
<th>Patient</th>
<th>Procedure</th>
<th>Surgeon</th>
<th>Type</th>
<th>Duration</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for surgery in surgeries %}
<tr>
<td>
<strong>{{ surgery.scheduled_date|date:"M d, Y" }}</strong><br>
<small class="text-muted">{{ surgery.scheduled_start_time|time:"H:i" }}</small>
</td>
<td>
<strong>{{ surgery.patient.get_full_name }}</strong><br>
<small class="text-muted">
MRN: {{ surgery.patient.mrn }} •
{{ surgery.patient.age }}y {{ surgery.patient.get_gender_display }}
</small>
</td>
<td>
<strong>{{ surgery.procedure_name }}</strong>
{% if surgery.procedure_code %}
<br><small class="text-muted">Code: {{ surgery.procedure_code }}</small>
{% endif %}
</td>
<td>
<strong>{{ surgery.primary_surgeon.get_full_name }}</strong>
{% if surgery.anesthesiologist %}
<br><small class="text-muted">
Anesthesia: {{ surgery.anesthesiologist.get_full_name }}
</small>
{% endif %}
</td>
<td>{{ surgery.get_surgery_type_display }}</td>
<td>{{ surgery.estimated_duration_minutes }} min</td>
<td>
{% if surgery.status == 'SCHEDULED' %}
<span class="badge bg-warning">Scheduled</span>
{% elif surgery.status == 'CONFIRMED' %}
<span class="badge bg-info">Confirmed</span>
{% elif surgery.status == 'PREP' %}
<span class="badge bg-primary">Prep</span>
{% elif surgery.status == 'IN_PROGRESS' %}
<span class="badge bg-success">In Progress</span>
{% elif surgery.status == 'COMPLETED' %}
<span class="badge bg-success">Completed</span>
{% elif surgery.status == 'CANCELLED' %}
<span class="badge bg-danger">Cancelled</span>
{% elif surgery.status == 'POSTPONED' %}
<span class="badge bg-secondary">Postponed</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm">
{% if surgery.status == 'SCHEDULED' %}
<button class="btn btn-outline-success"
title="Confirm Surgery"
hx-post="{% url 'inpatients:confirm_surgery' surgery.id %}"
hx-confirm="Confirm this surgery?"
hx-swap="none">
<i class="fas fa-check"></i>
</button>
{% elif surgery.status == 'CONFIRMED' %}
<button class="btn btn-outline-primary"
title="Start Prep"
hx-post="{% url 'inpatients:start_surgery_prep' surgery.id %}"
hx-confirm="Start surgery prep?"
hx-swap="none">
<i class="fas fa-play"></i>
</button>
{% elif surgery.status == 'PREP' %}
<button class="btn btn-outline-success"
title="Start Surgery"
hx-post="{% url 'inpatients:start_surgery' surgery.id %}"
hx-confirm="Start surgery?"
hx-swap="none">
<i class="fas fa-procedures"></i>
</button>
{% elif surgery.status == 'IN_PROGRESS' %}
<button class="btn btn-outline-success"
title="Complete Surgery"
hx-post="{% url 'inpatients:complete_surgery' surgery.id %}"
hx-confirm="Complete surgery?"
hx-swap="none">
<i class="fas fa-check-circle"></i>
</button>
{% endif %}
<button class="btn btn-outline-info" title="View Details">
<i class="fas fa-eye"></i>
</button>
{% if surgery.status not in 'COMPLETED,CANCELLED' %}
<button class="btn btn-outline-warning"
title="Postpone"
hx-post="{% url 'inpatients:postpone_surgery' surgery.id %}"
hx-confirm="Postpone this surgery?"
hx-swap="none">
<i class="fas fa-clock"></i>
</button>
<button class="btn btn-outline-danger"
title="Cancel"
hx-post="{% url 'inpatients:cancel_surgery' surgery.id %}"
hx-confirm="Cancel this surgery?"
hx-swap="none">
<i class="fas fa-times"></i>
</button>
{% endif %}
</div>
</td>
</tr>
{% empty %}
<tr>
<td colspan="8" class="text-center py-4">
<i class="fas fa-procedures fa-3x text-muted mb-3"></i>
<h5 class="text-muted">No surgeries found</h5>
<p class="text-muted">No surgeries match your current filters.</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Pagination -->
{% if is_paginated %}
<nav aria-label="Surgery pagination">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page=1">First</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">Previous</a>
</li>
{% endif %}
<li class="page-item active">
<span class="page-link">
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
</span>
</li>
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}">Last</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}