loadNotificationAlarmscounts();
function loadNotificationAlarmscounts() {

    var url = serverURL + "notifications?page=0&size=10000&alarm=true&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 Alarms:", unreadCount);
            $(".badge_alarms").text(unreadCount);
        },
        error: function () {
            
            
        }
    });
}

