// Initialize tooltips document.addEventListener('DOMContentLoaded', function() { // Initialize any tooltip libraries if needed feather.replace(); // Sample data fetching - would be replaced with real API calls async function fetchDashboardData() { try { // This would be replaced with actual API endpoint // const response = await fetch('/api/dashboard'); // const data = await response.json(); // return data; // Mock data for demonstration return { totalFiles: 1248, activeFirms: 87, medianTimeToValue: 4.2, probateMetrics: { withContacts: 78, withDisbursements: 65, withDocuments: 52, withDownloads: 43 }, accountingMetrics: { withInventory: 82, withTransactions: 76, withParser: 58, withReports: 39 } }; } catch (error) { console.error('Error fetching dashboard data:', error); return null; } } // Load data when page loads fetchDashboardData().then(data => { if (data) { console.log('Dashboard data loaded:', data); // Here you would update the DOM with the actual data } }); // Responsive menu toggle for mobile (handled by components) }); // Event delegation for dynamic elements document.addEventListener('click', function(e) { // Handle clicks on dynamically added elements if (e.target.classList.contains('toggle-details')) { const details = e.target.nextElementSibling; details.classList.toggle('hidden'); e.target.querySelector('i').setAttribute('data-feather', details.classList.contains('hidden') ? 'chevron-down' : 'chevron-up'); feather.replace(); } });