557 lines
29 KiB
HTML
557 lines
29 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Delete Inventory - 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:inventory_list' %}">Inventory</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'pharmacy:inventory_detail' object.pk %}">{{ object.medication.name }}</a></li>
|
|
<li class="breadcrumb-item active">Delete</li>
|
|
</ol>
|
|
<!-- END breadcrumb -->
|
|
|
|
<!-- BEGIN page-header -->
|
|
<h1 class="page-header">
|
|
Delete Inventory Record
|
|
<small>{{ object.medication.name }} - {{ object.location.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">Confirm Inventory Deletion</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>
|
|
</div>
|
|
</div>
|
|
<div class="panel-body">
|
|
<!-- Inventory Information -->
|
|
<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>Inventory Record to be Deleted
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-2"><strong>Medication:</strong> {{ object.medication.generic_name }}</div>
|
|
<div class="mb-2"><strong>Brand Name:</strong> {{ object.medication.brand_name|default:"Not specified" }}</div>
|
|
<div class="mb-2"><strong>Strength:</strong> {{ object.medication.strength }}</div>
|
|
<div class="mb-2"><strong>Location:</strong> {{ object.location.name }}</div>
|
|
<div class="mb-2"><strong>Bin/Shelf:</strong> {{ object.bin_location|default:"Not specified" }}</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-2"><strong>Current Stock:</strong>
|
|
<span class="{% if object.current_stock <= 0 %}text-danger{% elif object.current_stock <= object.reorder_level %}text-warning{% else %}text-success{% endif %}">
|
|
{{ object.current_stock }}
|
|
</span>
|
|
</div>
|
|
<div class="mb-2"><strong>Total Value:</strong> ${{ object.total_value|floatformat:2 }}</div>
|
|
<div class="mb-2"><strong>Lot Number:</strong> {{ object.lot_number|default:"Not specified" }}</div>
|
|
<div class="mb-2"><strong>Expiration:</strong>
|
|
{% if object.expiration_date %}
|
|
<span class="{% if object.is_expired %}text-danger{% elif object.expires_soon %}text-warning{% else %}text-success{% endif %}">
|
|
{{ object.expiration_date|date:"M d, Y" }}
|
|
{% if object.is_expired %}(Expired){% elif object.expires_soon %}(Expires Soon){% endif %}
|
|
</span>
|
|
{% else %}
|
|
Not specified
|
|
{% endif %}
|
|
</div>
|
|
<div class="mb-2">
|
|
{% if object.medication.is_controlled %}
|
|
<span class="badge bg-warning text-dark">
|
|
<i class="fa fa-shield me-1"></i>Controlled Substance
|
|
</span>
|
|
{% endif %}
|
|
{% if object.medication.is_high_alert %}
|
|
<span class="badge bg-danger">
|
|
<i class="fa fa-exclamation-triangle me-1"></i>High Alert
|
|
</span>
|
|
{% endif %}
|
|
</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>Impact Assessment
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h6 class="text-danger">Potential Issues:</h6>
|
|
<ul class="list-unstyled">
|
|
{% if object.current_stock > 0 %}
|
|
<li><i class="fa fa-boxes text-warning me-2"></i>{{ object.current_stock }} units in stock (value: ${{ object.total_value|floatformat:2 }})</li>
|
|
{% endif %}
|
|
{% if object.pending_orders.exists %}
|
|
<li><i class="fa fa-shopping-cart text-info me-2"></i>{{ object.pending_orders.count }} pending order(s)</li>
|
|
{% endif %}
|
|
{% if object.recent_transactions.exists %}
|
|
<li><i class="fa fa-history text-info me-2"></i>{{ object.recent_transactions.count }} recent transaction(s)</li>
|
|
{% endif %}
|
|
{% if object.medication.is_controlled %}
|
|
<li><i class="fa fa-shield text-warning me-2"></i>Controlled substance requires special handling</li>
|
|
{% endif %}
|
|
{% if object.medication.is_high_alert %}
|
|
<li><i class="fa fa-exclamation-triangle text-danger me-2"></i>High alert medication</li>
|
|
{% endif %}
|
|
{% if object.is_expired %}
|
|
<li><i class="fa fa-calendar-times text-danger me-2"></i>Expired medication</li>
|
|
{% elif object.expires_soon %}
|
|
<li><i class="fa fa-calendar-exclamation text-warning me-2"></i>Expires soon</li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="text-info">Related Records:</h6>
|
|
<ul class="list-unstyled">
|
|
<li><i class="fa fa-history me-2"></i>Transactions: {{ object.transactions.count }}</li>
|
|
<li><i class="fa fa-shopping-cart me-2"></i>Purchase orders: {{ object.purchase_orders.count }}</li>
|
|
<li><i class="fa fa-pills me-2"></i>Dispensing records: {{ object.dispensing_records.count }}</li>
|
|
<li><i class="fa fa-clipboard-check me-2"></i>Stock counts: {{ object.stock_counts.count }}</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Current Stock Warning -->
|
|
{% if object.current_stock > 0 %}
|
|
<div class="alert alert-danger">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>Stock on Hand Warning
|
|
</h6>
|
|
<p class="mb-2">This inventory record shows {{ object.current_stock }} units in stock with a total value of ${{ object.total_value|floatformat:2 }}. Deleting this record may:</p>
|
|
<ul class="mb-2">
|
|
<li>Result in loss of inventory tracking for existing stock</li>
|
|
<li>Affect financial reporting and asset valuation</li>
|
|
<li>Disrupt dispensing and prescription fulfillment</li>
|
|
<li>Impact reorder calculations and stock management</li>
|
|
<li>Remove important audit trail information</li>
|
|
</ul>
|
|
<p class="mb-0"><strong>Consider adjusting stock to zero or marking as inactive instead of deleting.</strong></p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Controlled Substance Warning -->
|
|
{% if object.medication.is_controlled %}
|
|
<div class="alert alert-warning">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-shield me-2"></i>Controlled Substance Warning
|
|
</h6>
|
|
<p class="mb-0">This inventory contains a controlled substance. Deletion must be properly documented for DEA compliance and audit purposes. All stock movements should be accounted for before deletion.</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- High Alert Warning -->
|
|
{% if object.medication.is_high_alert %}
|
|
<div class="alert alert-danger">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>High Alert Medication Warning
|
|
</h6>
|
|
<p class="mb-0">This is a high alert medication that requires special safety protocols. Deletion may affect safety procedures and clinical guidelines.</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Expired Medication Notice -->
|
|
{% if object.is_expired %}
|
|
<div class="alert alert-info">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-calendar-times me-2"></i>Expired Medication Notice
|
|
</h6>
|
|
<p class="mb-0">This medication is expired and should be properly disposed of according to pharmacy protocols before deleting the inventory record.</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Transaction History Warning -->
|
|
{% if object.transactions.exists %}
|
|
<div class="alert alert-warning">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-history me-2"></i>Transaction History Warning
|
|
</h6>
|
|
<p class="mb-0">This inventory record has {{ object.transactions.count }} transaction(s). Deleting it will remove the transaction history and may affect audit trails and financial reporting.</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Alternative Actions -->
|
|
<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-lightbulb me-2"></i>Alternative Actions
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="mb-3">Instead of deleting this inventory record, consider these alternatives:</p>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="d-grid gap-2">
|
|
{% if object.current_stock > 0 %}
|
|
<a href="{% url 'pharmacy:adjust_stock_to_zero' object.pk %}" class="btn btn-outline-warning">
|
|
<i class="fa fa-minus me-2"></i>Adjust Stock to Zero
|
|
</a>
|
|
{% endif %}
|
|
<a href="{% url 'pharmacy:inventory_edit' object.pk %}" class="btn btn-outline-primary">
|
|
<i class="fa fa-edit me-2"></i>Edit Inventory
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="d-grid gap-2">
|
|
<a href="{% url 'pharmacy:transfer_inventory' object.pk %}" class="btn btn-outline-secondary">
|
|
<i class="fa fa-exchange-alt me-2"></i>Transfer to Another Location
|
|
</a>
|
|
<a href="{% url 'pharmacy:mark_inventory_inactive' object.pk %}" class="btn btn-outline-info">
|
|
<i class="fa fa-ban me-2"></i>Mark as Inactive
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Confirmation Form -->
|
|
<form method="post" id="delete-form">
|
|
{% csrf_token %}
|
|
|
|
<!-- Reason for Deletion -->
|
|
<div class="mb-3">
|
|
<label for="deletion_reason" class="form-label">Reason for Deletion <span class="text-danger">*</span></label>
|
|
<select class="form-select" id="deletion_reason" name="deletion_reason" required>
|
|
<option value="">Select reason...</option>
|
|
<option value="duplicate">Duplicate inventory record</option>
|
|
<option value="error">Record created in error</option>
|
|
<option value="discontinued">Medication discontinued</option>
|
|
<option value="location_closed">Location closed/decommissioned</option>
|
|
<option value="expired_disposed">Expired medication properly disposed</option>
|
|
<option value="transferred">Stock transferred to another system</option>
|
|
<option value="other">Other (specify below)</option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Stock Disposition -->
|
|
{% if object.current_stock > 0 %}
|
|
<div class="mb-3">
|
|
<label for="stock_disposition" class="form-label">Stock Disposition <span class="text-danger">*</span></label>
|
|
<select class="form-select" id="stock_disposition" name="stock_disposition" required>
|
|
<option value="">Select disposition...</option>
|
|
<option value="transferred">Transferred to another location</option>
|
|
<option value="returned">Returned to supplier</option>
|
|
<option value="disposed">Properly disposed (expired/damaged)</option>
|
|
<option value="dispensed">All stock dispensed</option>
|
|
<option value="counted_zero">Physical count confirmed zero</option>
|
|
<option value="other">Other (specify in notes)</option>
|
|
</select>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Additional Notes -->
|
|
<div class="mb-3">
|
|
<label for="deletion_notes" class="form-label">Additional Notes</label>
|
|
<textarea class="form-control" id="deletion_notes" name="deletion_notes" rows="3"
|
|
placeholder="Provide additional details about the deletion..."></textarea>
|
|
<div class="form-text">These notes will be recorded in the audit log.</div>
|
|
</div>
|
|
|
|
<!-- Controlled Substance Confirmation -->
|
|
{% if object.medication.is_controlled %}
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="controlled_confirmation" name="controlled_confirmation" required>
|
|
<label class="form-check-label" for="controlled_confirmation">
|
|
<i class="fa fa-shield text-warning me-1"></i>
|
|
I acknowledge that this controlled substance inventory deletion will be reported for DEA compliance
|
|
</label>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Stock Confirmation -->
|
|
{% if object.current_stock > 0 %}
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="stock_confirmation" name="stock_confirmation" required>
|
|
<label class="form-check-label" for="stock_confirmation">
|
|
<i class="fa fa-boxes text-warning me-1"></i>
|
|
I confirm that the {{ object.current_stock }} units in stock have been properly accounted for
|
|
</label>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Transaction History Confirmation -->
|
|
{% if object.transactions.exists %}
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="transaction_confirmation" name="transaction_confirmation" required>
|
|
<label class="form-check-label" for="transaction_confirmation">
|
|
<i class="fa fa-history text-info me-1"></i>
|
|
I understand that deleting this record will remove {{ object.transactions.count }} transaction record(s)
|
|
</label>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Final Confirmation -->
|
|
<div class="mb-4">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="final_confirmation" name="final_confirmation" required>
|
|
<label class="form-check-label" for="final_confirmation">
|
|
<strong>I understand that this action cannot be undone and confirm the deletion of this inventory record</strong>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<a href="{% url 'pharmacy:inventory_detail' object.pk %}" class="btn btn-secondary">
|
|
<i class="fa fa-arrow-left me-2"></i>Cancel
|
|
</a>
|
|
</div>
|
|
<div>
|
|
<button type="submit" class="btn btn-danger" id="delete-btn" disabled>
|
|
<i class="fa fa-trash me-2"></i>Delete Inventory 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 Guidelines</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="alert alert-warning">
|
|
<h6 class="alert-heading">Important Guidelines</h6>
|
|
<ul class="mb-0 small">
|
|
<li>Inventory deletions are permanent and cannot be undone</li>
|
|
<li>All deletions are logged for audit purposes</li>
|
|
<li>Stock on hand must be properly accounted for</li>
|
|
<li>Controlled substances require special documentation</li>
|
|
<li>Transaction history will be lost</li>
|
|
<li>Consider alternatives before deletion</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="card border-info">
|
|
<div class="card-header bg-info text-white">
|
|
<h6 class="card-title mb-0">Audit Information</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="small">
|
|
<div><strong>User:</strong> {{ request.user.get_full_name }}</div>
|
|
<div><strong>Date:</strong> {{ "now"|date:"M d, Y H:i" }}</div>
|
|
<div><strong>IP Address:</strong> {{ request.META.REMOTE_ADDR }}</div>
|
|
<div><strong>Session:</strong> {{ request.session.session_key|slice:":8" }}...</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Inventory Summary</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="row text-center">
|
|
<div class="col-6">
|
|
<div class="mb-3">
|
|
<div class="h4 {% if object.current_stock <= 0 %}text-danger{% elif object.current_stock <= object.reorder_level %}text-warning{% else %}text-success{% endif %}">
|
|
{{ object.current_stock }}
|
|
</div>
|
|
<div class="small text-muted">Current Stock</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="mb-3">
|
|
<div class="h4 text-primary">${{ object.total_value|floatformat:2 }}</div>
|
|
<div class="small text-muted">Total Value</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="mb-3">
|
|
<div class="h4 text-info">{{ object.transactions.count }}</div>
|
|
<div class="small text-muted">Transactions</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="mb-3">
|
|
<div class="h4 text-secondary">{{ object.days_since_last_count|default:"-" }}</div>
|
|
<div class="small text-muted">Days Since Count</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Medication Properties</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="d-flex flex-wrap gap-2">
|
|
{% if object.medication.is_controlled %}
|
|
<span class="badge bg-warning text-dark">
|
|
<i class="fa fa-shield me-1"></i>Controlled Substance
|
|
</span>
|
|
{% endif %}
|
|
{% if object.medication.is_high_alert %}
|
|
<span class="badge bg-danger">
|
|
<i class="fa fa-exclamation-triangle me-1"></i>High Alert
|
|
</span>
|
|
{% endif %}
|
|
{% if object.medication.requires_refrigeration %}
|
|
<span class="badge bg-info">
|
|
<i class="fa fa-snowflake me-1"></i>Refrigeration Required
|
|
</span>
|
|
{% endif %}
|
|
{% if object.is_expired %}
|
|
<span class="badge bg-danger">
|
|
<i class="fa fa-calendar-times me-1"></i>Expired
|
|
</span>
|
|
{% elif object.expires_soon %}
|
|
<span class="badge bg-warning text-dark">
|
|
<i class="fa fa-calendar-exclamation me-1"></i>Expires Soon
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Enable delete button only when all confirmations are checked
|
|
function checkConfirmations() {
|
|
var finalConfirmed = $('#final_confirmation').is(':checked');
|
|
var controlledConfirmed = true;
|
|
var stockConfirmed = true;
|
|
var transactionConfirmed = true;
|
|
|
|
{% if object.medication.is_controlled %}
|
|
controlledConfirmed = $('#controlled_confirmation').is(':checked');
|
|
{% endif %}
|
|
|
|
{% if object.current_stock > 0 %}
|
|
stockConfirmed = $('#stock_confirmation').is(':checked');
|
|
{% endif %}
|
|
|
|
{% if object.transactions.exists %}
|
|
transactionConfirmed = $('#transaction_confirmation').is(':checked');
|
|
{% endif %}
|
|
|
|
var reasonSelected = $('#deletion_reason').val() !== '';
|
|
var stockDispositionSelected = true;
|
|
|
|
{% if object.current_stock > 0 %}
|
|
stockDispositionSelected = $('#stock_disposition').val() !== '';
|
|
{% endif %}
|
|
|
|
if (finalConfirmed && controlledConfirmed && stockConfirmed && transactionConfirmed && reasonSelected && stockDispositionSelected) {
|
|
$('#delete-btn').prop('disabled', false);
|
|
} else {
|
|
$('#delete-btn').prop('disabled', true);
|
|
}
|
|
}
|
|
|
|
// Check confirmations on change
|
|
$('#final_confirmation, #controlled_confirmation, #stock_confirmation, #transaction_confirmation, #deletion_reason, #stock_disposition').on('change', checkConfirmations);
|
|
|
|
// Form submission confirmation
|
|
$('#delete-form').on('submit', function(e) {
|
|
var reason = $('#deletion_reason').val();
|
|
var notes = $('#deletion_notes').val();
|
|
|
|
if (reason === 'other' && !notes.trim()) {
|
|
e.preventDefault();
|
|
toastr.error('Please provide additional details when selecting "Other" as the reason.');
|
|
$('#deletion_notes').focus();
|
|
return false;
|
|
}
|
|
|
|
{% if object.current_stock > 0 %}
|
|
var stockDisposition = $('#stock_disposition').val();
|
|
if (stockDisposition === 'other' && !notes.trim()) {
|
|
e.preventDefault();
|
|
toastr.error('Please provide details about stock disposition in the notes.');
|
|
$('#deletion_notes').focus();
|
|
return false;
|
|
}
|
|
{% endif %}
|
|
|
|
// Final confirmation dialog
|
|
var confirmMessage = 'Are you absolutely sure you want to delete this inventory record?';
|
|
{% if object.current_stock > 0 %}
|
|
confirmMessage += '\n\nThis will remove tracking for {{ object.current_stock }} units worth ${{ object.total_value|floatformat:2 }}.';
|
|
{% endif %}
|
|
{% if object.transactions.exists %}
|
|
confirmMessage += '\n\nThis will delete {{ object.transactions.count }} transaction record(s).';
|
|
{% endif %}
|
|
confirmMessage += '\n\nThis action cannot be undone.';
|
|
|
|
if (!confirm(confirmMessage)) {
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
|
|
// Show loading state
|
|
$('#delete-btn').prop('disabled', true).html('<i class="fa fa-spinner fa-spin me-2"></i>Deleting...');
|
|
|
|
return true;
|
|
});
|
|
|
|
// Reason change handler
|
|
$('#deletion_reason').on('change', function() {
|
|
if ($(this).val() === 'other') {
|
|
$('#deletion_notes').prop('required', true);
|
|
$('#deletion_notes').closest('.mb-3').find('.form-text').text('Required when "Other" is selected.');
|
|
} else {
|
|
$('#deletion_notes').prop('required', false);
|
|
$('#deletion_notes').closest('.mb-3').find('.form-text').text('These notes will be recorded in the audit log.');
|
|
}
|
|
checkConfirmations();
|
|
});
|
|
|
|
// Stock disposition change handler
|
|
$('#stock_disposition').on('change', function() {
|
|
if ($(this).val() === 'other') {
|
|
$('#deletion_notes').prop('required', true);
|
|
$('#deletion_notes').closest('.mb-3').find('.form-text').text('Required to specify stock disposition.');
|
|
}
|
|
checkConfirmations();
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|
|
|