633 lines
26 KiB
HTML
633 lines
26 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Emergency Contacts - Patient Management{% endblock %}
|
|
|
|
{% block css %}
|
|
<link href="{% static 'plugins/datatables.net-bs5/css/dataTables.bootstrap5.min.css' %}" rel="stylesheet" />
|
|
<link href="{% static 'plugins/datatables.net-responsive-bs5/css/responsive.bootstrap5.min.css' %}" rel="stylesheet" />
|
|
<link href="{% static 'plugins/select2/dist/css/select2.min.css' %}" rel="stylesheet" />
|
|
{% 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 'patients:patient_list' %}">Patients</a></li>
|
|
<li class="breadcrumb-item active">Emergency Contacts</li>
|
|
</ol>
|
|
<!-- END breadcrumb -->
|
|
|
|
<!-- BEGIN page-header -->
|
|
<h1 class="page-header">
|
|
Emergency Contacts
|
|
<small>Patient Emergency Contact Management</small>
|
|
</h1>
|
|
<!-- END page-header -->
|
|
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Emergency Contacts Management</h4>
|
|
<div class="panel-heading-btn">
|
|
<a href="{% url 'patients:emergency_contact_create' %}" class="btn btn-xs btn-success me-2">
|
|
<i class="fa fa-plus"></i> Add Contact
|
|
</a>
|
|
<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-default" data-toggle="panel-reload"><i class="fa fa-redo"></i></a>
|
|
<a href="javascript:;" class="btn btn-xs btn-icon btn-default" data-toggle="panel-collapse"><i class="fa fa-minus"></i></a>
|
|
</div>
|
|
</div>
|
|
<div class="panel-body">
|
|
<!-- Filters and Search -->
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label class="form-label">Search Contacts</label>
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" id="search-input" placeholder="Name, phone, or patient...">
|
|
<button class="btn btn-outline-secondary" type="button" id="search-btn">
|
|
<i class="fa fa-search"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Relationship</label>
|
|
<select class="form-select" id="relationship-filter">
|
|
<option value="">All Relationships</option>
|
|
<option value="SPOUSE">Spouse</option>
|
|
<option value="PARENT">Parent</option>
|
|
<option value="CHILD">Child</option>
|
|
<option value="SIBLING">Sibling</option>
|
|
<option value="FRIEND">Friend</option>
|
|
<option value="OTHER_FAMILY">Other Family</option>
|
|
<option value="GUARDIAN">Guardian</option>
|
|
<option value="OTHER">Other</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Priority</label>
|
|
<select class="form-select" id="priority-filter">
|
|
<option value="">All Priorities</option>
|
|
<option value="PRIMARY">Primary</option>
|
|
<option value="SECONDARY">Secondary</option>
|
|
<option value="TERTIARY">Tertiary</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label class="form-label">Patient</label>
|
|
<select class="form-select select2" id="patient-filter">
|
|
<option value="">All Patients</option>
|
|
<!-- Options will be loaded dynamically -->
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Quick Stats -->
|
|
<div class="row mb-4">
|
|
<div class="col-lg-3 col-md-6 mb-3">
|
|
<div class="card border-0 bg-primary text-white">
|
|
<div class="card-body">
|
|
<div class="d-flex align-items-center">
|
|
<div class="flex-fill">
|
|
<div class="fs-10px text-white-transparent-5 mb-1">TOTAL CONTACTS</div>
|
|
<div class="fs-18px fw-900 text-white" id="total-contacts">-</div>
|
|
</div>
|
|
<div class="w-50px h-50px bg-white-transparent-2 rounded-circle d-flex align-items-center justify-content-center">
|
|
<i class="fa fa-users fa-lg text-white"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6 mb-3">
|
|
<div class="card border-0 bg-success text-white">
|
|
<div class="card-body">
|
|
<div class="d-flex align-items-center">
|
|
<div class="flex-fill">
|
|
<div class="fs-10px text-white-transparent-5 mb-1">PRIMARY CONTACTS</div>
|
|
<div class="fs-18px fw-900 text-white" id="primary-contacts">-</div>
|
|
</div>
|
|
<div class="w-50px h-50px bg-white-transparent-2 rounded-circle d-flex align-items-center justify-content-center">
|
|
<i class="fa fa-star fa-lg text-white"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6 mb-3">
|
|
<div class="card border-0 bg-warning text-white">
|
|
<div class="card-body">
|
|
<div class="d-flex align-items-center">
|
|
<div class="flex-fill">
|
|
<div class="fs-10px text-white-transparent-5 mb-1">MISSING PHONE</div>
|
|
<div class="fs-18px fw-900 text-white" id="missing-phone">-</div>
|
|
</div>
|
|
<div class="w-50px h-50px bg-white-transparent-2 rounded-circle d-flex align-items-center justify-content-center">
|
|
<i class="fa fa-phone-slash fa-lg text-white"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6 mb-3">
|
|
<div class="card border-0 bg-info text-white">
|
|
<div class="card-body">
|
|
<div class="d-flex align-items-center">
|
|
<div class="flex-fill">
|
|
<div class="fs-10px text-white-transparent-5 mb-1">PATIENTS COVERED</div>
|
|
<div class="fs-18px fw-900 text-white" id="patients-covered">-</div>
|
|
</div>
|
|
<div class="w-50px h-50px bg-white-transparent-2 rounded-circle d-flex align-items-center justify-content-center">
|
|
<i class="fa fa-user-shield fa-lg text-white"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Action Buttons -->
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<div class="btn-group">
|
|
<button type="button" class="btn btn-outline-secondary" id="bulk-actions-btn" disabled>
|
|
<i class="fa fa-tasks me-2"></i>Bulk Actions
|
|
</button>
|
|
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split"
|
|
data-bs-toggle="dropdown" id="bulk-dropdown" disabled>
|
|
<span class="visually-hidden">Toggle Dropdown</span>
|
|
</button>
|
|
<ul class="dropdown-menu">
|
|
<li><a class="dropdown-item" href="#" onclick="bulkUpdatePriority()">
|
|
<i class="fa fa-star me-2"></i>Update Priority
|
|
</a></li>
|
|
<li><a class="dropdown-item" href="#" onclick="bulkSendNotification()">
|
|
<i class="fa fa-bell me-2"></i>Send Notification
|
|
</a></li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<li><a class="dropdown-item" href="#" onclick="bulkExport()">
|
|
<i class="fa fa-download me-2"></i>Export Selected
|
|
</a></li>
|
|
<li><a class="dropdown-item text-danger" href="#" onclick="bulkDelete()">
|
|
<i class="fa fa-trash me-2"></i>Delete Selected
|
|
</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="btn-group">
|
|
<button type="button" class="btn btn-outline-secondary" onclick="refreshTable()">
|
|
<i class="fa fa-refresh me-2"></i>Refresh
|
|
</button>
|
|
<button type="button" class="btn btn-outline-secondary" onclick="showContactValidation()">
|
|
<i class="fa fa-check-circle me-2"></i>Validate Contacts
|
|
</button>
|
|
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown">
|
|
<i class="fa fa-download me-2"></i>Export
|
|
</button>
|
|
<ul class="dropdown-menu">
|
|
<li><a class="dropdown-item" href="#" onclick="exportData('csv')">
|
|
<i class="fa fa-file-csv me-2"></i>Export as CSV
|
|
</a></li>
|
|
<li><a class="dropdown-item" href="#" onclick="exportData('excel')">
|
|
<i class="fa fa-file-excel me-2"></i>Export as Excel
|
|
</a></li>
|
|
<li><a class="dropdown-item" href="#" onclick="exportData('pdf')">
|
|
<i class="fa fa-file-pdf me-2"></i>Export as PDF
|
|
</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Emergency Contacts Table -->
|
|
<div class="table-responsive">
|
|
<table id="contacts-table" class="table table-striped table-bordered align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th width="30">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="select-all">
|
|
</div>
|
|
</th>
|
|
<th>Contact Name</th>
|
|
<th>Patient</th>
|
|
<th>Relationship</th>
|
|
<th>Priority</th>
|
|
<th>Phone Number</th>
|
|
<th>Email</th>
|
|
<th>Can Contact</th>
|
|
<th width="120">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<!-- Data will be loaded via AJAX -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
|
|
<!-- Contact Validation Modal -->
|
|
<div class="modal fade" id="contactValidationModal" tabindex="-1">
|
|
<div class="modal-dialog modal-xl">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Contact Validation Report</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<select class="form-select" id="validation-filter">
|
|
<option value="">All Issues</option>
|
|
<option value="missing_phone">Missing Phone</option>
|
|
<option value="invalid_phone">Invalid Phone</option>
|
|
<option value="missing_email">Missing Email</option>
|
|
<option value="invalid_email">Invalid Email</option>
|
|
<option value="no_primary">No Primary Contact</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<button class="btn btn-primary" onclick="runValidation()">
|
|
<i class="fa fa-check me-2"></i>Run Validation
|
|
</button>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<button class="btn btn-success" onclick="fixIssues()">
|
|
<i class="fa fa-wrench me-2"></i>Auto-Fix Issues
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div id="validation-results">
|
|
<!-- Content will be loaded dynamically -->
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-primary" onclick="exportValidationReport()">Export Report</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Quick Contact Modal -->
|
|
<div class="modal fade" id="quickContactModal" tabindex="-1">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Quick Contact</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body" id="quick-contact-content">
|
|
<!-- Content will be loaded dynamically -->
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-primary" onclick="callContact()">
|
|
<i class="fa fa-phone me-2"></i>Call Now
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script src="{% static 'plugins/datatables.net/js/dataTables.min.js' %}"></script>
|
|
<script src="{% static 'plugins/datatables.net-bs5/js/dataTables.bootstrap5.min.js' %}"></script>
|
|
<script src="{% static 'plugins/datatables.net-responsive/js/dataTables.responsive.min.js' %}"></script>
|
|
<script src="{% static 'plugins/datatables.net-responsive-bs5/js/responsive.bootstrap5.min.js' %}"></script>
|
|
<script src="{% static 'plugins/select2/dist/js/select2.min.js' %}"></script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
var table;
|
|
|
|
// Initialize DataTable
|
|
table = $('#contacts-table').DataTable({
|
|
processing: true,
|
|
serverSide: true,
|
|
ajax: {
|
|
url: '{% url "patients:emergency_contact_list_api" %}',
|
|
data: function(d) {
|
|
d.search_value = $('#search-input').val();
|
|
d.relationship = $('#relationship-filter').val();
|
|
d.priority = $('#priority-filter').val();
|
|
d.patient = $('#patient-filter').val();
|
|
}
|
|
},
|
|
columns: [
|
|
{
|
|
data: 'id',
|
|
orderable: false,
|
|
render: function(data, type, row) {
|
|
return '<div class="form-check"><input class="form-check-input contact-checkbox" type="checkbox" value="' + data + '"></div>';
|
|
}
|
|
},
|
|
{
|
|
data: 'full_name',
|
|
render: function(data, type, row) {
|
|
return '<div>' +
|
|
'<div class="fw-bold">' + data + '</div>' +
|
|
(row.address ? '<div class="text-muted small">' + row.address + '</div>' : '') +
|
|
'</div>';
|
|
}
|
|
},
|
|
{
|
|
data: 'patient_name',
|
|
render: function(data, type, row) {
|
|
return '<a href="' + row.patient_url + '" class="text-decoration-none">' +
|
|
'<div class="fw-bold">' + data + '</div>' +
|
|
'<div class="text-muted small">MRN: ' + row.patient_mrn + '</div>' +
|
|
'</a>';
|
|
}
|
|
},
|
|
{
|
|
data: 'relationship',
|
|
render: function(data, type, row) {
|
|
var colors = {
|
|
'SPOUSE': 'primary',
|
|
'PARENT': 'success',
|
|
'CHILD': 'info',
|
|
'SIBLING': 'warning',
|
|
'GUARDIAN': 'danger',
|
|
'OTHER': 'secondary'
|
|
};
|
|
return '<span class="badge bg-' + (colors[data] || 'secondary') + '">' + row.relationship_display + '</span>';
|
|
}
|
|
},
|
|
{
|
|
data: 'priority',
|
|
render: function(data, type, row) {
|
|
var colors = {
|
|
'PRIMARY': 'success',
|
|
'SECONDARY': 'warning',
|
|
'TERTIARY': 'info'
|
|
};
|
|
var icons = {
|
|
'PRIMARY': 'star',
|
|
'SECONDARY': 'star-half-alt',
|
|
'TERTIARY': 'star-o'
|
|
};
|
|
return '<span class="badge bg-' + (colors[data] || 'secondary') + '">' +
|
|
'<i class="fa fa-' + (icons[data] || 'star') + ' me-1"></i>' +
|
|
row.priority_display + '</span>';
|
|
}
|
|
},
|
|
{
|
|
data: 'phone_number',
|
|
render: function(data, type, row) {
|
|
if (data) {
|
|
return '<div>' +
|
|
'<a href="tel:' + data + '" class="text-decoration-none">' + data + '</a>' +
|
|
(row.mobile_number ? '<br><small class="text-muted">Mobile: ' + row.mobile_number + '</small>' : '') +
|
|
'</div>';
|
|
} else {
|
|
return '<span class="text-muted">No phone</span>';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
data: 'email',
|
|
render: function(data, type, row) {
|
|
if (data) {
|
|
return '<a href="mailto:' + data + '" class="text-decoration-none">' + data + '</a>';
|
|
} else {
|
|
return '<span class="text-muted">No email</span>';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
data: 'can_contact',
|
|
render: function(data, type, row) {
|
|
return '<div class="text-center">' +
|
|
'<i class="fa fa-' + (data ? 'check text-success' : 'times text-danger') + '"></i>' +
|
|
'</div>';
|
|
}
|
|
},
|
|
{
|
|
data: 'id',
|
|
orderable: false,
|
|
render: function(data, type, row) {
|
|
return '<div class="btn-group btn-group-sm">' +
|
|
'<button class="btn btn-outline-primary" onclick="viewContact(' + data + ')" title="View">' +
|
|
'<i class="fa fa-eye"></i></button>' +
|
|
'<button class="btn btn-outline-secondary" onclick="editContact(' + data + ')" title="Edit">' +
|
|
'<i class="fa fa-edit"></i></button>' +
|
|
'<button class="btn btn-outline-success" onclick="quickContact(' + data + ')" title="Quick Contact">' +
|
|
'<i class="fa fa-phone"></i></button>' +
|
|
'</div>';
|
|
}
|
|
}
|
|
],
|
|
order: [[2, 'asc'], [3, 'asc']],
|
|
pageLength: 25,
|
|
responsive: true,
|
|
language: {
|
|
processing: '<div class="d-flex justify-content-center"><div class="spinner-border" role="status"></div></div>'
|
|
}
|
|
});
|
|
|
|
// Initialize Select2
|
|
$('.select2').select2({
|
|
theme: 'bootstrap-5',
|
|
width: '100%'
|
|
});
|
|
|
|
// Load filter options and stats
|
|
loadFilterOptions();
|
|
loadStats();
|
|
|
|
// Filter event handlers
|
|
$('#search-input, #relationship-filter, #priority-filter, #patient-filter').on('change keyup', function() {
|
|
table.draw();
|
|
});
|
|
|
|
// Select all checkbox
|
|
$('#select-all').on('change', function() {
|
|
$('.contact-checkbox').prop('checked', this.checked);
|
|
updateBulkActions();
|
|
});
|
|
|
|
// Individual checkbox change
|
|
$(document).on('change', '.contact-checkbox', function() {
|
|
updateBulkActions();
|
|
});
|
|
|
|
// Auto-refresh every 5 minutes
|
|
setInterval(function() {
|
|
table.ajax.reload(null, false);
|
|
loadStats();
|
|
}, 300000);
|
|
});
|
|
|
|
function loadFilterOptions() {
|
|
// Load patient options
|
|
$.ajax({
|
|
url: '{% url "patients:patient_list_api" %}',
|
|
data: { 'format': 'select' },
|
|
success: function(data) {
|
|
var select = $('#patient-filter');
|
|
data.forEach(function(patient) {
|
|
select.append('<option value="' + patient.id + '">' + patient.name + ' (MRN: ' + patient.mrn + ')</option>');
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function loadStats() {
|
|
$.ajax({
|
|
url: '{% url "patients:emergency_contact_stats" %}',
|
|
success: function(data) {
|
|
$('#total-contacts').text(data.total_contacts);
|
|
$('#primary-contacts').text(data.primary_contacts);
|
|
$('#missing-phone').text(data.missing_phone);
|
|
$('#patients-covered').text(data.patients_covered);
|
|
}
|
|
});
|
|
}
|
|
|
|
function updateBulkActions() {
|
|
var checkedCount = $('.contact-checkbox:checked').length;
|
|
$('#bulk-actions-btn, #bulk-dropdown').prop('disabled', checkedCount === 0);
|
|
}
|
|
|
|
function viewContact(contactId) {
|
|
window.location.href = '{% url "patients:emergency_contact_detail" 0 %}'.replace('0', contactId);
|
|
}
|
|
|
|
function editContact(contactId) {
|
|
window.location.href = '{% url "patients:emergency_contact_update" 0 %}'.replace('0', contactId);
|
|
}
|
|
|
|
function quickContact(contactId) {
|
|
$.ajax({
|
|
url: '{% url "patients:emergency_contact_quick" 0 %}'.replace('0', contactId),
|
|
success: function(data) {
|
|
$('#quick-contact-content').html(data.html);
|
|
$('#quickContactModal').modal('show');
|
|
},
|
|
error: function() {
|
|
toastr.error('Failed to load contact information');
|
|
}
|
|
});
|
|
}
|
|
|
|
function bulkUpdatePriority() {
|
|
var selectedIds = $('.contact-checkbox:checked').map(function() {
|
|
return this.value;
|
|
}).get();
|
|
|
|
if (selectedIds.length === 0) {
|
|
toastr.warning('Please select contacts to update');
|
|
return;
|
|
}
|
|
|
|
// Implementation for bulk priority update
|
|
toastr.info('Bulk priority update functionality will be implemented');
|
|
}
|
|
|
|
function bulkSendNotification() {
|
|
var selectedIds = $('.contact-checkbox:checked').map(function() {
|
|
return this.value;
|
|
}).get();
|
|
|
|
if (selectedIds.length === 0) {
|
|
toastr.warning('Please select contacts to notify');
|
|
return;
|
|
}
|
|
|
|
// Implementation for bulk notification
|
|
toastr.info('Bulk notification functionality will be implemented');
|
|
}
|
|
|
|
function bulkExport() {
|
|
var selectedIds = $('.contact-checkbox:checked').map(function() {
|
|
return this.value;
|
|
}).get();
|
|
|
|
if (selectedIds.length === 0) {
|
|
toastr.warning('Please select contacts to export');
|
|
return;
|
|
}
|
|
|
|
window.location.href = '{% url "patients:emergency_contact_export" %}?ids=' + selectedIds.join(',');
|
|
}
|
|
|
|
function bulkDelete() {
|
|
var selectedIds = $('.contact-checkbox:checked').map(function() {
|
|
return this.value;
|
|
}).get();
|
|
|
|
if (selectedIds.length === 0) {
|
|
toastr.warning('Please select contacts to delete');
|
|
return;
|
|
}
|
|
|
|
if (confirm('Are you sure you want to delete ' + selectedIds.length + ' contact(s)?')) {
|
|
$.ajax({
|
|
url: '{% url "patients:emergency_contact_bulk_delete" %}',
|
|
method: 'POST',
|
|
data: {
|
|
'contact_ids': selectedIds,
|
|
'csrfmiddlewaretoken': '{{ csrf_token }}'
|
|
},
|
|
success: function(response) {
|
|
if (response.success) {
|
|
toastr.success(response.message);
|
|
$('#contacts-table').DataTable().ajax.reload();
|
|
$('#select-all').prop('checked', false);
|
|
updateBulkActions();
|
|
} else {
|
|
toastr.error('Failed to delete contacts');
|
|
}
|
|
},
|
|
error: function() {
|
|
toastr.error('An error occurred during bulk deletion');
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function exportData(format) {
|
|
window.location.href = '{% url "patients:emergency_contact_export" %}?format=' + format;
|
|
}
|
|
|
|
function refreshTable() {
|
|
$('#contacts-table').DataTable().ajax.reload();
|
|
loadStats();
|
|
toastr.info('Table refreshed');
|
|
}
|
|
|
|
function showContactValidation() {
|
|
$('#contactValidationModal').modal('show');
|
|
runValidation();
|
|
}
|
|
|
|
function runValidation() {
|
|
$.ajax({
|
|
url: '{% url "patients:emergency_contact_validation" %}',
|
|
success: function(data) {
|
|
$('#validation-results').html(data.html);
|
|
},
|
|
error: function() {
|
|
toastr.error('Failed to run contact validation');
|
|
}
|
|
});
|
|
}
|
|
|
|
function fixIssues() {
|
|
// Implementation for auto-fixing contact issues
|
|
toastr.info('Auto-fix functionality will be implemented');
|
|
}
|
|
|
|
function exportValidationReport() {
|
|
window.open('{% url "patients:emergency_contact_validation_report" %}', '_blank');
|
|
}
|
|
|
|
function callContact() {
|
|
// Implementation for calling contact
|
|
toastr.info('Call functionality will be implemented');
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|