loadNotificationAlertscounts();
function loadNotificationAlertscounts() {

    var url = serverURL + "notifications?page=0&size=10000&alarm=false&sort=createdAt,desc";

    $.ajax({
        url: url,
        type: 'GET',
        dataType: "json",
        headers: {
            Authorization: "Bearer " + userObj.accessToken,
            "Content-Type": "application/json"
        },
        success: function (response) {

            let notifications = response.content || [];

            // 🔴 Count unread
            let unreadCount = notifications.filter(n => !n.read).length;
            console.log("Unread Alerts:", unreadCount);
            $(".badge_alerts").text(unreadCount);
        },
        error: function () {
            
            
        }
    });
}

