ปรับปรุงระบบ Notification
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -562,6 +562,59 @@ function GetSubMenu(result){
|
||||
return x;
|
||||
}
|
||||
|
||||
function GetNoti(noti_url, mynoti, root) {
|
||||
var refresh_noti = function (result) {
|
||||
//console.log(result);
|
||||
//console.log(result.unread.length);
|
||||
|
||||
var dropdown = "";
|
||||
|
||||
if (result.unread.length <= 0) {
|
||||
dropdown = '<div data-toggle="dropdown" class="dropdown-toggle" href="#" style="display: flex;"><i class="fa fa-bell" style="font-size: 19px;color:#ccc"></i></div>';
|
||||
} else {
|
||||
dropdown = '<div data-toggle="dropdown" class="dropdown-toggle" href="#" style="display: flex;"><i class="fa fa-bell" style="font-size: 19px;color:red"></i><div style="color: red;font-size:18px">+' + result.unread.length+'</div></div>';
|
||||
}
|
||||
$(mynoti).append(dropdown);
|
||||
|
||||
var tag = "";
|
||||
var temp = "'";
|
||||
|
||||
if (result.readed.length + result.unread.length > 0) {
|
||||
|
||||
tag += '<ul class="dropdown-menu extended notification" style="min-width: 500px;">';
|
||||
|
||||
if (result.unread.length > 0) {
|
||||
tag += '<li><p class="red">แจ้งเตือนมาใหม่</p></li>';
|
||||
$.each(result.unread, function (i, data) {
|
||||
tag += '<li><a href="javascript:window_open_from_root(' + temp + root + '/read_notification_url/' + data.id + '?url=' + data.data.url + temp +');"><div class="badge-noti">New</div><span class="message">' + data.data.title+'</span><span class="time"> วันที่ 16/02/2564 เวลา 16:02 น.</span></a></li>';
|
||||
});
|
||||
}
|
||||
|
||||
if (result.readed.length > 0) {
|
||||
tag += '<li><p class="green">แจ้งเตือนที่อ่านแล้ว</p></li>';
|
||||
$.each(result.readed, function (i, data) {
|
||||
tag += '<li><a href="javascript:window_open_from_root(' + temp + root + '/read_notification_url/' + data.id + '?url=' + data.data.url + temp +');"><span class="message">' + data.data.title +'</span><span class="time"> วันที่ 16/02/2564 เวลา 16:02 น.</span></a></li>';
|
||||
});
|
||||
}
|
||||
|
||||
tag += '</ul>';
|
||||
}
|
||||
|
||||
$(mynoti).append(tag);
|
||||
|
||||
endLoad();
|
||||
};
|
||||
|
||||
var noti_error = function (xhr, status, error) {
|
||||
var errorMessage = xhr.responseText;
|
||||
console.log("noti error = " + errorMessage);
|
||||
endLoad();
|
||||
}
|
||||
|
||||
startLoad();
|
||||
AjaxGetRequest(noti_url, refresh_noti, noti_error);
|
||||
}
|
||||
|
||||
function GetMenu(module, mymenu, menu_url){
|
||||
var refresh_menu = function (result) {
|
||||
$.each(result, function (i, data) {
|
||||
|
||||
Reference in New Issue
Block a user