var notification = (function($, window, jQuery) {
return {
"getNotifications" : function() {
$.ajax({
url : baseurl_+"notification/get-notifications",
type : "GET",
success : function(result) {
if(result.length>0) {
notification.items = result;
$('.notif-count').text(result.length)
html=""
result.forEach(function(item) {
html+=`
${item.first_name}, ${item.last_name}
${moment(item.created_at).format("hh:mm a")}
${moment(item.created_at).format("MMM DD, YYYY")}
`
})
$('#notificationList').append(
``
);
} else {
$('.notif-count').hide()
}
}
});
},
"updateNotification": function(notificationId,userId) {
console.log(userId)
$.ajax({
url : baseurl_+'notification/update-notification',
type : "POST",
data : {
id: notificationId,
user_id: userId
},
success : function(result) {
window.location.href = baseurl_+'subscribers_list';
}
})
}
}
})(jQuery, this);
$(function(){
notification.getNotifications();
});