Spaces:
Runtime error
Runtime error
fix: replace error alert with graceful in-page 'no medications found' message
Browse files- templates/dashboard.html +21 -3
templates/dashboard.html
CHANGED
|
@@ -357,9 +357,27 @@
|
|
| 357 |
resultsArea.classList.remove('hidden');
|
| 358 |
resultsArea.scrollIntoView({ behavior: 'smooth' });
|
| 359 |
} else {
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
}
|
| 364 |
|
| 365 |
} catch(err) {
|
|
|
|
| 357 |
resultsArea.classList.remove('hidden');
|
| 358 |
resultsArea.scrollIntoView({ behavior: 'smooth' });
|
| 359 |
} else {
|
| 360 |
+
// Show metadata if available even with no meds
|
| 361 |
+
if (document.getElementById('patient-name-display')) document.getElementById('patient-name-display').textContent = data.patient_name || 'N/A';
|
| 362 |
+
if (document.getElementById('doctor-name-display')) document.getElementById('doctor-name-display').textContent = data.doctor_name || 'N/A';
|
| 363 |
+
if (document.getElementById('date-display')) document.getElementById('date-display').textContent = data.date || 'N/A';
|
| 364 |
+
|
| 365 |
+
// Show a graceful in-page message instead of alert
|
| 366 |
+
medicationsContainer.innerHTML = `
|
| 367 |
+
<tr>
|
| 368 |
+
<td colspan="6" class="px-6 py-10 text-center">
|
| 369 |
+
<div class="text-slate-400 mb-2">
|
| 370 |
+
<span class="material-symbols-outlined text-3xl">search_off</span>
|
| 371 |
+
</div>
|
| 372 |
+
<p class="text-sm font-semibold text-slate-500">No medications could be identified</p>
|
| 373 |
+
<p class="text-xs text-slate-400 mt-1">The prescription text was extracted but no medicines were recognized. Try a clearer image.</p>
|
| 374 |
+
</td>
|
| 375 |
+
</tr>
|
| 376 |
+
`;
|
| 377 |
+
scanStatus.className = "px-2 py-1 bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400 text-[10px] font-bold rounded uppercase";
|
| 378 |
+
scanStatus.innerText = "Partial Scan";
|
| 379 |
+
resultsArea.classList.remove('hidden');
|
| 380 |
+
resultsArea.scrollIntoView({ behavior: 'smooth' });
|
| 381 |
}
|
| 382 |
|
| 383 |
} catch(err) {
|