|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/assetradar.outerorbittech.com/inc/ | |
|
Path: /home2/outerorb/assetradar.outerorbittech.com/inc/footer.php
Size: 1.32 KB
Permissions: 0666
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
<?php if (isset($user) && $user): ?>
async function loadNotifs() {
try {
const res = await fetch('<?php echo BASE_URL; ?>/api/notifications.php');
if (!res.ok) return;
const data = await res.json();
const menu = document.getElementById('notifMenu');
const count = document.getElementById('notifCount');
menu.innerHTML = '';
if (data.length === 0) {
menu.innerHTML = '<li class="text-center small text-muted">No notifications</li>';
count.style.display = 'none';
} else {
count.style.display = 'inline-block';
count.textContent = data.filter(n=>!n.is_read).length;
data.forEach(n=>{
const li = document.createElement('li');
li.innerHTML = '<a class="dropdown-item small" href="#">'+n.message+'<div class="small text-muted">'+n.created_at+'</div></a>';
menu.appendChild(li);
});
const mark = document.createElement('li');
mark.innerHTML = '<hr><a class="dropdown-item text-center small" href="<?php echo BASE_URL; ?>/api/notifications.php?mark=all">Mark all read</a>';
menu.appendChild(mark);
}
} catch(e){}
}
loadNotifs();
setInterval(loadNotifs, 15000); // poll every 15s
<?php endif; ?>
</script>
</body>
</html>