206 lines
9.6 KiB
HTML
206 lines
9.6 KiB
HTML
{% load static %}
|
|
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Approve Transfer Request</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="approveTransferForm" method="post" action="{% url 'inpatients:approve_transfer' transfer_id=transfer.id %}">
|
|
{% csrf_token %}
|
|
|
|
<div class="transfer-info mb-3">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<p><strong>Patient:</strong> {{ transfer.admission.patient.get_full_name }}</p>
|
|
<p><strong>MRN:</strong> {{ transfer.admission.patient.mrn }}</p>
|
|
<p><strong>Transfer Type:</strong> {{ transfer.get_transfer_type_display }}</p>
|
|
<p><strong>Priority:</strong>
|
|
<span class="badge bg-{{ transfer.priority|lower }}">
|
|
{{ transfer.get_priority_display }}
|
|
</span>
|
|
</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<p><strong>From:</strong> {{ transfer.source_ward.name }}, Room {{ transfer.source_bed.room_number }}, Bed {{ transfer.source_bed.bed_number }}</p>
|
|
<p><strong>To:</strong> {{ transfer.target_ward.name }}, Room {{ transfer.target_bed.room_number }}, Bed {{ transfer.target_bed.bed_number }}</p>
|
|
<p><strong>Requested By:</strong> {{ transfer.requested_by.get_full_name }}</p>
|
|
<p><strong>Requested Time:</strong> {{ transfer.requested_datetime|date:"M d, Y H:i" }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="alert alert-info mt-2">
|
|
<p><strong>Reason:</strong> {{ transfer.get_transfer_reason_display }}</p>
|
|
{% if transfer.notes %}
|
|
<p><strong>Notes:</strong> {{ transfer.notes }}</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="scheduled_datetime" class="form-label">Schedule Transfer For <span class="text-danger">*</span></label>
|
|
<input type="datetime-local" class="form-control" id="scheduled_datetime" name="scheduled_datetime" required>
|
|
<div class="form-text">When should this transfer take place?</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="approval_notes" class="form-label">Approval Notes</label>
|
|
<textarea class="form-control" id="approval_notes" name="approval_notes" rows="3" placeholder="Enter any additional information about this approval"></textarea>
|
|
<div class="form-text">Please provide any additional instructions or notes for this transfer.</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="verify_bed_available" name="verify_bed_available" required>
|
|
<label class="form-check-label" for="verify_bed_available">
|
|
I verify that the target bed is available and appropriate for this patient
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="notify_teams" name="notify_teams" checked>
|
|
<label class="form-check-label" for="notify_teams">
|
|
Notify both sending and receiving care teams
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-danger me-2" id="rejectTransferBtn">
|
|
<i class="fa fa-times"></i> Reject Transfer
|
|
</button>
|
|
<button type="submit" form="approveTransferForm" class="btn btn-success">
|
|
<i class="fa fa-check"></i> Approve Transfer
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Reject Transfer Modal -->
|
|
<div class="modal fade" id="rejectTransferModal" tabindex="-1" aria-labelledby="rejectTransferModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="rejectTransferModalLabel">Reject Transfer Request</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="rejectTransferForm" method="post" action="">
|
|
{% csrf_token %}
|
|
|
|
<div class="mb-3">
|
|
<label for="rejection_reason" class="form-label">Rejection Reason <span class="text-danger">*</span></label>
|
|
<select class="form-select" id="rejection_reason" name="rejection_reason" required>
|
|
<option value="">Select reason</option>
|
|
<option value="BED_UNAVAILABLE">Bed Unavailable</option>
|
|
<option value="INAPPROPRIATE_PLACEMENT">Inappropriate Placement</option>
|
|
<option value="CLINICAL_CONTRAINDICATION">Clinical Contraindication</option>
|
|
<option value="STAFFING_ISSUES">Staffing Issues</option>
|
|
<option value="PATIENT_CONDITION_CHANGED">Patient Condition Changed</option>
|
|
<option value="OTHER">Other (specify in notes)</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="rejection_notes" class="form-label">Rejection Notes <span class="text-danger">*</span></label>
|
|
<textarea class="form-control" id="rejection_notes" name="rejection_notes" rows="3" required placeholder="Please explain why this transfer is being rejected"></textarea>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="notify_rejection" name="notify_rejection" checked>
|
|
<label class="form-check-label" for="notify_rejection">
|
|
Notify requesting provider about rejection
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="submit" form="rejectTransferForm" class="btn btn-danger">
|
|
<i class="fa fa-times"></i> Confirm Rejection
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Set default scheduled datetime to requested time
|
|
var requestedDateTime = new Date('{{ transfer.requested_datetime|date:"Y-m-d H:i" }}');
|
|
var defaultDateTime = requestedDateTime.toISOString().slice(0, 16);
|
|
$('#scheduled_datetime').val(defaultDateTime);
|
|
|
|
// Show reject transfer modal
|
|
$('#rejectTransferBtn').click(function() {
|
|
var rejectModal = new bootstrap.Modal(document.getElementById('rejectTransferModal'));
|
|
rejectModal.show();
|
|
});
|
|
|
|
// Form validation for approve form
|
|
$('#approveTransferForm').submit(function(e) {
|
|
var isValid = true;
|
|
|
|
// Check if scheduled time is in the past
|
|
var scheduledTime = new Date($('#scheduled_datetime').val());
|
|
var now = new Date();
|
|
|
|
if (scheduledTime < now) {
|
|
$('#scheduled_datetime').addClass('is-invalid');
|
|
$('#scheduled_datetime').closest('.mb-3').find('.form-text').html('<span class="text-danger">Scheduled time cannot be in the past.</span>');
|
|
isValid = false;
|
|
} else {
|
|
$('#scheduled_datetime').removeClass('is-invalid');
|
|
$('#scheduled_datetime').closest('.mb-3').find('.form-text').html('When should this transfer take place?');
|
|
}
|
|
|
|
// Check verification checkbox
|
|
if (!$('#verify_bed_available').is(':checked')) {
|
|
$('#verify_bed_available').addClass('is-invalid');
|
|
isValid = false;
|
|
} else {
|
|
$('#verify_bed_available').removeClass('is-invalid');
|
|
}
|
|
|
|
if (!isValid) {
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
});
|
|
|
|
// Form validation for reject form
|
|
$('#rejectTransferForm').submit(function(e) {
|
|
var isValid = true;
|
|
|
|
// Check rejection reason
|
|
if ($('#rejection_reason').val() === '') {
|
|
$('#rejection_reason').addClass('is-invalid');
|
|
isValid = false;
|
|
} else {
|
|
$('#rejection_reason').removeClass('is-invalid');
|
|
}
|
|
|
|
// Check rejection notes
|
|
if ($('#rejection_notes').val().trim() === '') {
|
|
$('#rejection_notes').addClass('is-invalid');
|
|
isValid = false;
|
|
} else {
|
|
$('#rejection_notes').removeClass('is-invalid');
|
|
}
|
|
|
|
if (!isValid) {
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
});
|
|
});
|
|
</script>
|
|
|