From ca699059150cd77c8be3f2601cfe59f298ecb999 Mon Sep 17 00:00:00 2001 From: Deep Koluguri Date: Thu, 14 May 2026 23:54:11 -0400 Subject: [PATCH] fix: connect all UI hooks and resolve ReferenceErrors (v4) --- dashboard.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dashboard.js b/dashboard.js index ae086ed..710e567 100644 --- a/dashboard.js +++ b/dashboard.js @@ -238,6 +238,38 @@ window.printSummary = () => { alert(`🖨️ Printing Handover Note:\n\n${summary}`); }; +// 7. Missing UI Hooks (Repaired) +window.openHistory = () => { + const name = document.querySelector(".current-patient h1").innerText.split(' (')[0]; + alert(`📂 Loading Patient History for ${name}...\n\n- Visit (05/12/26): Chronic Gastritis\n- Lab (05/10/26): HbA1c 7.2% (Warning)`); +}; + +window.openConsultation = () => { + const modal = document.getElementById("consultationModal"); + if (modal) { + // Auto-fill diagnosis based on triage context + const meta = document.querySelector(".patient-meta").innerText; + document.getElementById("rxDiagnosis").value = meta.split(' • ')[1] || ""; + modal.style.display = "block"; + } +}; + +// 8. Sidebar Toggle +window.toggleSidebar = () => { + const sidebar = document.getElementById('sidebar'); + if (!sidebar) return; + if (sidebar.style.display === 'flex') { + sidebar.style.display = 'none'; + } else { + sidebar.style.display = 'flex'; + sidebar.style.position = 'fixed'; + sidebar.style.top = '50px'; + sidebar.style.width = '100%'; + sidebar.style.height = 'calc(100vh - 50px)'; + sidebar.style.zIndex = '999'; + } +}; + // Close Modals if (closeModal) closeModal.onclick = () => modal.style.display = "none";