Develop Notifikasi

This commit is contained in:
Pusdatin BPKD Jkt
2022-07-21 10:51:47 +07:00
parent 170888ba34
commit bd7998178f
19 changed files with 132 additions and 1791 deletions
+34 -1
View File
@@ -342,4 +342,37 @@ $(".has-treeview").removeClass("menu-open active");
$(currentLink).closest(".has-treeview").addClass("menu-open active");
$($(currentLink).closest(".has-treeview")).children("a.nav-link").addClass("active");
$($(currentLink).closest(".nav-treeview")).closest("li.nav-item").addClass("menu-open");
$($(currentLink).closest(".nav-treeview")).parentsUntil(".nav-sidebar > .nav-treeview").addClass('menu-open');
$($(currentLink).closest(".nav-treeview")).parentsUntil(".nav-sidebar > .nav-treeview").addClass('menu-open');
$("#span_count_notif").hide();
refreshNotif = ()=>{
$.ajax({
url: "/notif/get-notif",
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
type: "json",
method: "POST",
success: function(data){
$("#span_count_notif").hide();
if (data.length>0){
$("#span_count_notif").html(data.length);
$("#span_count_notif").show();
$listElm = "";
$.each(data, function(x,y){
$listElm = `<a href="`+y.url+`" class="dropdown-item">
<div class="media">
<div class="media-body">
<h3 class="dropdown-item-title"><strong>`+ y.jenis +`</strong>
<span class="float-right text-sm text-danger"></span>
</h3>
<p class="text-sm">`+y.message+`</p>
</div>
</div>
</a>
<div class="dropdown-divider"></div>`;
});
$listElm += `<a href="/notif" class="dropdown-item dropdown-footer">Lihat semua Notifikasi</a>`;
$("#list_notif").html($listElm);
}
}
})
}
refreshNotif();