// State Management let currentPage = 'org-business'; let openMenus = ['org']; let commandHistory = []; // Menu Structure for Command Palette const commands = [ { id: 'org-business', label: 'Business Information', category: 'Organization', icon: 'building-2' }, { id: 'org-branding', label: 'Branding & Appearance', category: 'Organization', icon: 'palette' }, { id: 'org-locations', label: 'Location Management', category: 'Organization', icon: 'map-pin' }, { id: 'org-roles', label: 'Roles & Permissions', category: 'Organization', icon: 'shield' }, { id: 'org-audit', label: 'Audit Logs', category: 'Organization', icon: 'clipboard-list' }, { id: 'prov-directory', label: 'Provider Directory', category: 'Providers', icon: 'users' }, { id: 'prov-scheduling', label: 'Provider Scheduling', category: 'Providers', icon: 'calendar' }, { id: 'prov-compensation', label: 'Compensation Models', category: 'Providers', icon: 'dollar-sign' }, { id: 'prov-access', label: 'Access Control', category: 'Providers', icon: 'lock' }, { id: 'sched-types', label: 'Appointment Types', category: 'Scheduling', icon: 'calendar-clock' }, { id: 'sched-availability', label: 'Availability Rules', category: 'Scheduling', icon: 'clock' }, { id: 'sched-rules', label: 'Booking Rules', category: 'Scheduling', icon: 'rule' }, { id: 'sched-waitlist', label: 'Waitlist Settings', category: 'Scheduling', icon: 'list' }, { id: 'sched-noshow', label: 'No-Show Policy', category: 'Scheduling', icon: 'user-x' }, { id: 'bill-pricing', label: 'Service Pricing', category: 'Billing', icon: 'tag' }, { id: 'bill-subscriptions', label: 'Subscriptions', category: 'Billing', icon: 'repeat' }, { id: 'bill-invoices', label: 'Invoice Templates', category: 'Billing', icon: 'file-invoice' }, { id: 'bill-payouts', label: 'Payout Rules', category: 'Billing', icon: 'wallet' }, { id: 'comm-sms', label: 'SMS Configuration', category: 'Communications', icon: 'message-square' }, { id: 'comm-email', label: 'Email Templates', category: 'Communications', icon: 'mail' }, { id: 'comm-automation', label: 'Communication Automation', category: 'Communications', icon: 'zap' }, { id: 'forms-templates', label: 'Form Templates', category: 'Forms', icon: 'file-text' }, { id: 'forms-intake', label: 'Intake Forms', category: 'Forms', icon: 'clipboard' }, { id: 'forms-sign', label: 'eSignature Settings', category: 'Forms', icon: 'pen-tool' }, { id: 'comp-hipaa', label: 'HIPAA Controls', category: 'Compliance', icon: 'shield-check' }, { id: 'comp-consents', label: 'Consent Tracking', category: 'Compliance', icon: 'check-circle' }, { id: 'comp-security', label: 'Security Audit', category: 'Compliance', icon: 'search' }, { id: 'ai-automation', label: 'AI Workflows', category: 'AI & Automation', icon: 'sparkles' }, { id: 'ai-agents', label: 'AI Agents', category: 'AI & Automation', icon: 'bot' }, { id: 'ai-recommendations', label: 'AI Recommendations', category: 'AI & Automation', icon: 'lightbulb' }, { id: 'int-connected', label: 'Connected Apps', category: 'Integrations', icon: 'plug' }, { id: 'int-api', label: 'API Keys', category: 'Integrations', icon: 'key' }, { id: 'int-webhooks', label: 'Webhooks', category: 'Integrations', icon: 'webhook' }, { id: 'anl-kpis', label: 'KPI Configuration', category: 'Analytics', icon: 'bar-chart' }, { id: 'anl-forecasting', label: 'AI Forecasting', category: 'Analytics', icon: 'trending-up' }, { id: 'anl-exports', label: 'Data Exports', category: 'Analytics', icon: 'download' }, { id: 'pat-portal', label: 'Patient Portal', category: 'Patient Experience', icon: 'layout' }, { id: 'pat-booking', label: 'Booking Page', category: 'Patient Experience', icon: 'calendar-days' }, { id: 'pat-reviews', label: 'Review Management', category: 'Patient Experience', icon: 'star' }, { id: 'sec-mfa', label: 'Multi-Factor Auth', category: 'Security', icon: 'smartphone' }, { id: 'sec-access', label: 'Access Policies', category: 'Security', icon: 'lock' }, { id: 'sec-backup', label: 'Backup & Recovery', category: 'Security', icon: 'archive' }, { id: 'sys-performance', label: 'Performance', category: 'System', icon: 'gauge' }, { id: 'sys-logs', label: 'System Logs', category: 'System', icon: 'scroll-text' }, { id: 'sys-flags', label: 'Feature Flags', category: 'System', icon: 'toggle' }, { id: 'ent-locations', label: 'Enterprise Locations', category: 'Enterprise', icon: 'building' }, { id: 'ent-permissions', label: 'Enterprise Permissions', category: 'Enterprise', icon: 'users-2' }, { id: 'ent-sla', label: 'SLA Settings', category: 'Enterprise', icon: 'file-check' } ]; // Content Templates const pageContents = { 'org-business': { title: 'Business Information', badge: 'Core Settings', content: `

Business Details

Primary Address

Multi-Location Enabled

You currently have 3 active locations. Manage location-specific settings in the Locations tab.

` }, 'org-branding': { title: 'Branding & Appearance', badge: 'Customization', content: `

Brand Assets

Upload Logo

SVG, PNG, JPG (max 2MB)

Favicon

ICO, PNG (32x32px)

Color Scheme

Primary Color

#0e9692

Secondary Color

#111827

` }, 'default': { title: 'Settings Page', badge: 'Configuration', content: `

Configuration Panel

This settings module is currently under development. Check back soon for advanced configuration options.

Documentation

Learn about this feature

Video Tutorial

Watch setup guide

Support

Chat with our team

` } }; // Initialize document.addEventListener('DOMContentLoaded', () => { loadPage('org-business'); initializeMenus(); lucide.createIcons(); }); // Toggle Menu function toggleMenu(menuId) { const submenu = document.getElementById(`submenu-${menuId}`); const chevron = document.getElementById(`chevron-${menuId}`); if (submenu.classList.contains('open')) { submenu.classList.remove('open'); chevron.classList.remove('rotate'); openMenus = openMenus.filter(id => id !== menuId); } else { submenu.classList.add('open'); chevron.classList.add('rotate'); openMenus.push(menuId); } } // Initialize Open Menus function initializeMenus() { openMenus.forEach(menuId => { const submenu = document.getElementById(`submenu-${menuId}`); const chevron = document.getElementById(`chevron-${menuId}`); if (submenu && chevron) { submenu.classList.add('open'); chevron.classList.add('rotate'); } }); } // Load Page function loadPage(pageId) { currentPage = pageId; // Update Active States document.querySelectorAll('.sidebar-item[data-page]').forEach(item => { item.classList.remove('active'); if (item.getAttribute('data-page') === pageId) { item.classList.add('active'); } }); // Get Content const pageData = pageContents[pageId] || pageContents['default']; // Update Title & Badge document.getElementById('page-title').textContent = pageData.title; document.getElementById('page-badge').textContent = pageData.badge; // Update Content document.getElementById('content-area').innerHTML = pageData.content; // Re-init icons lucide.createIcons(); // Close mobile menu if open if (window.innerWidth < 1024) { document.getElementById('sidebar').classList.add('-translate-x-full'); document.getElementById('mobile-overlay').classList.add('hidden'); } // Add to command history if (!commandHistory.includes(pageId)) { commandHistory.unshift(pageId); if (commandHistory.length > 5) commandHistory.pop(); } } // Mobile Menu Toggle function toggleMobileMenu() { const sidebar = document.getElementById('sidebar'); const overlay = document.getElementById('mobile-overlay'); if (sidebar.classList.contains('-translate-x-full')) { sidebar.classList.remove('-translate-x-full'); overlay.classList.remove('hidden'); } else { sidebar.classList.add('-translate-x-full'); overlay.classList.add('hidden'); } } // Command Palette function openCommandPalette() { const palette = document.getElementById('command-palette'); palette.classList.remove('hidden'); document.getElementById('command-input').focus(); renderCommands(commands); } function closeCommandPalette() { document.getElementById('command-palette').classList.add('hidden'); } function filterCommands(query) { const filtered = commands.filter(cmd => cmd.label.toLowerCase().includes(query.toLowerCase()) || cmd.category.toLowerCase().includes(query.toLowerCase()) ); renderCommands(filtered); } function renderCommands(commandList) { const container = document.getElementById('command-list'); if (commandList.length === 0) { container.innerHTML = `

No commands found

`; lucide.createIcons(); return; } // Group by category const grouped = commandList.reduce((acc, cmd) => { if (!acc[cmd.category]) acc[cmd.category] = []; acc[cmd.category].push(cmd); return acc; }, {}); let html = ''; for (const [category, items] of Object.entries(grouped)) { html += `

${category}

${items.map(cmd => ` `).join('')}
`; } container.innerHTML = html; lucide.createIcons(); } function executeCommand(commandId) { closeCommandPalette(); loadPage(commandId); // Ensure parent menu is open const command = commands.find(c => c.id === commandId); if (command) { const menuMap = { 'Organization': 'org', 'Providers': 'providers', 'Scheduling': 'scheduling', 'Billing': 'billing', 'Communications': 'comms', 'Forms': 'forms', 'Compliance': 'compliance', 'AI & Automation': 'ai', 'Integrations': 'integrations', 'Analytics': 'analytics', 'Patient Experience': 'patient', 'Security': 'security', 'System': 'system', 'Enterprise': 'enterprise' }; const menuId = menuMap[command.category]; if (menuId && !openMenus.includes(menuId)) { toggleMenu(menuId); } } } // Keyboard Shortcuts document.addEventListener('keydown', (e) => { // Cmd/Ctrl + K if ((e.metaKey || e.ctrlKey) && e.key === 'k') { e.preventDefault(); openCommandPalette(); } // Escape if (e.key === 'Escape') { closeCommandPalette(); } });