File size: 13,858 Bytes
6ea020b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!-- templates/dashboard.html -->
{% extends "base.html" %}

{% block title %}Dashboard - NexLab{% endblock %}
{% block page_title %}System Dashboard{% endblock %}

{% block content %}
<div class="space-y-6 pb-12">

    <!-- PATIENT NUMBERS SECTION -->
    <div>
        <h2 class="text-lg font-bold text-slate-800 mb-3 border-b pb-2">Patients Numbers Section</h2>
        <div class="grid grid-cols-2 md:grid-cols-5 gap-4">
            <div

                class="bg-white rounded-xl shadow-sm border border-slate-200 p-4 flex flex-col hover:shadow-md transition-shadow">
                <span class="text-sm font-medium text-slate-500 uppercase tracking-wide">Total Patients (Today)</span>
                <span class="text-3xl font-extrabold text-indigo-600 mt-2">{{ dash.today_patients }}</span>
            </div>
            <div

                class="bg-white rounded-xl shadow-sm border border-slate-200 p-4 flex flex-col hover:shadow-md transition-shadow">
                <span class="text-sm font-medium text-slate-500 uppercase tracking-wide">Pending</span>
                <span class="text-3xl font-extrabold text-amber-500 mt-2">{{ dash.pending_patients }}</span>
                <span class="text-xs text-slate-400 mt-1">Has un-authorized tests</span>
            </div>
            <div

                class="bg-white rounded-xl shadow-sm border border-slate-200 p-4 flex flex-col hover:shadow-md transition-shadow">
                <span class="text-sm font-medium text-slate-500 uppercase tracking-wide">Waiting</span>
                <span class="text-3xl font-extrabold text-blue-500 mt-2">{{ dash.waiting_patients }}</span>
                <span class="text-xs text-slate-400 mt-1">Pending Double Auth</span>
            </div>
            <div

                class="bg-white rounded-xl shadow-sm border border-slate-200 p-4 flex flex-col hover:shadow-md transition-shadow">
                <span class="text-sm font-medium text-slate-500 uppercase tracking-wide">Done</span>
                <span class="text-3xl font-extrabold text-emerald-500 mt-2">{{ dash.done_patients }}</span>
                <span class="text-xs text-slate-400 mt-1">All tests Double Auth</span>
            </div>
            <div

                class="bg-white rounded-xl shadow-sm border border-slate-200 p-4 flex flex-col hover:shadow-md transition-shadow">
                <span class="text-sm font-medium text-slate-500 uppercase tracking-wide">Deleted</span>
                <span class="text-3xl font-extrabold text-red-500 mt-2">{{ dash.deleted_patients }}</span>
                <span class="text-xs text-slate-400 mt-1">Total removed</span>
            </div>
        </div>
    </div>

    <!-- CALL CENTRE SECTION -->
    <div>
        <h2 class="text-lg font-bold text-slate-800 mb-3 border-b pb-2">Call Centre Section</h2>
        <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
            <div

                class="bg-gradient-to-br from-indigo-50 to-white rounded-xl shadow-sm border border-indigo-100 p-4 flex items-center justify-between">
                <div>
                    <h3 class="text-sm font-medium text-indigo-800 uppercase tracking-wide">Total</h3>
                    <p class="text-xs text-indigo-500">Done Patients</p>
                </div>
                <div class="text-3xl font-extrabold text-indigo-600">{{ dash.call_center_total }}</div>
            </div>
            <div

                class="bg-gradient-to-br from-emerald-50 to-white rounded-xl shadow-sm border border-emerald-100 p-4 flex items-center justify-between">
                <div>
                    <h3 class="text-sm font-medium text-emerald-800 uppercase tracking-wide">Sent</h3>
                    <p class="text-xs text-emerald-500">Called Patients</p>
                </div>
                <div class="text-3xl font-extrabold text-emerald-600">{{ dash.call_center_sent }}</div>
            </div>
            <div

                class="bg-gradient-to-br from-rose-50 to-white rounded-xl shadow-sm border border-rose-100 p-4 flex items-center justify-between">
                <div>
                    <h3 class="text-sm font-medium text-rose-800 uppercase tracking-wide">Not Sent</h3>
                    <p class="text-xs text-rose-500">Pending Call</p>
                </div>
                <div class="text-3xl font-extrabold text-rose-600">{{ dash.call_center_not_sent }}</div>
            </div>
        </div>
    </div>

    <!-- GENERAL INFO SECTION -->
    <div>
        <h2 class="text-lg font-bold text-slate-800 mb-3 border-b pb-2">General Info Section</h2>
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">

            <!-- Critical Value Alerts -->
            <div class="bg-white rounded-xl shadow-sm border border-red-200 overflow-hidden lg:col-span-2">
                <div class="bg-red-50 px-4 py-3 border-b border-red-100 flex items-center justify-between">
                    <h3 class="font-bold text-red-800 flex items-center">
                        <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"

                                d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z">
                            </path>
                        </svg>
                        Critical Value Alerts
                    </h3>
                </div>
                <div class="p-0 max-h-[300px] overflow-y-auto">
                    {% if dash.critical_alerts %}
                    <table class="min-w-full divide-y divide-slate-100">
                        <thead class="bg-slate-50 sticky top-0">
                            <tr>
                                <th class="px-4 py-2 text-left text-xs font-medium text-slate-500 uppercase">Patient
                                </th>
                                <th class="px-4 py-2 text-left text-xs font-medium text-slate-500 uppercase">Test</th>
                                <th class="px-4 py-2 text-left text-xs font-medium text-slate-500 uppercase">Value</th>
                                <th class="px-4 py-2 text-left text-xs font-medium text-slate-500 uppercase">Date</th>
                            </tr>
                        </thead>
                        <tbody class="divide-y divide-slate-100">
                            {% for alert in dash.critical_alerts %}
                            <tr class="hover:bg-red-50/50 transition-colors">
                                <td class="px-4 py-2 whitespace-nowrap text-sm font-medium text-slate-800">{{
                                    alert.patient_name }} <span class="text-xs text-slate-400">({{ alert.patient_id
                                        }})</span></td>
                                <td class="px-4 py-2 whitespace-nowrap text-sm text-slate-600">{{ alert.test_name }}
                                </td>
                                <td class="px-4 py-2 whitespace-nowrap text-sm font-bold text-red-600 bg-red-50/30">{{
                                    alert.value }}</td>
                                <td class="px-4 py-2 whitespace-nowrap text-xs text-slate-500">{{ alert.date }}</td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                    {% else %}
                    <div class="p-8 text-center text-slate-500">
                        <p>No critical value alerts found.</p>
                    </div>
                    {% endif %}
                </div>
            </div>

            <div class="space-y-6">
                <!-- Patient Demographics -->
                <div class="bg-white rounded-xl shadow-sm border border-slate-200">
                    <div class="px-4 py-3 border-b border-slate-100">
                        <h3 class="font-bold text-slate-800">Patient Demographics</h3>
                    </div>
                    <div class="p-6">
                        <div class="flex items-center justify-between mb-2">
                            <span class="text-sm text-slate-600 flex items-center">
                                <span class="w-3 h-3 rounded-full bg-blue-500 mr-2"></span> Male
                            </span>
                            <span class="font-bold text-slate-800">{{ dash.males }}</span>
                        </div>
                        <div class="w-full bg-slate-100 rounded-full h-2 mb-4">
                            {% set total_gender = (dash.males + dash.females) or 1 %}
                            <div class="bg-blue-500 h-2 rounded-full"

                                style="width: {{ (dash.males / total_gender * 100)|round }}%"></div>
                        </div>

                        <div class="flex items-center justify-between mb-2">
                            <span class="text-sm text-slate-600 flex items-center">
                                <span class="w-3 h-3 rounded-full bg-pink-500 mr-2"></span> Female
                            </span>
                            <span class="font-bold text-slate-800">{{ dash.females }}</span>
                        </div>
                        <div class="w-full bg-slate-100 rounded-full h-2">
                            <div class="bg-pink-500 h-2 rounded-full"

                                style="width: {{ (dash.females / total_gender * 100)|round }}%"></div>
                        </div>
                    </div>
                </div>

                <!-- Top Requested Tests -->
                <div class="bg-white rounded-xl shadow-sm border border-slate-200">
                    <div class="px-4 py-3 border-b border-slate-100">
                        <h3 class="font-bold text-slate-800">Top Requested Tests</h3>
                    </div>
                    <div class="p-4">
                        {% if dash.top_tests %}
                        <ul class="space-y-3">
                            {% for tt in dash.top_tests %}
                            <li class="flex items-center justify-between">
                                <div class="flex items-center">
                                    <div

                                        class="w-6 h-6 rounded bg-indigo-100 text-indigo-600 flex items-center justify-center text-xs font-bold mr-3">
                                        {{ loop.index }}</div>
                                    <span class="text-sm font-medium text-slate-700 truncate w-32"

                                        title="{{ tt.name }}">{{ tt.name }}</span>
                                </div>
                                <span class="text-sm font-bold text-slate-800 bg-slate-50 px-2 rounded">{{ tt.count
                                    }}</span>
                            </li>
                            {% endfor %}
                        </ul>
                        {% else %}
                        <p class="text-sm text-slate-500 text-center py-4">No tests logged yet.</p>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- FOOTER SIGNATURE -->
    <div class="mt-12 flex flex-col items-center justify-center border-t border-slate-200 pt-8 pb-4">
        <!-- Premium Interactive QR Code Card -->
        <div class="group relative flex flex-col items-center bg-white p-4 rounded-2xl shadow-md border border-slate-100 hover:shadow-xl hover:-translate-y-1.5 transition-all duration-300 mb-4 max-w-xs cursor-pointer">
            <!-- Scan Corner Markers -->
            <div class="absolute top-2 left-2 w-4.5 h-4.5 border-t-2 border-l-2 border-indigo-500 rounded-tl transition-all duration-300 group-hover:scale-110"></div>
            <div class="absolute top-2 right-2 w-4.5 h-4.5 border-t-2 border-r-2 border-indigo-500 rounded-tr transition-all duration-300 group-hover:scale-110"></div>
            <div class="absolute bottom-2 left-2 w-4.5 h-4.5 border-b-2 border-l-2 border-indigo-500 rounded-bl transition-all duration-300 group-hover:scale-110"></div>
            <div class="absolute bottom-2 right-2 w-4.5 h-4.5 border-b-2 border-r-2 border-indigo-500 rounded-br transition-all duration-300 group-hover:scale-110"></div>
            
            <!-- Scan Line Effect -->
            <div class="absolute left-4 right-4 h-[2px] bg-gradient-to-r from-transparent via-indigo-400 to-transparent top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-hover:animate-pulse transition-opacity duration-300"></div>

            <a href="https://alissahib97.wixsite.com/my-site-1" target="_blank" rel="noopener noreferrer" class="block overflow-hidden rounded-xl bg-slate-50 p-2 border border-slate-100 transition-all duration-300 group-hover:bg-indigo-50/30">
                <img src="/static/ali_saleem_qr.png" alt="Ali Saleem QR Code" class="w-32 h-32 object-contain transition-transform duration-500 ease-out group-hover:scale-105">
            </a>
            <span class="text-xs text-slate-400 mt-2.5 font-medium tracking-wide transition-colors duration-300 group-hover:text-indigo-600">Scan to visit website</span>
        </div>

        <p class="text-lg font-medium text-slate-600">By: <a href="https://alissahib97.wixsite.com/my-site-1" target="_blank" rel="noopener noreferrer" class="text-indigo-600 hover:text-indigo-800 hover:underline transition-all duration-300">Ali Saleem</a></p>
    </div>
</div>
{% endblock %}