From dc6b5513252fe8156e869826088302cf9bd673df Mon Sep 17 00:00:00 2001 From: James Pattinson Date: Fri, 19 Dec 2025 08:40:06 -0500 Subject: [PATCH] Correct missing funcs --- web/admin.css | 4 ++-- web/admin.html | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/web/admin.css b/web/admin.css index 3cf9271..705832f 100644 --- a/web/admin.css +++ b/web/admin.css @@ -397,10 +397,10 @@ tbody tr:hover { border-color: transparent #333 transparent transparent; } -.notes-tooltip:hover .tooltip-text { +/* .notes-tooltip:hover .tooltip-text { visibility: visible; opacity: 1; -} +} */ /* Modal Styles */ .modal { diff --git a/web/admin.html b/web/admin.html index 6f05fb1..d9d3bef 100644 --- a/web/admin.html +++ b/web/admin.html @@ -1129,6 +1129,14 @@ let currentUserId = null; let currentChangePasswordUserId = null; + // ==================== GENERIC MODAL HELPER ==================== + function closeModal(modalId, additionalCleanup = null) { + document.getElementById(modalId).style.display = 'none'; + if (additionalCleanup) { + additionalCleanup(); + } + } + // Load UI configuration from API async function loadUIConfig() { try { @@ -4769,13 +4777,50 @@ if (lookup) lookup.clear(); } + // Position tooltip near mouse cursor + function positionTooltip(event) { + const tooltip = event.currentTarget.querySelector('.tooltip-text'); + if (tooltip) { + const rect = tooltip.getBoundingClientRect(); + const tooltipWidth = 300; // matches CSS width + const tooltipHeight = rect.height || 100; // estimate if not yet rendered + + let left = event.pageX + 10; + let top = event.pageY + 10; + + // Adjust if tooltip would go off screen + if (left + tooltipWidth > window.innerWidth) { + left = event.pageX - tooltipWidth - 10; + } + + if (top + tooltipHeight > window.innerHeight) { + top = event.pageY - tooltipHeight - 10; + } + + tooltip.style.left = left + 'px'; + tooltip.style.top = top + 'px'; + tooltip.style.visibility = 'visible'; + tooltip.style.opacity = '1'; + } + } + // Add hover listeners to all notes tooltips function setupTooltips() { document.querySelectorAll('.notes-tooltip').forEach(tooltip => { tooltip.addEventListener('mouseenter', positionTooltip); + tooltip.addEventListener('mouseleave', hideTooltip); }); } + // Hide tooltip when mouse leaves + function hideTooltip(event) { + const tooltip = event.currentTarget.querySelector('.tooltip-text'); + if (tooltip) { + tooltip.style.visibility = 'hidden'; + tooltip.style.opacity = '0'; + } + } + // Initialize the page when DOM is loaded document.addEventListener('DOMContentLoaded', function() { loadUIConfig(); // Load UI configuration first