NexLab_System / templates /call_centre.html
alisaleem97's picture
Upload folder using huggingface_hub
6ea020b verified
Raw History Blame Contribute Delete
17.1 kB
{% extends "base.html" %}
{% block title %}Call Centre - NexLab{% endblock %}
{% block page_title %}Call Centre Page{% endblock %}
{% block content %}
<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">
<div class="p-6 border-b border-slate-200 bg-white">
<form id="filterForm" method="GET" action="/call-centre">
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6">
<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 flex justify-center items-center gap-2 h-[38px]">
<i class="fas fa-search"></i> Search
</button>
</div>
</div>
<div class="w-full border-t border-slate-200 mb-6"></div>
<div class="flex flex-wrap justify-center gap-12 items-center">
<div class="flex flex-col items-center justify-center gap-2">
<span class="text-sm font-bold text-slate-700">Pending</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="radio" name="status_filter" value="Pending" class="sr-only peer" {% if
filters.status_filter=='Pending' %}checked{% endif %}
onchange="document.getElementById('filterForm').submit()">
<div
class="w-11 h-6 bg-[#b91c1c] rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#65a30d]">
</div>
</label>
</div>
<div class="flex flex-col items-center justify-center gap-2">
<span class="text-sm font-bold text-slate-700">Not Done</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="radio" name="status_filter" value="Not Done" class="sr-only peer" {% if
filters.status_filter=='Not Done' %}checked{% endif %}
onchange="document.getElementById('filterForm').submit()">
<div
class="w-11 h-6 bg-[#b91c1c] rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#65a30d]">
</div>
</label>
</div>
<div class="flex flex-col items-center justify-center gap-2">
<span class="text-sm font-bold text-slate-700">Call Done</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="radio" name="status_filter" value="Call done" class="sr-only peer" {% if
filters.status_filter=='Call done' %}checked{% endif %}
onchange="document.getElementById('filterForm').submit()">
<div
class="w-11 h-6 bg-[#b91c1c] rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#65a30d]">
</div>
</label>
</div>
<div class="flex flex-col items-center justify-center gap-2">
<span class="text-sm font-bold text-slate-700">All</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="radio" name="status_filter" value="All" class="sr-only peer" {% if
filters.status_filter=='All' %}checked{% endif %}
onchange="document.getElementById('filterForm').submit()">
<div
class="w-11 h-6 bg-[#b91c1c] rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#65a30d]">
</div>
</label>
</div>
</div>
</form>
</div>
<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">
Registration Date</th>
<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">Name
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">
Age/Gender</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Phone
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Tests
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Status
</th>
<th class="px-6 py-3 text-center text-xs font-medium text-slate-500 uppercase tracking-wider">Alarm
</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='/view-call-centre/{{ item.visit.visit_id }}'">
<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-mono text-slate-600">{{ item.patient.patient_id
}}</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">
<div class="flex items-center gap-2">
<span>{{ item.patient.age }} {{ item.patient.age_unit or 'year' }}{{ 's' if item.patient.age
and item.patient.age > 1 else '' }}</span>
<span
class="px-2.5 py-0.5 rounded-full text-xs font-medium {{ 'bg-blue-100 text-blue-700' if item.patient.gender == 'male' else 'bg-pink-100 text-pink-700' }}">
{{ item.patient.gender|capitalize }}
</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-slate-600">
<span class="flex items-center gap-1">
<i class="fas fa-phone text-slate-400 text-xs"></i>
{{ item.patient.phone_key }}{{ item.patient.phone_number }}
</span>
</td>
<td class="px-6 py-4">
<div class="text-sm text-slate-600 max-w-xs truncate" title="{{ item.tests_names }}">
{{ item.tests_names }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
<span class="px-3 py-1 rounded-full text-xs font-semibold shadow-sm
{% if item.status_color == 'amber' %}bg-amber-100 text-amber-800
{% elif item.status_color == 'blue' %}bg-blue-100 text-blue-800
{% elif item.status_color == 'emerald' %}bg-emerald-100 text-emerald-800
{% else %}bg-slate-100 text-slate-800
{% endif %}">
{{ item.status }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-center">
<div class="flex items-center justify-center gap-3">
{% if item.is_called %}
<span
class="px-3 py-1 bg-emerald-600 text-white text-[10px] font-bold rounded-full shadow-sm uppercase tracking-wide"
title="Patient Called">
Called
</span>
{% endif %}
{% if item.is_printed %}
<span
class="px-3 py-1 bg-blue-600 text-white text-[10px] font-bold rounded-full shadow-sm uppercase tracking-wide"
title="Results Printed">
Printed
</span>
{% endif %}
{% if item.alarm %}
<span class="flex items-center justify-center" title="Overdue (Pending > 4h)">
<div class="relative flex h-3 w-3">
<span
class="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-3 w-3 bg-red-500"></span>
</div>
</span>
{% endif %}
{% if not item.alarm and not item.is_called and not item.is_printed %}
<span class="text-slate-300">—</span>
{% endif %}
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="8" 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 records found</p>
<p class="text-sm text-slate-400 mt-1">Try adjusting your search criteria or toggles</p>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<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="/call-centre" 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="/call-centre?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_filter={{ filters.status_filter }}"
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="/call-centre?page={{ p }}&start_date={{ filters.start_date }}&end_date={{ filters.end_date }}&name={{ filters.name }}&patient_id={{ filters.patient_id }}&test={{ filters.test }}&status_filter={{ filters.status_filter }}"
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="/call-centre?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_filter={{ filters.status_filter }}"
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",
altInput: true,
altFormat: "d/m/Y",
allowInput: true
});
});
</script>
{% endblock %}