605 lines
31 KiB
HTML
605 lines
31 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Delete Dispensing Record - Pharmacy{% endblock %}
|
|
|
|
{% block content %}
|
|
<!-- BEGIN breadcrumb -->
|
|
<ol class="breadcrumb float-xl-end">
|
|
<li class="breadcrumb-item"><a href="{% url 'core:dashboard' %}">Dashboard</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'pharmacy:dashboard' %}">Pharmacy</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'pharmacy:dispensing_list' %}">Dispensing</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'pharmacy:dispensing_detail' object.pk %}">{{ object.prescription.prescription_number }}</a></li>
|
|
<li class="breadcrumb-item active">Delete</li>
|
|
</ol>
|
|
<!-- END breadcrumb -->
|
|
|
|
<!-- BEGIN page-header -->
|
|
<h1 class="page-header">
|
|
Delete Dispensing Record
|
|
<small>{{ object.prescription.prescription_number }} - {{ object.prescription.patient.get_full_name }}</small>
|
|
</h1>
|
|
<!-- END page-header -->
|
|
|
|
<div class="row">
|
|
<div class="col-xl-8">
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">
|
|
<i class="fa fa-exclamation-triangle text-warning me-2"></i>
|
|
Confirm Dispensing Record Deletion
|
|
</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<!-- Deletion Warning -->
|
|
<div class="alert alert-danger">
|
|
<h5 class="alert-heading">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>
|
|
Critical Action Warning
|
|
</h5>
|
|
<p class="mb-0">
|
|
You are about to permanently delete a dispensing record. This action cannot be undone and may have serious regulatory and audit implications.
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Status-Specific Warnings -->
|
|
{% if object.status == 'dispensed' %}
|
|
<div class="alert alert-danger">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-ban me-2"></i>
|
|
Dispensed Medication Warning
|
|
</h6>
|
|
<p class="mb-0">
|
|
This medication has already been dispensed to the patient. Deleting this record may violate regulatory requirements and audit trails. Consider marking as cancelled or creating a reversal entry instead.
|
|
</p>
|
|
</div>
|
|
{% elif object.status == 'in_progress' %}
|
|
<div class="alert alert-warning">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-spinner me-2"></i>
|
|
Active Dispensing Warning
|
|
</h6>
|
|
<p class="mb-0">
|
|
This dispensing record is currently in progress. Deleting it may disrupt the dispensing workflow and cause confusion for pharmacy staff.
|
|
</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Controlled Substance Warning -->
|
|
{% if object.medication.is_controlled %}
|
|
<div class="alert alert-danger">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-shield-alt me-2"></i>
|
|
Controlled Substance Alert
|
|
</h6>
|
|
<p class="mb-0">
|
|
This is a controlled substance (Schedule {{ object.medication.controlled_schedule }}). Deletion of controlled substance records may violate DEA regulations and require special documentation.
|
|
</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- High Alert Medication Warning -->
|
|
{% if object.medication.is_high_alert %}
|
|
<div class="alert alert-warning">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>
|
|
High Alert Medication
|
|
</h6>
|
|
<p class="mb-0">
|
|
This is a high alert medication. Extra caution is required when modifying or deleting records for these medications.
|
|
</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Record Information -->
|
|
<div class="card border-info mb-4">
|
|
<div class="card-header bg-info text-white">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fa fa-info-circle me-2"></i>Record to be Deleted
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-2"><strong>Prescription:</strong> {{ object.prescription.prescription_number }}</div>
|
|
<div class="mb-2"><strong>Patient:</strong> {{ object.prescription.patient.get_full_name }}</div>
|
|
<div class="mb-2"><strong>Medication:</strong> {{ object.medication.generic_name }} {{ object.medication.strength }}</div>
|
|
<div class="mb-2"><strong>Quantity:</strong> {{ object.quantity_dispensed }} {{ object.medication.unit }}</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-2"><strong>Status:</strong>
|
|
{% if object.status == 'pending' %}
|
|
<span class="badge bg-info">Pending</span>
|
|
{% elif object.status == 'in_progress' %}
|
|
<span class="badge bg-warning">In Progress</span>
|
|
{% elif object.status == 'dispensed' %}
|
|
<span class="badge bg-success">Dispensed</span>
|
|
{% elif object.status == 'partial' %}
|
|
<span class="badge bg-warning">Partial Fill</span>
|
|
{% elif object.status == 'rejected' %}
|
|
<span class="badge bg-danger">Rejected</span>
|
|
{% elif object.status == 'cancelled' %}
|
|
<span class="badge bg-secondary">Cancelled</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="mb-2"><strong>Pharmacist:</strong> {{ object.pharmacist.get_full_name|default:"Not assigned" }}</div>
|
|
<div class="mb-2"><strong>Created:</strong> {{ object.created_at|date:"M d, Y H:i" }}</div>
|
|
<div class="mb-2"><strong>Last Updated:</strong> {{ object.updated_at|date:"M d, Y H:i" }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Impact Assessment -->
|
|
<div class="card border-warning mb-4">
|
|
<div class="card-header bg-warning text-dark">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fa fa-assessment me-2"></i>Deletion Impact Assessment
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h6 class="text-danger">Affected Systems:</h6>
|
|
<ul class="list-unstyled">
|
|
<li><i class="fa fa-check text-danger me-2"></i>Pharmacy dispensing records</li>
|
|
<li><i class="fa fa-check text-danger me-2"></i>Patient medication history</li>
|
|
<li><i class="fa fa-check text-danger me-2"></i>Inventory tracking system</li>
|
|
<li><i class="fa fa-check text-danger me-2"></i>Billing and insurance records</li>
|
|
{% if object.medication.is_controlled %}
|
|
<li><i class="fa fa-check text-danger me-2"></i>DEA controlled substance logs</li>
|
|
{% endif %}
|
|
<li><i class="fa fa-check text-danger me-2"></i>Audit trail and compliance reports</li>
|
|
</ul>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="text-warning">Potential Consequences:</h6>
|
|
<ul class="list-unstyled">
|
|
<li><i class="fa fa-exclamation-triangle text-warning me-2"></i>Loss of audit trail</li>
|
|
<li><i class="fa fa-exclamation-triangle text-warning me-2"></i>Regulatory compliance issues</li>
|
|
<li><i class="fa fa-exclamation-triangle text-warning me-2"></i>Inventory discrepancies</li>
|
|
<li><i class="fa fa-exclamation-triangle text-warning me-2"></i>Patient safety concerns</li>
|
|
<li><i class="fa fa-exclamation-triangle text-warning me-2"></i>Insurance claim problems</li>
|
|
<li><i class="fa fa-exclamation-triangle text-warning me-2"></i>Legal liability issues</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Alternative Actions -->
|
|
<div class="card border-success mb-4">
|
|
<div class="card-header bg-success text-white">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fa fa-lightbulb me-2"></i>Recommended Alternative Actions
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h6 class="text-success">Instead of Deletion:</h6>
|
|
<div class="list-group">
|
|
{% if object.status != 'cancelled' %}
|
|
<a href="{% url 'pharmacy:cancel_dispensing' object.pk %}" class="list-group-item list-group-item-action">
|
|
<i class="fa fa-ban me-2"></i>
|
|
<strong>Cancel Dispensing</strong>
|
|
<div class="small text-muted">Mark as cancelled while preserving audit trail</div>
|
|
</a>
|
|
{% endif %}
|
|
{% if object.status == 'dispensed' %}
|
|
<a href="{% url 'pharmacy:create_reversal' object.pk %}" class="list-group-item list-group-item-action">
|
|
<i class="fa fa-undo me-2"></i>
|
|
<strong>Create Reversal Entry</strong>
|
|
<div class="small text-muted">Create a reversal transaction for dispensed medication</div>
|
|
</a>
|
|
{% endif %}
|
|
<a href="{% url 'pharmacy:dispensing_edit' object.pk %}" class="list-group-item list-group-item-action">
|
|
<i class="fa fa-edit me-2"></i>
|
|
<strong>Edit Record</strong>
|
|
<div class="small text-muted">Modify the dispensing record instead of deleting</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="text-info">Additional Options:</h6>
|
|
<div class="list-group">
|
|
<a href="{% url 'pharmacy:add_dispensing_note' object.pk %}" class="list-group-item list-group-item-action">
|
|
<i class="fa fa-sticky-note me-2"></i>
|
|
<strong>Add Correction Note</strong>
|
|
<div class="small text-muted">Add a note explaining any issues or corrections</div>
|
|
</a>
|
|
<a href="{% url 'pharmacy:flag_for_review' object.pk %}" class="list-group-item list-group-item-action">
|
|
<i class="fa fa-flag me-2"></i>
|
|
<strong>Flag for Review</strong>
|
|
<div class="small text-muted">Flag the record for pharmacist review</div>
|
|
</a>
|
|
<a href="{% url 'pharmacy:contact_supervisor' %}" class="list-group-item list-group-item-action">
|
|
<i class="fa fa-user-tie me-2"></i>
|
|
<strong>Contact Supervisor</strong>
|
|
<div class="small text-muted">Get supervisor approval for deletion</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Deletion Requirements -->
|
|
{% if object.status == 'dispensed' or object.medication.is_controlled %}
|
|
<div class="card border-danger mb-4">
|
|
<div class="card-header bg-danger text-white">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fa fa-clipboard-check me-2"></i>Deletion Requirements
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="alert alert-warning">
|
|
<h6 class="alert-heading">Special Authorization Required</h6>
|
|
<p class="mb-3">Due to the nature of this record, special authorization is required for deletion:</p>
|
|
|
|
<div class="form-check mb-2">
|
|
<input class="form-check-input" type="checkbox" id="supervisor-approval" required>
|
|
<label class="form-check-label" for="supervisor-approval">
|
|
<strong>Supervisor approval obtained</strong>
|
|
<div class="small text-muted">Pharmacy supervisor has reviewed and approved this deletion</div>
|
|
</label>
|
|
</div>
|
|
|
|
{% if object.medication.is_controlled %}
|
|
<div class="form-check mb-2">
|
|
<input class="form-check-input" type="checkbox" id="dea-compliance" required>
|
|
<label class="form-check-label" for="dea-compliance">
|
|
<strong>DEA compliance verified</strong>
|
|
<div class="small text-muted">Deletion complies with DEA controlled substance regulations</div>
|
|
</label>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.status == 'dispensed' %}
|
|
<div class="form-check mb-2">
|
|
<input class="form-check-input" type="checkbox" id="patient-notified" required>
|
|
<label class="form-check-label" for="patient-notified">
|
|
<strong>Patient notification completed</strong>
|
|
<div class="small text-muted">Patient has been notified of the record deletion if required</div>
|
|
</label>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input" type="checkbox" id="audit-documented" required>
|
|
<label class="form-check-label" for="audit-documented">
|
|
<strong>Audit documentation completed</strong>
|
|
<div class="small text-muted">Reason for deletion has been properly documented for audit purposes</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Deletion Reason -->
|
|
<div class="card border-secondary mb-4">
|
|
<div class="card-header bg-secondary text-white">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fa fa-comment me-2"></i>Deletion Justification
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="mb-3">
|
|
<label for="deletion-reason" class="form-label">
|
|
<strong>Reason for Deletion <span class="text-danger">*</span></strong>
|
|
</label>
|
|
<textarea class="form-control" id="deletion-reason" name="deletion_reason" rows="4" required
|
|
placeholder="Provide a detailed explanation for why this dispensing record must be deleted. Include any relevant circumstances, approvals obtained, and regulatory considerations."></textarea>
|
|
<div class="form-text">This reason will be permanently recorded in the audit log.</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="supervisor-name" class="form-label">
|
|
<strong>Authorizing Supervisor</strong>
|
|
</label>
|
|
<input type="text" class="form-control" id="supervisor-name" name="supervisor_name"
|
|
placeholder="Name of supervisor who authorized this deletion">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Final Confirmation -->
|
|
<div class="card border-danger mb-4">
|
|
<div class="card-header bg-danger text-white">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>Final Confirmation
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="alert alert-danger">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="final-confirmation" required>
|
|
<label class="form-check-label" for="final-confirmation">
|
|
<strong>I understand that this action is irreversible and may have serious regulatory and legal implications. I confirm that I have the authority to delete this dispensing record and that all necessary approvals have been obtained.</strong>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="confirmation-text" class="form-label">
|
|
<strong>Type "DELETE DISPENSING RECORD" to confirm:</strong>
|
|
</label>
|
|
<input type="text" class="form-control" id="confirmation-text"
|
|
placeholder="Type the confirmation text exactly as shown above">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Action Buttons -->
|
|
<form method="post" id="delete-form">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="deletion_reason" id="hidden-deletion-reason">
|
|
<input type="hidden" name="supervisor_name" id="hidden-supervisor-name">
|
|
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<a href="{% url 'pharmacy:dispensing_detail' object.pk %}" class="btn btn-secondary">
|
|
<i class="fa fa-arrow-left me-2"></i>Cancel
|
|
</a>
|
|
</div>
|
|
<div>
|
|
<button type="button" class="btn btn-warning me-2" onclick="showAlternatives()">
|
|
<i class="fa fa-lightbulb me-2"></i>Show Alternatives
|
|
</button>
|
|
<button type="submit" class="btn btn-danger" id="delete-button" disabled>
|
|
<i class="fa fa-trash me-2"></i>Delete Dispensing Record
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
</div>
|
|
|
|
<div class="col-xl-4">
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Deletion Checklist</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="list-group list-group-flush">
|
|
<div class="list-group-item">
|
|
<div class="form-check">
|
|
<input class="form-check-input checklist-item" type="checkbox" id="check-alternatives">
|
|
<label class="form-check-label" for="check-alternatives">
|
|
<strong>Alternatives Considered</strong>
|
|
<div class="small text-muted">Reviewed all alternative actions</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="list-group-item">
|
|
<div class="form-check">
|
|
<input class="form-check-input checklist-item" type="checkbox" id="check-impact">
|
|
<label class="form-check-label" for="check-impact">
|
|
<strong>Impact Assessed</strong>
|
|
<div class="small text-muted">Understood deletion consequences</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="list-group-item">
|
|
<div class="form-check">
|
|
<input class="form-check-input checklist-item" type="checkbox" id="check-regulatory">
|
|
<label class="form-check-label" for="check-regulatory">
|
|
<strong>Regulatory Compliance</strong>
|
|
<div class="small text-muted">Verified regulatory requirements</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="list-group-item">
|
|
<div class="form-check">
|
|
<input class="form-check-input checklist-item" type="checkbox" id="check-approval">
|
|
<label class="form-check-label" for="check-approval">
|
|
<strong>Approval Obtained</strong>
|
|
<div class="small text-muted">Supervisor authorization received</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="list-group-item">
|
|
<div class="form-check">
|
|
<input class="form-check-input checklist-item" type="checkbox" id="check-documentation">
|
|
<label class="form-check-label" for="check-documentation">
|
|
<strong>Documentation Complete</strong>
|
|
<div class="small text-muted">Deletion reason documented</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Regulatory Information</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="alert alert-info">
|
|
<h6 class="alert-heading">Important Regulations</h6>
|
|
<ul class="mb-0 small">
|
|
{% if object.medication.is_controlled %}
|
|
<li><strong>DEA Regulations:</strong> Controlled substance records must comply with 21 CFR Part 1304</li>
|
|
{% endif %}
|
|
<li><strong>HIPAA:</strong> Patient information deletion must follow privacy regulations</li>
|
|
<li><strong>State Pharmacy Law:</strong> Check state-specific record retention requirements</li>
|
|
<li><strong>Joint Commission:</strong> Medication management standards apply</li>
|
|
<li><strong>Audit Requirements:</strong> Maintain audit trail for all deletions</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Contact Information</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="small">
|
|
<div class="mb-2">
|
|
<strong>Pharmacy Supervisor:</strong><br>
|
|
<i class="fa fa-phone me-1"></i> (555) 123-4567<br>
|
|
<i class="fa fa-envelope me-1"></i> supervisor@hospital.com
|
|
</div>
|
|
<div class="mb-2">
|
|
<strong>Compliance Officer:</strong><br>
|
|
<i class="fa fa-phone me-1"></i> (555) 123-4568<br>
|
|
<i class="fa fa-envelope me-1"></i> compliance@hospital.com
|
|
</div>
|
|
<div class="mb-2">
|
|
<strong>IT Support:</strong><br>
|
|
<i class="fa fa-phone me-1"></i> (555) 123-4569<br>
|
|
<i class="fa fa-envelope me-1"></i> itsupport@hospital.com
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Monitor form completion
|
|
$('.form-check-input, #deletion-reason, #supervisor-name, #confirmation-text').on('change input', function() {
|
|
checkFormCompletion();
|
|
});
|
|
|
|
// Form submission
|
|
$('#delete-form').on('submit', function(e) {
|
|
if (!validateDeletion()) {
|
|
e.preventDefault();
|
|
} else {
|
|
// Copy values to hidden fields
|
|
$('#hidden-deletion-reason').val($('#deletion-reason').val());
|
|
$('#hidden-supervisor-name').val($('#supervisor-name').val());
|
|
|
|
// Final confirmation
|
|
if (!confirm('This is your final confirmation. Are you absolutely sure you want to delete this dispensing record? This action cannot be undone.')) {
|
|
e.preventDefault();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
function checkFormCompletion() {
|
|
var allChecked = true;
|
|
var requiredCheckboxes = [
|
|
'#final-confirmation',
|
|
{% if object.status == 'dispensed' or object.medication.is_controlled %}
|
|
'#supervisor-approval',
|
|
{% if object.medication.is_controlled %}
|
|
'#dea-compliance',
|
|
{% endif %}
|
|
{% if object.status == 'dispensed' %}
|
|
'#patient-notified',
|
|
{% endif %}
|
|
'#audit-documented'
|
|
{% endif %}
|
|
];
|
|
|
|
// Check required checkboxes
|
|
requiredCheckboxes.forEach(function(selector) {
|
|
if (!$(selector).is(':checked')) {
|
|
allChecked = false;
|
|
}
|
|
});
|
|
|
|
// Check deletion reason
|
|
var deletionReason = $('#deletion-reason').val().trim();
|
|
if (!deletionReason || deletionReason.length < 10) {
|
|
allChecked = false;
|
|
}
|
|
|
|
// Check confirmation text
|
|
var confirmationText = $('#confirmation-text').val().trim();
|
|
if (confirmationText !== 'DELETE DISPENSING RECORD') {
|
|
allChecked = false;
|
|
}
|
|
|
|
// Enable/disable delete button
|
|
$('#delete-button').prop('disabled', !allChecked);
|
|
|
|
if (allChecked) {
|
|
$('#delete-button').removeClass('btn-secondary').addClass('btn-danger');
|
|
} else {
|
|
$('#delete-button').removeClass('btn-danger').addClass('btn-secondary');
|
|
}
|
|
}
|
|
|
|
function validateDeletion() {
|
|
var errors = [];
|
|
|
|
// Check required checkboxes
|
|
if (!$('#final-confirmation').is(':checked')) {
|
|
errors.push('Final confirmation is required');
|
|
}
|
|
|
|
{% if object.status == 'dispensed' or object.medication.is_controlled %}
|
|
if (!$('#supervisor-approval').is(':checked')) {
|
|
errors.push('Supervisor approval is required');
|
|
}
|
|
|
|
{% if object.medication.is_controlled %}
|
|
if (!$('#dea-compliance').is(':checked')) {
|
|
errors.push('DEA compliance verification is required');
|
|
}
|
|
{% endif %}
|
|
|
|
{% if object.status == 'dispensed' %}
|
|
if (!$('#patient-notified').is(':checked')) {
|
|
errors.push('Patient notification confirmation is required');
|
|
}
|
|
{% endif %}
|
|
|
|
if (!$('#audit-documented').is(':checked')) {
|
|
errors.push('Audit documentation is required');
|
|
}
|
|
{% endif %}
|
|
|
|
// Check deletion reason
|
|
var deletionReason = $('#deletion-reason').val().trim();
|
|
if (!deletionReason || deletionReason.length < 10) {
|
|
errors.push('A detailed deletion reason is required (minimum 10 characters)');
|
|
}
|
|
|
|
// Check confirmation text
|
|
var confirmationText = $('#confirmation-text').val().trim();
|
|
if (confirmationText !== 'DELETE DISPENSING RECORD') {
|
|
errors.push('Confirmation text must be typed exactly as shown');
|
|
}
|
|
|
|
if (errors.length > 0) {
|
|
toastr.error('Please fix the following issues:\n' + errors.join('\n'));
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function showAlternatives() {
|
|
$('html, body').animate({
|
|
scrollTop: $('.card.border-success').offset().top - 100
|
|
}, 500);
|
|
|
|
$('.card.border-success').addClass('border-warning').removeClass('border-success');
|
|
setTimeout(function() {
|
|
$('.card.border-warning').addClass('border-success').removeClass('border-warning');
|
|
}, 2000);
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|