gfds
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
@else
|
||||
<button class="notif-page-tab active" data-tab="system">{{ t('nav.notif_tab_system') }}</button>
|
||||
@endif
|
||||
@if(session && session.admin)
|
||||
<button class="notif-page-tab @if(activeTab === 'admin') active @endif" data-tab="admin">Admin</button>
|
||||
@endif
|
||||
</div>
|
||||
<div id="notifications-container" class="posts notifications-list-full" data-page="{{ pagination.page }}" data-tab="{{ activeTab }}">
|
||||
@include(snippets/notifications-list)
|
||||
@@ -55,16 +58,18 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Mark all read
|
||||
// Mark all read (current tab only)
|
||||
const btn = document.getElementById('mark-all-read-page');
|
||||
if (btn) {
|
||||
btn.onclick = async () => {
|
||||
const res = await fetch('/api/notifications/read', { method: 'POST' });
|
||||
const activeTabEl = document.querySelector('.notif-page-tab.active');
|
||||
const tab = activeTabEl ? activeTabEl.dataset.tab : container.dataset.tab;
|
||||
const res = await fetch('/api/notifications/read?tab=' + encodeURIComponent(tab), { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
document.querySelectorAll('.notif-item.unread').forEach(el => el.classList.remove('unread'));
|
||||
if (window.NotificationSystemInstance) {
|
||||
window.NotificationSystemInstance.markAllReadUI();
|
||||
window.NotificationSystemInstance.markAllReadUI(tab);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user