HH/templates/surveys/his_patient_review.html
2026-02-22 08:35:53 +03:00

224 lines
12 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Review Imported Patients" %} - PX360{% endblock %}
{% block content %}
<!-- Page Header -->
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-6">
<div>
<div class="flex items-center gap-2 mb-2">
<a href="{% url 'surveys:his_patient_import' %}" class="text-blue hover:text-navy transition flex items-center gap-1">
<i data-lucide="arrow-left" class="w-5 h-5"></i>
<span class="text-sm font-medium">{% trans "Back to Import" %}</span>
</a>
</div>
<h1 class="text-2xl font-bold text-navy flex items-center gap-3">
<i data-lucide="users" class="w-7 h-7 text-blue"></i>
{% trans "Review Imported Patients" %}
</h1>
<p class="text-slate mt-1 flex items-center gap-4">
<span class="flex items-center gap-1">
<i data-lucide="building-2" class="w-4 h-4"></i>
{{ hospital.name }}
</span>
<span class="text-slate-300">|</span>
<span class="flex items-center gap-1">
<i data-lucide="database" class="w-4 h-4"></i>
{% trans "Total Records:" %} {{ total_count }}
</span>
</p>
</div>
</div>
<!-- Errors (if any) -->
{% if errors %}
<div class="bg-red-50 border border-red-200 rounded-2xl p-6 mb-6 shadow-sm">
<h3 class="text-sm font-bold text-red-800 mb-3 flex items-center gap-2">
<i data-lucide="alert-triangle" class="w-5 h-5"></i>
{% trans "Import Errors" %} ({{ errors|length }})
</h3>
<div class="max-h-40 overflow-y-auto space-y-1">
{% for error in errors %}
<p class="text-xs text-red-700 flex items-start gap-2">
<span class="mt-1.5 w-1 h-1 bg-red-600 rounded-full flex-shrink-0"></span>
{{ error }}
</p>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Patient Table -->
<div class="bg-white rounded-2xl shadow-sm border border-slate-100 overflow-hidden">
<form method="post">
{% csrf_token %}
<div class="p-6">
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-6">
<h2 class="text-lg font-bold text-navy flex items-center gap-2">
<i data-lucide="list" class="w-5 h-5 text-blue"></i>
{% trans "Patient Records" %}
</h2>
<div class="flex gap-2">
<button type="button" onclick="selectAll()" class="px-4 py-2 border border-slate-200 text-slate rounded-xl font-medium hover:bg-light transition flex items-center gap-2 text-sm">
<i data-lucide="check-square" class="w-4 h-4"></i>
{% trans "Select All" %}
</button>
<button type="button" onclick="deselectAll()" class="px-4 py-2 border border-slate-200 text-slate rounded-xl font-medium hover:bg-light transition flex items-center gap-2 text-sm">
<i data-lucide="square" class="w-4 h-4"></i>
{% trans "Deselect All" %}
</button>
</div>
</div>
<div class="overflow-x-auto border border-slate-200 rounded-xl">
<table class="w-full text-sm">
<thead class="bg-slate-50 border-b border-slate-200">
<tr class="text-xs font-bold text-slate uppercase tracking-wider">
<th class="px-4 py-3 text-left w-12">
<input type="checkbox" id="select-all-checkbox" class="w-4 h-4 rounded border-slate-300 text-blue focus:ring-blue">
</th>
<th class="px-4 py-3 text-left">{% trans "File Number" %}</th>
<th class="px-4 py-3 text-left">{% trans "Patient Name" %}</th>
<th class="px-4 py-3 text-left">{% trans "Mobile" %}</th>
<th class="px-4 py-3 text-left">{% trans "Visit Type" %}</th>
<th class="px-4 py-3 text-left">{% trans "Admit Date" %}</th>
<th class="px-4 py-3 text-left">{% trans "Discharge Date" %}</th>
<th class="px-4 py-3 text-left">{% trans "Status" %}</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
{% for patient in patients %}
<tr class="hover:bg-light/30 transition">
<td class="px-4 py-3">
<input type="checkbox" name="selected_patients" value="{{ patient.file_number }}"
class="patient-checkbox w-4 h-4 rounded border-slate-300 text-blue focus:ring-blue">
</td>
<td class="px-4 py-3 font-mono text-xs text-slate">{{ patient.file_number }}</td>
<td class="px-4 py-3">
<div class="font-medium text-navy">{{ patient.patient_name }}</div>
<div class="text-xs text-slate mt-0.5 flex items-center gap-2">
<span>{{ patient.gender|default:"-" }}</span>
<span class="text-slate-300"></span>
<span>{{ patient.nationality|default:"-" }}</span>
</div>
</td>
<td class="px-4 py-3 font-mono text-xs text-slate">{{ patient.mobile_no|default:"-" }}</td>
<td class="px-4 py-3">
{% if patient.visit_type == 'EMERGENCY' %}
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-bold bg-red-100 text-red-800">
{{ patient.visit_type|default:"-" }}
</span>
{% elif patient.visit_type == 'INPATIENT' %}
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-bold bg-blue-100 text-blue-800">
{{ patient.visit_type|default:"-" }}
</span>
{% elif patient.visit_type %}
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-bold bg-slate-100 text-slate-800">
{{ patient.visit_type }}
</span>
{% else %}
<span class="text-slate-400">-</span>
{% endif %}
</td>
<td class="px-4 py-3 text-xs text-slate">{{ patient.admit_date|default:"-" }}</td>
<td class="px-4 py-3 text-xs text-slate">{{ patient.discharge_date|default:"-" }}</td>
<td class="px-4 py-3">
{% if patient.exists %}
<span class="inline-flex items-center gap-1 px-2.5 py-1 rounded-lg text-xs font-bold bg-yellow-100 text-yellow-800">
<i data-lucide="user-check" class="w-3 h-3"></i>
{% trans "Exists" %}
</span>
{% else %}
<span class="inline-flex items-center gap-1 px-2.5 py-1 rounded-lg text-xs font-bold bg-green-100 text-green-800">
<i data-lucide="user-plus" class="w-3 h-3"></i>
{% trans "New" %}
</span>
{% endif %}
</td>
</tr>
{% empty %}
<tr>
<td colspan="8" class="px-8 py-12 text-center text-slate">
<div class="inline-flex items-center justify-center w-16 h-16 bg-slate-100 rounded-full mb-4">
<i data-lucide="inbox" class="w-8 h-8 text-slate-400"></i>
</div>
<p class="text-sm font-medium text-slate">{% trans "No patients found in import data." %}</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Actions -->
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mt-6 pt-6 border-t border-slate-200">
<p class="text-sm text-slate flex items-center gap-2">
<i data-lucide="check-circle-2" class="w-4 h-4 text-blue"></i>
<span class="font-medium"><span id="selected-count">0</span></span>
{% trans "patients selected" %}
</p>
<div class="flex gap-3 w-full sm:w-auto">
<button type="submit" name="action" value="cancel" class="flex-1 sm:flex-none px-6 py-3 border border-slate-200 text-slate rounded-xl font-semibold hover:bg-light transition flex items-center justify-center gap-2">
<i data-lucide="x" class="w-5 h-5"></i>
{% trans "Cancel" %}
</button>
<button type="submit" name="action" value="create" class="flex-1 sm:flex-none px-6 py-3 bg-navy text-white rounded-xl font-semibold hover:bg-blue transition flex items-center justify-center gap-2 shadow-sm">
<i data-lucide="user-plus" class="w-5 h-5"></i>
{% trans "Create Patients & Continue" %}
</button>
</div>
</div>
</div>
</form>
</div>
<script>
// Global functions for select all/deselect all buttons
function selectAll() {
const patientCheckboxes = document.querySelectorAll('.patient-checkbox');
const selectAllCheckbox = document.getElementById('select-all-checkbox');
patientCheckboxes.forEach(cb => cb.checked = true);
selectAllCheckbox.checked = true;
updateSelectedCount();
}
function deselectAll() {
const patientCheckboxes = document.querySelectorAll('.patient-checkbox');
const selectAllCheckbox = document.getElementById('select-all-checkbox');
patientCheckboxes.forEach(cb => cb.checked = false);
selectAllCheckbox.checked = false;
updateSelectedCount();
}
function updateSelectedCount() {
const checked = document.querySelectorAll('.patient-checkbox:checked').length;
const selectedCountSpan = document.getElementById('selected-count');
if (selectedCountSpan) {
selectedCountSpan.textContent = checked;
}
}
// Initialize Lucide icons and setup event listeners
document.addEventListener('DOMContentLoaded', function() {
lucide.createIcons();
// Select all functionality
const selectAllCheckbox = document.getElementById('select-all-checkbox');
const patientCheckboxes = document.querySelectorAll('.patient-checkbox');
selectAllCheckbox.addEventListener('change', function() {
patientCheckboxes.forEach(cb => cb.checked = this.checked);
updateSelectedCount();
});
patientCheckboxes.forEach(cb => {
cb.addEventListener('change', updateSelectedCount);
});
updateSelectedCount();
});
</script>
{% endblock %}