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

265 lines
12 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block title %}Confirm Delete Bed | {{ block.super }}{% endblock %}
{% block css %}
{{ block.super }}
<style>
.impact-assessment {
border-left: 4px solid #f59c1a;
padding-left: 15px;
margin-bottom: 20px;
}
.alternative-action {
border-left: 4px solid #2d353c;
padding-left: 15px;
margin-bottom: 20px;
}
.bed-info {
background-color: rgba(45, 53, 60, 0.05);
border-radius: 5px;
padding: 15px;
margin-bottom: 20px;
}
.warning-text {
color: #ff5b57;
font-weight: 500;
}
.confirm-checkbox {
margin-top: 20px;
margin-bottom: 20px;
}
.status-badge {
font-size: 0.85rem;
padding: 5px 10px;
}
</style>
{% endblock %}
{% block breadcrumb %}
<ol class="breadcrumb float-xl-end">
<li class="breadcrumb-item"><a href="{% url 'core:dashboard' %}">Home</a></li>
<li class="breadcrumb-item"><a href="{% url 'inpatients:dashboard' %}">Inpatients</a></li>
<li class="breadcrumb-item"><a href="{% url 'inpatients:bed_management' %}">Bed Management</a></li>
<li class="breadcrumb-item active">Confirm Delete</li>
</ol>
{% endblock %}
{% block page_header %}
<h1 class="page-header">Confirm Bed Deletion <small>Review before proceeding</small></h1>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-xl-8">
<div class="panel panel-inverse">
<div class="panel-heading">
<h4 class="panel-title">Delete Bed: {{ bed.bed_number }} ({{ bed.ward.name }})</h4>
<div class="panel-heading-btn">
<a href="javascript:;" class="btn btn-xs btn-icon btn-default" data-toggle="panel-expand"><i class="fa fa-expand"></i></a>
<a href="javascript:;" class="btn btn-xs btn-icon btn-warning" data-toggle="panel-collapse"><i class="fa fa-minus"></i></a>
</div>
</div>
<div class="panel-body">
<div class="alert alert-danger">
<h4><i class="fa fa-exclamation-triangle"></i> Warning!</h4>
<p>You are about to permanently delete this bed record. This action <strong>cannot be undone</strong>.</p>
</div>
<div class="bed-info">
<h5>Bed Information</h5>
<div class="row">
<div class="col-md-6">
<p><strong>Ward:</strong> {{ bed.ward.name }}</p>
<p><strong>Room Number:</strong> {{ bed.room_number }}</p>
<p><strong>Bed Number:</strong> {{ bed.bed_number }}</p>
<p><strong>Bed Type:</strong> {{ bed.get_bed_type_display }}</p>
</div>
<div class="col-md-6">
<p><strong>Room Type:</strong> {{ bed.get_room_type_display }}</p>
<p>
<strong>Status:</strong>
<span class="badge bg-{{ bed.status|lower }} status-badge">
{{ bed.get_status_display }}
</span>
</p>
<p>
<strong>Isolation Capable:</strong>
{% if bed.is_isolation_capable %}
<span class="badge bg-success">Yes</span>
{% else %}
<span class="badge bg-default">No</span>
{% endif %}
</p>
{% if bed.current_patient %}
<p><strong>Current Patient:</strong> <span class="text-danger">{{ bed.current_patient.get_full_name }}</span></p>
{% endif %}
</div>
</div>
</div>
<div class="impact-assessment">
<h5>Impact Assessment</h5>
<p>Deleting this bed will have the following impacts:</p>
<ul>
<li>The bed will be permanently removed from the system</li>
<li>The bed will no longer be available for patient assignments</li>
<li>Ward capacity statistics will be updated</li>
{% if bed.current_patient %}
<li class="text-danger"><strong>WARNING: This bed is currently occupied by a patient</strong></li>
<li class="text-danger">The current patient's admission will lose its bed assignment</li>
{% endif %}
<li>Historical records referencing this bed will lose their context</li>
</ul>
{% if bed.current_patient %}
<p class="warning-text">This bed is currently occupied. Deleting an occupied bed is not recommended.</p>
{% endif %}
</div>
<div class="alternative-action">
<h5>Alternative Actions</h5>
<p>Instead of deleting this bed, consider:</p>
<ul>
<li>Setting the bed status to "Maintenance" if it's temporarily unavailable</li>
<li>Setting the bed status to "Blocked" if it should not be used</li>
<li>Transferring the current patient to another bed first (if occupied)</li>
<li>Updating the bed information if it was created with incorrect details</li>
</ul>
</div>
<form method="post">
{% csrf_token %}
<div class="confirm-checkbox">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="confirm_delete" name="confirm_delete" required>
<label class="form-check-label" for="confirm_delete">
I understand the consequences and confirm that I want to permanently delete this bed record.
</label>
</div>
</div>
<div class="mb-3">
<label for="delete_reason" class="form-label">Reason for Deletion <span class="text-danger">*</span></label>
<textarea class="form-control" id="delete_reason" name="delete_reason" rows="3" required placeholder="Please provide a detailed reason for deleting this bed"></textarea>
<div class="form-text">This reason will be logged in the audit trail.</div>
</div>
<div class="row">
<div class="col-md-6">
<a href="{% url 'inpatients:bed_management' %}" class="btn btn-secondary btn-lg d-block w-100">
<i class="fa fa-arrow-left"></i> Cancel
</a>
</div>
<div class="col-md-6">
<button type="submit" class="btn btn-danger btn-lg d-block w-100" {% if bed.current_patient %}disabled{% endif %}>
<i class="fa fa-trash"></i> Delete Bed
</button>
</div>
</div>
{% if bed.current_patient %}
<div class="alert alert-danger mt-3">
<i class="fa fa-exclamation-circle"></i> This bed is currently occupied. You must transfer or discharge the patient before deleting this bed.
</div>
{% endif %}
</form>
</div>
</div>
</div>
<div class="col-xl-4">
<div class="panel panel-inverse">
<div class="panel-heading">
<h4 class="panel-title">Additional Information</h4>
<div class="panel-heading-btn">
<a href="javascript:;" class="btn btn-xs btn-icon btn-default" data-toggle="panel-expand"><i class="fa fa-expand"></i></a>
<a href="javascript:;" class="btn btn-xs btn-icon btn-warning" data-toggle="panel-collapse"><i class="fa fa-minus"></i></a>
</div>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped m-b-0">
<tbody>
<tr>
<th width="35%">Equipment</th>
<td>{{ bed.equipment|default:"None specified" }}</td>
</tr>
<tr>
<th>Features</th>
<td>{{ bed.features|default:"None specified" }}</td>
</tr>
<tr>
<th>Notes</th>
<td>{{ bed.notes|default:"None specified" }}</td>
</tr>
{% if bed.last_cleaned %}
<tr>
<th>Last Cleaned</th>
<td>{{ bed.last_cleaned|date:"M d, Y H:i" }}</td>
</tr>
{% endif %}
{% if bed.cleaned_by %}
<tr>
<th>Cleaned By</th>
<td>{{ bed.cleaned_by.get_full_name }}</td>
</tr>
{% endif %}
{% if bed.last_maintenance %}
<tr>
<th>Last Maintenance</th>
<td>{{ bed.last_maintenance|date:"M d, Y H:i" }}</td>
</tr>
{% endif %}
{% if bed.occupied_since %}
<tr>
<th>Occupied Since</th>
<td>{{ bed.occupied_since|date:"M d, Y H:i" }}</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
{% if bed.current_patient %}
<div class="alert alert-warning mt-3">
<h5><i class="fa fa-user-injured"></i> Current Patient</h5>
<p><strong>Name:</strong> {{ bed.current_patient.get_full_name }}</p>
<p><strong>MRN:</strong> {{ bed.current_patient.mrn }}</p>
<p><strong>Admission Date:</strong> {{ bed.current_admission.admission_datetime|date:"M d, Y H:i" }}</p>
<p><strong>Attending Physician:</strong> {{ bed.current_admission.attending_physician.get_full_name }}</p>
<p>
<a href="{% url 'inpatients:admission_detail' pk=bed.current_admission.pk %}" class="btn btn-sm btn-primary">
<i class="fa fa-eye"></i> View Admission
</a>
</p>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
{{ block.super }}
<script>
$(document).ready(function() {
// Disable submit button until checkbox is checked (if not already disabled due to occupied bed)
$('#confirm_delete').change(function() {
if($(this).is(':checked') && !{{ bed.current_patient|yesno:"true,false" }}) {
$('button[type="submit"]').prop('disabled', false);
} else {
$('button[type="submit"]').prop('disabled', true);
}
});
// Initially disable submit button if not checked
if(!$('#confirm_delete').is(':checked')) {
$('button[type="submit"]').prop('disabled', true);
}
});
</script>
{% endblock %}