done
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user