Add 2 files
Browse files- README.md +7 -5
- index.html +704 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: medtrack
|
3 |
+
emoji: 馃惓
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: blue
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,704 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>MedTrack - Medication Reminder</title>
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
8 |
+
<style>
|
9 |
+
:root {
|
10 |
+
--primary: #4a89dc;
|
11 |
+
--secondary: #3bafda;
|
12 |
+
--success: #8cc152;
|
13 |
+
--danger: #e9573f;
|
14 |
+
--light: #f5f7fa;
|
15 |
+
--dark: #434a54;
|
16 |
+
--gray: #e6e9ed;
|
17 |
+
}
|
18 |
+
|
19 |
+
* {
|
20 |
+
margin: 0;
|
21 |
+
padding: 0;
|
22 |
+
box-sizing: border-box;
|
23 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
24 |
+
}
|
25 |
+
|
26 |
+
body {
|
27 |
+
background-color: #f9f9f9;
|
28 |
+
color: var(--dark);
|
29 |
+
line-height: 1.6;
|
30 |
+
}
|
31 |
+
|
32 |
+
.container {
|
33 |
+
max-width: 800px;
|
34 |
+
margin: 0 auto;
|
35 |
+
padding: 20px;
|
36 |
+
}
|
37 |
+
|
38 |
+
header {
|
39 |
+
display: flex;
|
40 |
+
justify-content: space-between;
|
41 |
+
align-items: center;
|
42 |
+
margin-bottom: 30px;
|
43 |
+
padding-bottom: 15px;
|
44 |
+
border-bottom: 1px solid var(--gray);
|
45 |
+
}
|
46 |
+
|
47 |
+
.logo {
|
48 |
+
display: flex;
|
49 |
+
align-items: center;
|
50 |
+
gap: 10px;
|
51 |
+
}
|
52 |
+
|
53 |
+
.logo i {
|
54 |
+
color: var(--primary);
|
55 |
+
font-size: 28px;
|
56 |
+
}
|
57 |
+
|
58 |
+
.logo h1 {
|
59 |
+
font-size: 24px;
|
60 |
+
font-weight: 600;
|
61 |
+
color: var(--dark);
|
62 |
+
}
|
63 |
+
|
64 |
+
.btn {
|
65 |
+
padding: 10px 15px;
|
66 |
+
border: none;
|
67 |
+
border-radius: 5px;
|
68 |
+
cursor: pointer;
|
69 |
+
font-weight: 500;
|
70 |
+
transition: all 0.3s ease;
|
71 |
+
display: inline-flex;
|
72 |
+
align-items: center;
|
73 |
+
gap: 8px;
|
74 |
+
}
|
75 |
+
|
76 |
+
.btn-primary {
|
77 |
+
background-color: var(--primary);
|
78 |
+
color: white;
|
79 |
+
}
|
80 |
+
|
81 |
+
.btn-primary:hover {
|
82 |
+
background-color: #3a70c2;
|
83 |
+
}
|
84 |
+
|
85 |
+
.btn-secondary {
|
86 |
+
background-color: var(--secondary);
|
87 |
+
color: white;
|
88 |
+
}
|
89 |
+
|
90 |
+
.btn-secondary:hover {
|
91 |
+
background-color: #2a9ac7;
|
92 |
+
}
|
93 |
+
|
94 |
+
.btn-success {
|
95 |
+
background-color: var(--success);
|
96 |
+
color: white;
|
97 |
+
}
|
98 |
+
|
99 |
+
.btn-success:hover {
|
100 |
+
background-color: #7aae4a;
|
101 |
+
}
|
102 |
+
|
103 |
+
.btn-danger {
|
104 |
+
background-color: var(--danger);
|
105 |
+
color: white;
|
106 |
+
}
|
107 |
+
|
108 |
+
.btn-danger:hover {
|
109 |
+
background-color: #d8422d;
|
110 |
+
}
|
111 |
+
|
112 |
+
.btn-outline {
|
113 |
+
background-color: transparent;
|
114 |
+
border: 1px solid var(--gray);
|
115 |
+
color: var(--dark);
|
116 |
+
}
|
117 |
+
|
118 |
+
.btn-outline:hover {
|
119 |
+
background-color: var(--gray);
|
120 |
+
}
|
121 |
+
|
122 |
+
/* Dashboard Section */
|
123 |
+
.dashboard {
|
124 |
+
margin-bottom: 30px;
|
125 |
+
}
|
126 |
+
|
127 |
+
.stats {
|
128 |
+
display: grid;
|
129 |
+
grid-template-columns: repeat(3, 1fr);
|
130 |
+
gap: 15px;
|
131 |
+
margin-bottom: 20px;
|
132 |
+
}
|
133 |
+
|
134 |
+
.stat-card {
|
135 |
+
background-color: white;
|
136 |
+
padding: 20px;
|
137 |
+
border-radius: 8px;
|
138 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
|
139 |
+
}
|
140 |
+
|
141 |
+
.stat-card h3 {
|
142 |
+
font-size: 14px;
|
143 |
+
color: #666;
|
144 |
+
margin-bottom: 5px;
|
145 |
+
}
|
146 |
+
|
147 |
+
.stat-card p {
|
148 |
+
font-size: 24px;
|
149 |
+
font-weight: 600;
|
150 |
+
}
|
151 |
+
|
152 |
+
/* Upcoming Medications */
|
153 |
+
.upcoming {
|
154 |
+
background-color: white;
|
155 |
+
border-radius: 8px;
|
156 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
|
157 |
+
padding: 20px;
|
158 |
+
}
|
159 |
+
|
160 |
+
.section-title {
|
161 |
+
display: flex;
|
162 |
+
justify-content: space-between;
|
163 |
+
align-items: center;
|
164 |
+
margin-bottom: 20px;
|
165 |
+
}
|
166 |
+
|
167 |
+
.section-title h2 {
|
168 |
+
font-size: 18px;
|
169 |
+
font-weight: 600;
|
170 |
+
}
|
171 |
+
|
172 |
+
.medication-list {
|
173 |
+
display: flex;
|
174 |
+
flex-direction: column;
|
175 |
+
gap: 15px;
|
176 |
+
}
|
177 |
+
|
178 |
+
.medication-item {
|
179 |
+
display: flex;
|
180 |
+
align-items: center;
|
181 |
+
padding: 15px;
|
182 |
+
border-radius: 8px;
|
183 |
+
background-color: var(--light);
|
184 |
+
transition: all 0.3s ease;
|
185 |
+
}
|
186 |
+
|
187 |
+
.medication-item:hover {
|
188 |
+
transform: translateY(-2px);
|
189 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
190 |
+
}
|
191 |
+
|
192 |
+
.med-icon {
|
193 |
+
width: 50px;
|
194 |
+
height: 50px;
|
195 |
+
background-color: var(--secondary);
|
196 |
+
border-radius: 50%;
|
197 |
+
display: flex;
|
198 |
+
align-items: center;
|
199 |
+
justify-content: center;
|
200 |
+
margin-right: 15px;
|
201 |
+
color: white;
|
202 |
+
font-size: 20px;
|
203 |
+
}
|
204 |
+
|
205 |
+
.med-details {
|
206 |
+
flex: 1;
|
207 |
+
}
|
208 |
+
|
209 |
+
.med-details h3 {
|
210 |
+
font-size: 16px;
|
211 |
+
margin-bottom: 5px;
|
212 |
+
}
|
213 |
+
|
214 |
+
.med-details p {
|
215 |
+
font-size: 14px;
|
216 |
+
color: #666;
|
217 |
+
}
|
218 |
+
|
219 |
+
.med-time {
|
220 |
+
display: flex;
|
221 |
+
flex-direction: column;
|
222 |
+
align-items: flex-end;
|
223 |
+
}
|
224 |
+
|
225 |
+
.med-time p {
|
226 |
+
font-weight: 600;
|
227 |
+
margin-bottom: 5px;
|
228 |
+
}
|
229 |
+
|
230 |
+
/* Modal */
|
231 |
+
.modal {
|
232 |
+
display: none;
|
233 |
+
position: fixed;
|
234 |
+
top: 0;
|
235 |
+
left: 0;
|
236 |
+
width: 100%;
|
237 |
+
height: 100%;
|
238 |
+
background-color: rgba(0, 0, 0, 0.5);
|
239 |
+
z-index: 1000;
|
240 |
+
justify-content: center;
|
241 |
+
align-items: center;
|
242 |
+
}
|
243 |
+
|
244 |
+
.modal-content {
|
245 |
+
background-color: white;
|
246 |
+
padding: 25px;
|
247 |
+
border-radius: 10px;
|
248 |
+
width: 90%;
|
249 |
+
max-width: 500px;
|
250 |
+
max-height: 90vh;
|
251 |
+
overflow-y: auto;
|
252 |
+
}
|
253 |
+
|
254 |
+
.modal-header {
|
255 |
+
display: flex;
|
256 |
+
justify-content: space-between;
|
257 |
+
align-items: center;
|
258 |
+
margin-bottom: 20px;
|
259 |
+
}
|
260 |
+
|
261 |
+
.modal-header h2 {
|
262 |
+
font-size: 20px;
|
263 |
+
}
|
264 |
+
|
265 |
+
.close-btn {
|
266 |
+
background: none;
|
267 |
+
border: none;
|
268 |
+
font-size: 24px;
|
269 |
+
cursor: pointer;
|
270 |
+
color: #666;
|
271 |
+
}
|
272 |
+
|
273 |
+
.form-group {
|
274 |
+
margin-bottom: 20px;
|
275 |
+
}
|
276 |
+
|
277 |
+
.form-group label {
|
278 |
+
display: block;
|
279 |
+
margin-bottom: 8px;
|
280 |
+
font-weight: 500;
|
281 |
+
}
|
282 |
+
|
283 |
+
.form-control {
|
284 |
+
width: 100%;
|
285 |
+
padding: 10px 15px;
|
286 |
+
border: 1px solid var(--gray);
|
287 |
+
border-radius: 5px;
|
288 |
+
font-size: 16px;
|
289 |
+
}
|
290 |
+
|
291 |
+
.form-control:focus {
|
292 |
+
outline: none;
|
293 |
+
border-color: var(--primary);
|
294 |
+
}
|
295 |
+
|
296 |
+
.time-inputs {
|
297 |
+
display: grid;
|
298 |
+
grid-template-columns: 1fr 1fr;
|
299 |
+
gap: 15px;
|
300 |
+
}
|
301 |
+
|
302 |
+
.modal-footer {
|
303 |
+
display: flex;
|
304 |
+
justify-content: flex-end;
|
305 |
+
gap: 10px;
|
306 |
+
margin-top: 20px;
|
307 |
+
}
|
308 |
+
|
309 |
+
/* Notification */
|
310 |
+
.notification {
|
311 |
+
position: fixed;
|
312 |
+
bottom: 20px;
|
313 |
+
right: 20px;
|
314 |
+
background-color: var(--primary);
|
315 |
+
color: white;
|
316 |
+
padding: 15px 25px;
|
317 |
+
border-radius: 8px;
|
318 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
319 |
+
display: flex;
|
320 |
+
align-items: center;
|
321 |
+
gap: 10px;
|
322 |
+
transform: translateY(100px);
|
323 |
+
opacity: 0;
|
324 |
+
transition: all 0.3s ease;
|
325 |
+
z-index: 100;
|
326 |
+
}
|
327 |
+
|
328 |
+
.notification.show {
|
329 |
+
transform: translateY(0);
|
330 |
+
opacity: 1;
|
331 |
+
}
|
332 |
+
|
333 |
+
.notification i {
|
334 |
+
font-size: 20px;
|
335 |
+
}
|
336 |
+
|
337 |
+
/* Responsive */
|
338 |
+
@media (max-width: 768px) {
|
339 |
+
.stats {
|
340 |
+
grid-template-columns: 1fr;
|
341 |
+
}
|
342 |
+
|
343 |
+
.medication-item {
|
344 |
+
flex-direction: column;
|
345 |
+
text-align: center;
|
346 |
+
}
|
347 |
+
|
348 |
+
.med-icon {
|
349 |
+
margin-right: 0;
|
350 |
+
margin-bottom: 15px;
|
351 |
+
}
|
352 |
+
|
353 |
+
.med-time {
|
354 |
+
align-items: center;
|
355 |
+
margin-top: 10px;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
</style>
|
359 |
+
</head>
|
360 |
+
<body>
|
361 |
+
<div class="container">
|
362 |
+
<header>
|
363 |
+
<div class="logo">
|
364 |
+
<i class="fas fa-pills"></i>
|
365 |
+
<h1>MedTrack</h1>
|
366 |
+
</div>
|
367 |
+
<button class="btn btn-primary" id="addMedBtn">
|
368 |
+
<i class="fas fa-plus"></i> Add Medication
|
369 |
+
</button>
|
370 |
+
</header>
|
371 |
+
|
372 |
+
<section class="dashboard">
|
373 |
+
<div class="stats">
|
374 |
+
<div class="stat-card">
|
375 |
+
<h3>Upcoming Today</h3>
|
376 |
+
<p id="upcomingCount">3</p>
|
377 |
+
</div>
|
378 |
+
<div class="stat-card">
|
379 |
+
<h3>Medications</h3>
|
380 |
+
<p id="totalMeds">5</p>
|
381 |
+
</div>
|
382 |
+
<div class="stat-card">
|
383 |
+
<h3>Adherence</h3>
|
384 |
+
<p id="adherenceRate">92%</p>
|
385 |
+
</div>
|
386 |
+
</div>
|
387 |
+
</section>
|
388 |
+
|
389 |
+
<section class="upcoming">
|
390 |
+
<div class="section-title">
|
391 |
+
<h2><i class="far fa-clock"></i> Upcoming Medications</h2>
|
392 |
+
<button class="btn btn-outline">
|
393 |
+
<i class="fas fa-ellipsis-h"></i>
|
394 |
+
</button>
|
395 |
+
</div>
|
396 |
+
|
397 |
+
<div class="medication-list" id="medicationList">
|
398 |
+
<!-- Medication items will be added here dynamically -->
|
399 |
+
</div>
|
400 |
+
</section>
|
401 |
+
</div>
|
402 |
+
|
403 |
+
<!-- Add Medication Modal -->
|
404 |
+
<div class="modal" id="addMedModal">
|
405 |
+
<div class="modal-content">
|
406 |
+
<div class="modal-header">
|
407 |
+
<h2>Add New Medication</h2>
|
408 |
+
<button class="close-btn" id="closeModal">×</button>
|
409 |
+
</div>
|
410 |
+
<form id="medicationForm">
|
411 |
+
<div class="form-group">
|
412 |
+
<label for="medName">Medication Name</label>
|
413 |
+
<input type="text" id="medName" class="form-control" placeholder="e.g. Ibuprofen" required>
|
414 |
+
</div>
|
415 |
+
<div class="form-group">
|
416 |
+
<label for="medDosage">Dosage</label>
|
417 |
+
<input type="text" id="medDosage" class="form-control" placeholder="e.g. 200mg" required>
|
418 |
+
</div>
|
419 |
+
<div class="form-group">
|
420 |
+
<label for="medFrequency">Frequency</label>
|
421 |
+
<select id="medFrequency" class="form-control" required>
|
422 |
+
<option value="">Select frequency</option>
|
423 |
+
<option value="once">Once daily</option>
|
424 |
+
<option value="twice">Twice daily</option>
|
425 |
+
<option value="thrice">Three times daily</option>
|
426 |
+
<option value="as_needed">As needed</option>
|
427 |
+
</select>
|
428 |
+
</div>
|
429 |
+
<div class="form-group">
|
430 |
+
<label>Times</label>
|
431 |
+
<div class="time-inputs" id="timeInputs">
|
432 |
+
<div>
|
433 |
+
<input type="time" id="time1" class="form-control" required>
|
434 |
+
</div>
|
435 |
+
</div>
|
436 |
+
</div>
|
437 |
+
<div class="form-group">
|
438 |
+
<label for="medNotes">Notes (Optional)</label>
|
439 |
+
<textarea id="medNotes" class="form-control" rows="3" placeholder="Special instructions..."></textarea>
|
440 |
+
</div>
|
441 |
+
<div class="modal-footer">
|
442 |
+
<button type="button" class="btn btn-outline" id="cancelBtn">Cancel</button>
|
443 |
+
<button type="submit" class="btn btn-primary">Add Medication</button>
|
444 |
+
</div>
|
445 |
+
</form>
|
446 |
+
</div>
|
447 |
+
</div>
|
448 |
+
|
449 |
+
<!-- Notification -->
|
450 |
+
<div class="notification" id="notification">
|
451 |
+
<i class="fas fa-check-circle"></i>
|
452 |
+
<span id="notificationText">Medication added successfully!</span>
|
453 |
+
</div>
|
454 |
+
|
455 |
+
<script>
|
456 |
+
// Sample data for medications
|
457 |
+
const sampleMedications = [
|
458 |
+
{
|
459 |
+
id: 1,
|
460 |
+
name: "Ibuprofen",
|
461 |
+
dosage: "200mg",
|
462 |
+
time: "08:00",
|
463 |
+
isTaken: false,
|
464 |
+
note: "Take with food"
|
465 |
+
},
|
466 |
+
{
|
467 |
+
id: 2,
|
468 |
+
name: "Vitamin D",
|
469 |
+
dosage: "1000IU",
|
470 |
+
time: "12:00",
|
471 |
+
isTaken: false,
|
472 |
+
note: "With lunch"
|
473 |
+
},
|
474 |
+
{
|
475 |
+
id: 3,
|
476 |
+
name: "Multivitamin",
|
477 |
+
dosage: "1 tablet",
|
478 |
+
time: "18:00",
|
479 |
+
isTaken: false,
|
480 |
+
note: ""
|
481 |
+
}
|
482 |
+
];
|
483 |
+
|
484 |
+
// DOM Elements
|
485 |
+
const medicationList = document.getElementById('medicationList');
|
486 |
+
const addMedBtn = document.getElementById('addMedBtn');
|
487 |
+
const addMedModal = document.getElementById('addMedModal');
|
488 |
+
const closeModal = document.getElementById('closeModal');
|
489 |
+
const cancelBtn = document.getElementById('cancelBtn');
|
490 |
+
const medicationForm = document.getElementById('medicationForm');
|
491 |
+
const medFrequency = document.getElementById('medFrequency');
|
492 |
+
const timeInputs = document.getElementById('timeInputs');
|
493 |
+
const notification = document.getElementById('notification');
|
494 |
+
const notificationText = document.getElementById('notificationText');
|
495 |
+
const upcomingCount = document.getElementById('upcomingCount');
|
496 |
+
const totalMeds = document.getElementById('totalMeds');
|
497 |
+
const adherenceRate = document.getElementById('adherenceRate');
|
498 |
+
|
499 |
+
// Current medications
|
500 |
+
let medications = [...sampleMedications];
|
501 |
+
let nextId = 4;
|
502 |
+
|
503 |
+
// Initialize the app
|
504 |
+
function init() {
|
505 |
+
renderMedications();
|
506 |
+
updateStats();
|
507 |
+
checkNotifications();
|
508 |
+
}
|
509 |
+
|
510 |
+
// Render medications to the list
|
511 |
+
function renderMedications() {
|
512 |
+
medicationList.innerHTML = '';
|
513 |
+
|
514 |
+
// Sort medications by time
|
515 |
+
const sortedMeds = [...medications].sort((a, b) => {
|
516 |
+
return a.time.localeCompare(b.time);
|
517 |
+
});
|
518 |
+
|
519 |
+
sortedMeds.forEach(med => {
|
520 |
+
if (!med.isTaken) {
|
521 |
+
const medItem = document.createElement('div');
|
522 |
+
medItem.className = 'medication-item';
|
523 |
+
medItem.dataset.id = med.id;
|
524 |
+
|
525 |
+
const [hours, minutes] = med.time.split(':');
|
526 |
+
let timeDisplay = med.time;
|
527 |
+
const hour = parseInt(hours);
|
528 |
+
const amPm = hour >= 12 ? 'PM' : 'AM';
|
529 |
+
const hour12 = hour % 12 || 12;
|
530 |
+
timeDisplay = `${hour12}:${minutes} ${amPm}`;
|
531 |
+
|
532 |
+
medItem.innerHTML = `
|
533 |
+
<div class="med-icon">
|
534 |
+
<i class="fas fa-pills"></i>
|
535 |
+
</div>
|
536 |
+
<div class="med-details">
|
537 |
+
<h3>${med.name}</h3>
|
538 |
+
<p>${med.dosage} ${med.note ? '路 ' + med.note : ''}</p>
|
539 |
+
</div>
|
540 |
+
<div class="med-time">
|
541 |
+
<p>${timeDisplay}</p>
|
542 |
+
<button class="btn btn-success btn-sm take-btn">
|
543 |
+
<i class="fas fa-check"></i> Taken
|
544 |
+
</button>
|
545 |
+
</div>
|
546 |
+
`;
|
547 |
+
|
548 |
+
medicationList.appendChild(medItem);
|
549 |
+
|
550 |
+
// Add event listener to the take button
|
551 |
+
medItem.querySelector('.take-btn').addEventListener('click', () => takeMedication(med.id));
|
552 |
+
}
|
553 |
+
});
|
554 |
+
}
|
555 |
+
|
556 |
+
// Mark medication as taken
|
557 |
+
function takeMedication(id) {
|
558 |
+
const index = medications.findIndex(med => med.id === id);
|
559 |
+
if (index !== -1) {
|
560 |
+
medications[index].isTaken = true;
|
561 |
+
renderMedications();
|
562 |
+
updateStats();
|
563 |
+
showNotification(`Marked ${medications[index].name} as taken.`);
|
564 |
+
|
565 |
+
// Schedule notification for next dose
|
566 |
+
scheduleNextNotification(medications[index]);
|
567 |
+
}
|
568 |
+
}
|
569 |
+
|
570 |
+
// Show notification to take medication
|
571 |
+
function showNotification(message) {
|
572 |
+
notificationText.textContent = message;
|
573 |
+
notification.classList.add('show');
|
574 |
+
|
575 |
+
setTimeout(() => {
|
576 |
+
notification.classList.remove('show');
|
577 |
+
}, 3000);
|
578 |
+
}
|
579 |
+
|
580 |
+
// Check if any medications are due
|
581 |
+
function checkNotifications() {
|
582 |
+
const now = new Date();
|
583 |
+
const currentHours = now.getHours().toString().padStart(2, '0');
|
584 |
+
const currentMinutes = now.getMinutes().toString().padStart(2, '0');
|
585 |
+
const currentTime = `${currentHours}:${currentMinutes}`;
|
586 |
+
|
587 |
+
medications.forEach(med => {
|
588 |
+
if (!med.isTaken && med.time === currentTime) {
|
589 |
+
showNotification(`Time to take ${med.name} (${med.dosage})`);
|
590 |
+
}
|
591 |
+
});
|
592 |
+
}
|
593 |
+
|
594 |
+
// Schedule next notification for recurring medications
|
595 |
+
function scheduleNextNotification(medication) {
|
596 |
+
// In a real app, this would schedule an actual notification
|
597 |
+
console.log(`Setting reminder for next dose of ${medication.name} at ${medication.time}`);
|
598 |
+
}
|
599 |
+
|
600 |
+
// Update statistics
|
601 |
+
function updateStats() {
|
602 |
+
const total = medications.length;
|
603 |
+
const upcoming = medications.filter(med => !med.isTaken).length;
|
604 |
+
const taken = medications.filter(med => med.isTaken).length;
|
605 |
+
const adherence = total > 0 ? Math.round((taken / total) * 100) : 0;
|
606 |
+
|
607 |
+
upcomingCount.textContent = upcoming;
|
608 |
+
totalMeds.textContent = total;
|
609 |
+
adherenceRate.textContent = `${adherence}%`;
|
610 |
+
}
|
611 |
+
|
612 |
+
// Show modal
|
613 |
+
function showModal() {
|
614 |
+
addMedModal.style.display = 'flex';
|
615 |
+
document.body.style.overflow = 'hidden';
|
616 |
+
}
|
617 |
+
|
618 |
+
// Hide modal
|
619 |
+
function hideModal() {
|
620 |
+
addMedModal.style.display = 'none';
|
621 |
+
document.body.style.overflow = 'auto';
|
622 |
+
medicationForm.reset();
|
623 |
+
while (timeInputs.children.length > 1) {
|
624 |
+
timeInputs.removeChild(timeInputs.lastChild);
|
625 |
+
}
|
626 |
+
}
|
627 |
+
|
628 |
+
// Add new medication
|
629 |
+
function addMedication(name, dosage, frequency, times, note) {
|
630 |
+
times.forEach(time => {
|
631 |
+
const newMed = {
|
632 |
+
id: nextId++,
|
633 |
+
name,
|
634 |
+
dosage,
|
635 |
+
time,
|
636 |
+
isTaken: false,
|
637 |
+
note
|
638 |
+
};
|
639 |
+
|
640 |
+
medications.push(newMed);
|
641 |
+
});
|
642 |
+
|
643 |
+
renderMedications();
|
644 |
+
updateStats();
|
645 |
+
showNotification(`Added ${name} to your medications.`);
|
646 |
+
hideModal();
|
647 |
+
}
|
648 |
+
|
649 |
+
// Event Listeners
|
650 |
+
addMedBtn.addEventListener('click', showModal);
|
651 |
+
closeModal.addEventListener('click', hideModal);
|
652 |
+
cancelBtn.addEventListener('click', hideModal);
|
653 |
+
|
654 |
+
// Handle frequency change
|
655 |
+
medFrequency.addEventListener('change', function() {
|
656 |
+
const count = this.value === 'once' ? 1 :
|
657 |
+
this.value === 'twice' ? 2 :
|
658 |
+
this.value === 'thrice' ? 3 : 1;
|
659 |
+
|
660 |
+
// Clear existing time inputs except the first one
|
661 |
+
while (timeInputs.children.length > 1) {
|
662 |
+
timeInputs.removeChild(timeInputs.lastChild);
|
663 |
+
}
|
664 |
+
|
665 |
+
// Add additional time inputs as needed
|
666 |
+
for (let i = 1; i < count; i++) {
|
667 |
+
const div = document.createElement('div');
|
668 |
+
div.innerHTML = `<input type="time" id="time${i+1}" class="form-control" required>`;
|
669 |
+
timeInputs.appendChild(div);
|
670 |
+
}
|
671 |
+
});
|
672 |
+
|
673 |
+
// Handle form submission
|
674 |
+
medicationForm.addEventListener('submit', function(e) {
|
675 |
+
e.preventDefault();
|
676 |
+
|
677 |
+
const name = document.getElementById('medName').value;
|
678 |
+
const dosage = document.getElementById('medDosage').value;
|
679 |
+
const frequency = document.getElementById('medFrequency').value;
|
680 |
+
const note = document.getElementById('medNotes').value;
|
681 |
+
|
682 |
+
// Get all time values
|
683 |
+
const times = [];
|
684 |
+
const timeInputElements = timeInputs.querySelectorAll('input[type="time"]');
|
685 |
+
timeInputElements.forEach(input => {
|
686 |
+
if (input.value) times.push(input.value);
|
687 |
+
});
|
688 |
+
|
689 |
+
if (times.length === 0) {
|
690 |
+
alert('Please enter at least one time');
|
691 |
+
return;
|
692 |
+
}
|
693 |
+
|
694 |
+
addMedication(name, dosage, frequency, times, note);
|
695 |
+
});
|
696 |
+
|
697 |
+
// Initialize the app
|
698 |
+
init();
|
699 |
+
|
700 |
+
// Check every minute for due medications
|
701 |
+
setInterval(checkNotifications, 60000);
|
702 |
+
</script>
|
703 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: absolute; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">This website has been generated by <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body>
|
704 |
+
</html>
|