Spaces:
Sleeping
Sleeping
Download templates/double_auth_patients.html from alisaleem97/NexLab_System: direct link, hf CLI and curl.
- Browser
- Download file 18.1 kB
-
https://huggingface.co/spaces/alisaleem97/NexLab_System/resolve/main/templates/double_auth_patients.html
- Command line
-
hf download hf://spaces/alisaleem97/NexLab_System/templates/double_auth_patients.html
-
curl -L -o double_auth_patients.html https://huggingface.co/spaces/alisaleem97/NexLab_System/resolve/main/templates/double_auth_patients.html
18.1 kB
| <!-- templates/result_entry_patients.html --> | |
| {% extends "base.html" %} | |
| {% block title %}Double Authorisation - Select Patient - NexLab{% endblock %} | |
| {% block page_title %}Double Authorisation{% endblock %} | |
| {% block content %} | |
| <!-- Flatpickr Datepicker Dependencies --> | |
| <link rel="stylesheet" href="/static/vendor/flatpickr/flatpickr.min.css"> | |
| <script src="/static/vendor/flatpickr/flatpickr.min.js"></script> | |
| <div class="bg-white rounded-3xl shadow-sm border border-slate-200 overflow-hidden"> | |
| <!-- Filters --> | |
| <div class="p-6 border-b border-slate-200 bg-slate-50"> | |
| <form id="filterForm" method="GET" action="/double-auth" class="space-y-6"> | |
| <div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-6 gap-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-slate-700 mb-1">Start Date</label> | |
| <input type="text" name="start_date" value="{{ filters.start_date }}" class="datepicker w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm text-slate-600 bg-white"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-slate-700 mb-1">End Date</label> | |
| <input type="text" name="end_date" value="{{ filters.end_date }}" class="datepicker w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm text-slate-600 bg-white"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-slate-700 mb-1">Name</label> | |
| <input type="text" name="name" value="{{ filters.name }}" placeholder="Patient Name" class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm text-slate-600"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-slate-700 mb-1">Patient ID</label> | |
| <input type="text" name="patient_id" value="{{ filters.patient_id }}" placeholder="Patient ID" class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm text-slate-600"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-slate-700 mb-1">Test</label> | |
| <input type="text" name="test" value="{{ filters.test }}" placeholder="Test Name or Code" class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm text-slate-600"> | |
| </div> | |
| <div class="flex items-end"> | |
| <button type="submit" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition duration-200 shadow-sm"> | |
| 🔍 Search | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Status Toggles --> | |
| <div class="flex flex-wrap items-center justify-center gap-x-12 gap-y-4 pt-4 border-t border-slate-200"> | |
| <input type="hidden" name="status" id="statusFilter" value="{{ filters.status or 'all' }}"> | |
| <label class="flex flex-col items-center gap-2 cursor-pointer toggle-label" data-value="pending"> | |
| <span class="text-sm font-semibold text-slate-700" style="color: #212529;">Pending</span> | |
| <div class="relative"> | |
| <div class="block w-12 h-6 rounded-full transition-colors duration-200 toggle-bg shadow-inner"></div> | |
| <div class="dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition transform duration-200 ease-in-out shadow"></div> | |
| </div> | |
| </label> | |
| <label class="flex flex-col items-center gap-2 cursor-pointer toggle-label" data-value="received"> | |
| <span class="text-sm font-semibold text-slate-700" style="color: #212529;">Received</span> | |
| <div class="relative"> | |
| <div class="block w-12 h-6 rounded-full transition-colors duration-200 toggle-bg shadow-inner"></div> | |
| <div class="dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition transform duration-200 ease-in-out shadow"></div> | |
| </div> | |
| </label> | |
| <label class="flex flex-col items-center gap-2 cursor-pointer toggle-label" data-value="authorize"> | |
| <span class="text-sm font-semibold text-slate-700" style="color: #212529;">Authorize</span> | |
| <div class="relative"> | |
| <div class="block w-12 h-6 rounded-full transition-colors duration-200 toggle-bg shadow-inner"></div> | |
| <div class="dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition transform duration-200 ease-in-out shadow"></div> | |
| </div> | |
| </label> | |
| <label class="flex flex-col items-center gap-2 cursor-pointer toggle-label" data-value="double_authorized"> | |
| <span class="text-sm font-semibold text-slate-700" style="color: #212529;">Double Authorized</span> | |
| <div class="relative"> | |
| <div class="block w-12 h-6 rounded-full transition-colors duration-200 toggle-bg shadow-inner"></div> | |
| <div class="dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition transform duration-200 ease-in-out shadow"></div> | |
| </div> | |
| </label> | |
| <label class="flex flex-col items-center gap-2 cursor-pointer toggle-label" data-value="AD"> | |
| <span class="text-sm font-semibold text-slate-700" style="color: #212529;">AD</span> | |
| <div class="relative"> | |
| <div class="block w-12 h-6 rounded-full transition-colors duration-200 toggle-bg shadow-inner"></div> | |
| <div class="dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition transform duration-200 ease-in-out shadow"></div> | |
| </div> | |
| </label> | |
| <label class="flex flex-col items-center gap-2 cursor-pointer toggle-label" data-value="all"> | |
| <span class="text-sm font-semibold text-slate-700" style="color: #212529;">All</span> | |
| <div class="relative"> | |
| <div class="block w-12 h-6 rounded-full transition-colors duration-200 toggle-bg shadow-inner"></div> | |
| <div class="dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition transform duration-200 ease-in-out shadow"></div> | |
| </div> | |
| </label> | |
| </div> | |
| </form> | |
| </div> | |
| <!-- Patient Table --> | |
| <div class="overflow-x-auto"> | |
| <table class="min-w-full divide-y divide-slate-200"> | |
| <thead class="bg-slate-50"> | |
| <tr> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Patient ID</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Registration Date</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Name</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Age</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Gender</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Patient tests</th> | |
| <th class="px-6 py-3 text-right text-xs font-medium text-slate-500 uppercase tracking-wider">Action</th> | |
| </tr> | |
| </thead> | |
| <tbody class="bg-white divide-y divide-slate-200"> | |
| {% for item in patient_data %} | |
| <tr class="hover:bg-slate-50 transition cursor-pointer" onclick="window.location.href='/double-auth/{{ item.patient.patient_id }}?visit_id={{ item.visit.visit_id }}'"> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-mono text-slate-600">{{ item.patient.patient_id }}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-600">{{ item.registration_date.strftime('%Y-%m-%d %H:%M') if item.registration_date else '' }}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-800">{{ item.patient.full_name }}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-600"> | |
| {{ item.patient.age }} {{ item.patient.age_unit or 'year' }}{{ 's' if item.patient.age and item.patient.age > 1 else '' }} | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm"> | |
| <span class="px-2 py-1 rounded-full text-xs {{ 'bg-blue-100 text-blue-800' if item.patient.gender == 'male' else 'bg-pink-100 text-pink-800' }}"> | |
| {{ item.patient.gender|capitalize }} | |
| </span> | |
| </td> | |
| <td class="px-6 py-4"> | |
| <div class="flex flex-wrap gap-2"> | |
| {% for test_item in item.tests %} | |
| {% if test_item.is_package %} | |
| <div class="flex flex-col border border-slate-200 rounded-lg p-2 bg-slate-50 gap-1 w-full max-w-sm shadow-sm"> | |
| <span class="text-xs font-bold text-slate-700 uppercase tracking-wide border-b border-slate-200 pb-1 mb-1">📦 {{ test_item.package_name }}</span> | |
| <div class="flex flex-wrap gap-1"> | |
| {% for t in test_item.tests %} | |
| <span class="px-2 py-1 text-xs font-medium rounded-full text-white shadow-sm | |
| {% if t.color == 'red' %}bg-red-500 | |
| {% elif t.color == 'blue' %}bg-blue-500 | |
| {% elif t.color == 'purple' %}bg-purple-500 | |
| {% else %}bg-emerald-500 | |
| {% endif %}"> | |
| {{ t.name }} | |
| </span> | |
| {% endfor %} | |
| </div> | |
| </div> | |
| {% else %} | |
| <span class="px-3 py-1 text-xs font-semibold rounded-full text-white shadow-sm inline-flex items-center | |
| {% if test_item.test.color == 'red' %}bg-red-500 | |
| {% elif test_item.test.color == 'blue' %}bg-blue-500 | |
| {% elif test_item.test.color == 'purple' %}bg-purple-500 | |
| {% else %}bg-emerald-500 | |
| {% endif %}"> | |
| {{ test_item.test.name }} | |
| </span> | |
| {% endif %} | |
| {% endfor %} | |
| {% if not item.tests %} | |
| <span class="text-slate-400 text-sm italic">No tests ordered</span> | |
| {% endif %} | |
| </div> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> | |
| <a href="/double-auth/{{ item.patient.patient_id }}?visit_id={{ item.visit.visit_id }}" | |
| class="inline-flex items-center gap-2 bg-emerald-50 text-emerald-700 hover:bg-emerald-600 hover:text-white border border-emerald-200 px-3 py-1.5 rounded-lg text-sm font-medium transition" onclick="event.stopPropagation()"> | |
| <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path></svg> | |
| Enter | |
| </a> | |
| </td> | |
| </tr> | |
| {% else %} | |
| <tr> | |
| <td colspan="6" class="px-6 py-12 text-center text-slate-500"> | |
| <div class="flex flex-col items-center justify-center"> | |
| <svg class="w-12 h-12 text-slate-300 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"></path></svg> | |
| <p class="text-base text-slate-600 font-medium">No patients found</p> | |
| <p class="text-sm text-slate-400 mt-1">Try adjusting your search criteria</p> | |
| </div> | |
| </td> | |
| </tr> | |
| {% endfor %} | |
| </tbody> | |
| </table> | |
| </div> | |
| <!-- Footer with Pagination --> | |
| <div class="p-4 border-t border-slate-200 bg-slate-50"> | |
| <div class="flex flex-col sm:flex-row items-center justify-between gap-3"> | |
| <p class="text-sm text-slate-600"> | |
| Showing <strong>{{ patient_data|length }}</strong> of <strong>{{ total_count }}</strong> visit(s) | |
| <a href="/double-auth" class="text-indigo-600 hover:text-indigo-900 font-medium ml-2">Clear filters</a> | |
| </p> | |
| {% if total_pages > 1 %} | |
| <nav class="flex items-center gap-1"> | |
| {% if page > 1 %} | |
| <a href="/double-auth?page={{ page - 1 }}&start_date={{ filters.start_date }}&end_date={{ filters.end_date }}&name={{ filters.name }}&patient_id={{ filters.patient_id }}&test={{ filters.test }}&status={{ filters.status }}" | |
| class="px-3 py-1.5 text-sm font-medium text-slate-600 bg-white border border-slate-300 rounded-lg hover:bg-slate-100 transition"> | |
| ← Prev | |
| </a> | |
| {% endif %} | |
| {% for p in range(1, total_pages + 1) %} | |
| {% if p == page %} | |
| <span class="px-3 py-1.5 text-sm font-bold text-white bg-indigo-600 rounded-lg">{{ p }}</span> | |
| {% elif p == 1 or p == total_pages or (p >= page - 2 and p <= page + 2) %} | |
| <a href="/double-auth?page={{ p }}&start_date={{ filters.start_date }}&end_date={{ filters.end_date }}&name={{ filters.name }}&patient_id={{ filters.patient_id }}&test={{ filters.test }}&status={{ filters.status }}" | |
| class="px-3 py-1.5 text-sm font-medium text-slate-600 bg-white border border-slate-300 rounded-lg hover:bg-slate-100 transition"> | |
| {{ p }} | |
| </a> | |
| {% elif p == page - 3 or p == page + 3 %} | |
| <span class="px-2 text-slate-400">…</span> | |
| {% endif %} | |
| {% endfor %} | |
| {% if page < total_pages %} | |
| <a href="/double-auth?page={{ page + 1 }}&start_date={{ filters.start_date }}&end_date={{ filters.end_date }}&name={{ filters.name }}&patient_id={{ filters.patient_id }}&test={{ filters.test }}&status={{ filters.status }}" | |
| class="px-3 py-1.5 text-sm font-medium text-slate-600 bg-white border border-slate-300 rounded-lg hover:bg-slate-100 transition"> | |
| Next → | |
| </a> | |
| {% endif %} | |
| </nav> | |
| {% endif %} | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', () => { | |
| flatpickr(".datepicker", { | |
| dateFormat: "Y-m-d", // Formats backend natively | |
| altInput: true, // Visually converts the input to dd/mm/yyyy | |
| altFormat: "d/m/Y", | |
| allowInput: true // Allows manual typing | |
| }); | |
| const statusInput = document.getElementById('statusFilter'); | |
| const toggles = document.querySelectorAll('.toggle-label'); | |
| function updateToggles(activeValue) { | |
| toggles.forEach(lbl => { | |
| const val = lbl.dataset.value; | |
| const bg = lbl.querySelector('.toggle-bg'); | |
| const dot = lbl.querySelector('.dot'); | |
| const isActive = (val === activeValue); | |
| // Red (#a42a2a approx) for inactive, Green (#69b139 approx) for active | |
| if (isActive) { | |
| bg.style.backgroundColor = '#62ad35'; | |
| dot.style.transform = 'translateX(24px)'; | |
| } else { | |
| bg.style.backgroundColor = '#a72525'; | |
| dot.style.transform = 'translateX(0)'; | |
| } | |
| }); | |
| } | |
| toggles.forEach(lbl => { | |
| lbl.addEventListener('click', (e) => { | |
| const val = lbl.dataset.value; | |
| if (statusInput.value !== val) { | |
| statusInput.value = val; | |
| updateToggles(val); | |
| document.getElementById('filterForm').submit(); | |
| } | |
| }); | |
| }); | |
| // Initialize toggle states | |
| updateToggles(statusInput.value); | |
| }); | |
| </script> | |
| {% endblock %} | |