Marwan Alwali 193ee7f34a update
2025-08-24 12:00:10 +03:00

186 lines
11 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block title %}Transfer Management - {{ 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-exchange-alt me-2"></i>Transfer Management
</h4>
</div>
<div class="card-body">
<!-- Filters -->
<div class="row mb-3">
<div class="col-md-2">
<select name="status" class="form-select">
<option value="">All Status</option>
{% for value, label in transfer_statuses %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<select name="priority" class="form-select">
<option value="">All Priorities</option>
{% for value, label in priorities %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<select name="date_filter" class="form-select">
<option value="">All Dates</option>
<option value="today">Today</option>
<option value="pending">Pending</option>
</select>
</div>
<div class="col-md-4">
<input type="text" name="search" class="form-control" placeholder="Search patients, MRN, reason...">
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-primary w-100">
<i class="fas fa-search"></i>
</button>
</div>
</div>
<!-- Transfers Table -->
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Patient</th>
<th>Requested</th>
<th>From</th>
<th>To</th>
<th>Priority</th>
<th>Status</th>
<th>Requested By</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for transfer in transfers %}
<tr>
<td>
<strong>{{ transfer.patient.get_full_name }}</strong><br>
<small class="text-muted">MRN: {{ transfer.patient.mrn }}</small>
</td>
<td>{{ transfer.requested_datetime|date:"M d, Y H:i" }}</td>
<td>
<strong>{{ transfer.from_ward.name }}</strong>
{% if transfer.from_bed %}
<br><small class="text-muted">
Room {{ transfer.from_bed.room_number }},
Bed {{ transfer.from_bed.bed_number }}
</small>
{% endif %}
</td>
<td>
<strong>{{ transfer.to_ward.name }}</strong>
{% if transfer.to_bed %}
<br><small class="text-muted">
Room {{ transfer.to_bed.room_number }},
Bed {{ transfer.to_bed.bed_number }}
</small>
{% endif %}
</td>
<td>
{% if transfer.priority == 'STAT' %}
<span class="badge bg-danger">STAT</span>
{% elif transfer.priority == 'URGENT' %}
<span class="badge bg-warning">Urgent</span>
{% elif transfer.priority == 'ROUTINE' %}
<span class="badge bg-info">Routine</span>
{% endif %}
</td>
<td>
{% if transfer.status == 'REQUESTED' %}
<span class="badge bg-warning">Requested</span>
{% elif transfer.status == 'APPROVED' %}
<span class="badge bg-info">Approved</span>
{% elif transfer.status == 'SCHEDULED' %}
<span class="badge bg-primary">Scheduled</span>
{% elif transfer.status == 'IN_PROGRESS' %}
<span class="badge bg-success">In Progress</span>
{% elif transfer.status == 'COMPLETED' %}
<span class="badge bg-success">Completed</span>
{% elif transfer.status == 'CANCELLED' %}
<span class="badge bg-danger">Cancelled</span>
{% elif transfer.status == 'REJECTED' %}
<span class="badge bg-danger">Rejected</span>
{% endif %}
</td>
<td>{{ transfer.requested_by.get_full_name }}</td>
<td>
<div class="btn-group btn-group-sm">
{% if transfer.status == 'REQUESTED' %}
<a class="btn btn-outline-success"
title="Approve"
href="{% url 'inpatients:approve_transfer' transfer.id %}">
<i class="fas fa-check"></i>
</a>
{# <button class="btn btn-outline-danger" #}
{# title="Reject"#}
{# hx-post="{% url 'inpatients:reject_transfer' transfer.id %}"#}
{# hx-confirm="Reject this transfer?"#}
{# hx-swap="none">#}
{# <i class="fas fa-times"></i>#}
{# </button>#}
{% elif transfer.status == 'APPROVED' or transfer.status == 'SCHEDULED' %}
{# <button class="btn btn-outline-primary" #}
{# title="Execute Transfer"#}
{# hx-post="{% url 'inpatients:execute_transfer' transfer.id %}"#}
{# hx-confirm="Execute this transfer?"#}
{# hx-swap="none">#}
{# <i class="fas fa-play"></i>#}
{# </button>#}
{% endif %}
<button class="btn btn-outline-info" title="View Details">
<i class="fas fa-eye"></i>
</button>
{% if transfer.status not in 'COMPLETED,CANCELLED,REJECTED' %}
{# <button class="btn btn-outline-secondary" #}
{# title="Cancel"#}
{# hx-post="{% url 'inpatients:cancel_transfer' transfer.id %}"#}
{# hx-confirm="Cancel this transfer?"#}
{# hx-swap="none">#}
{# <i class="fas fa-ban"></i>#}
{# </button>#}
{% endif %}
</div>
</td>
</tr>
{% empty %}
<tr>
<td colspan="8" class="text-center py-4">
<i class="fas fa-exchange-alt fa-3x text-muted mb-3"></i>
<h5 class="text-muted">No transfers found</h5>
<p class="text-muted">No transfers match your current filters.</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Pagination -->
{% if is_paginated %}
{% include 'partial/pagination.html'%}
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}