/** * DocuFlow - Document Management System * Shared functionality across all pages */ class DocuFlow { static init() { this.setupMobileMenu(); this.setupTooltips(); this.setupModals(); } static setupMobileMenu() { const menuButton = document.getElementById('mobile-menu-button'); if (menuButton) { menuButton.addEventListener('click', () => { const menu = document.getElementById('mobile-menu'); menu.classList.toggle('hidden'); }); } } static setupTooltips() { const tooltipTriggers = document.querySelectorAll('[data-tooltip]'); tooltipTriggers.forEach(el => { el.addEventListener('mouseenter', this.showTooltip); el.addEventListener('mouseleave', this.hideTooltip); }); } static showTooltip(e) { const tooltipText = this.getAttribute('data-tooltip'); const tooltip = document.createElement('div'); tooltip.className = 'absolute z-50 bg-gray-800 text-white text-xs rounded py-1 px-2'; tooltip.textContent = tooltipText; this.appendChild(tooltip); this.positionTooltip(tooltip); } static hideTooltip() { const tooltip = this.querySelector('div'); if (tooltip) this.removeChild(tooltip); } static positionTooltip(tooltip) { const rect = this.getBoundingClientRect(); tooltip.style.top = `${rect.top + window.scrollY - tooltip.offsetHeight - 5}px`; tooltip.style.left = `${rect.left + window.scrollX + (rect.width - tooltip.offsetWidth) / 2}px`; } static setupModals() { document.querySelectorAll('[data-modal-toggle]').forEach(button => { button.addEventListener('click', () => { const modalId = button.getAttribute('data-modal-toggle'); const modal = document.getElementById(modalId); if (modal) { modal.classList.toggle('hidden'); } }); }); } } // Initialize when DOM is loaded document.addEventListener('DOMContentLoaded', () => { DocuFlow.init(); // Initialize Feather Icons if available if (typeof feather !== 'undefined') { feather.replace(); } });