This commit is contained in:
odzugkoev
2026-03-01 17:10:03 -05:00
parent 7e0887c62d
commit 85cf732a61
19 changed files with 2284 additions and 32 deletions

View File

@@ -84,18 +84,50 @@ const audioNotification = {
}
};
// Abandoned call badge tracking
let lastAbandonedCallCount = 0;
function refreshAbandonedCallCount() {
fetch('/api/abandoned-calls/pending-count')
.then(r => r.json())
.then(data => {
if (data.error) return;
const count = data.count || 0;
const link = document.getElementById('abandonedCallsLink');
const badge = document.getElementById('abandonedCallsBadge');
if (!link || !badge) return;
if (count > 0) {
badge.style.display = '';
badge.textContent = count;
if (count > lastAbandonedCallCount && lastAbandonedCallCount >= 0) {
link.classList.add('pulse');
setTimeout(() => link.classList.remove('pulse'), 2000);
if (!isFirstLoad) {
audioNotification.playNewOrderSound();
}
}
} else {
badge.style.display = 'none';
}
lastAbandonedCallCount = count;
})
.catch(() => {});
}
// Initialize dashboard
document.addEventListener('DOMContentLoaded', function() {
setupFilterButtons();
audioNotification.init();
refreshOrders();
refreshAbandonedCallCount();
// Set up auto-refresh
setInterval(refreshOrders, config.dashboardRefreshInterval || 10000);
setInterval(refreshAbandonedCallCount, 30000);
// Initialize connection monitoring
checkConnectionStatus();
// Check connection status every 15 seconds
setInterval(checkConnectionStatus, 15000);
});