ปรับปรุงระบบ Notification
This commit is contained in:
@@ -287,10 +287,10 @@ namespace TodoAPI2.Models
|
||||
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
|
||||
}
|
||||
|
||||
//if (need_noti)
|
||||
//{
|
||||
// SendNotification(noti_to_employee_id, owner_eva_employee_id, existingEntity.id, noti_message, noti_url);
|
||||
//}
|
||||
if (need_noti)
|
||||
{
|
||||
SendNotification(noti_to_employee_id, owner_eva_employee_id, existingEntity.id, noti_message, noti_url);
|
||||
}
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
return Get(updated.id);
|
||||
|
||||
@@ -75,6 +75,11 @@
|
||||
<span class="allfontsize" data-fontsize="3" style="font-size:26px; width:20px; height:30px; display:flex; align-items:center; justify-content:center; font-weight:bold;">A</span>
|
||||
</div>
|
||||
|
||||
<div style="position: relative;" id="mynoti">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div data-toggle="dropdown" style="display: flex; cursor: pointer; align-items: center;">
|
||||
<span class="username" style="font-size:19px; line-height:23px; font-weight:bold;" id="username">no user</span>
|
||||
<b class="caret"></b>
|
||||
@@ -230,8 +235,10 @@
|
||||
$(document).ready(function(){
|
||||
var module = "eva";
|
||||
//var menu_url = appsite+"/json/"+module+".json";
|
||||
var menu_url = "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")/api/menu/"+module;
|
||||
var menu_url = "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")/api/menu/" + module;
|
||||
var noti_url = "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")/api/notifications";
|
||||
GetMenu(module, "#mymenu", menu_url);
|
||||
GetNoti(noti_url, "#mynoti", "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")");
|
||||
|
||||
$( document ).on( 'focus', ':input', function(){
|
||||
$( this ).attr( 'autocomplete', 'off' );
|
||||
@@ -284,7 +291,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +72,10 @@
|
||||
<span class="allfontsize" data-fontsize="3" style="font-size:26px; width:20px; height:30px; display:flex; align-items:center; justify-content:center; font-weight:bold;">A</span>
|
||||
</div>
|
||||
|
||||
<div style="position: relative;" id="mynoti">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div data-toggle="dropdown" style="display: flex; cursor: pointer; align-items: center;">
|
||||
@@ -228,8 +232,10 @@
|
||||
$(document).ready(function(){
|
||||
var module = "eva";
|
||||
//var menu_url = appsite+"/json/"+module+".json";
|
||||
var menu_url = "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")/api/menu/"+module;
|
||||
var menu_url = "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")/api/menu/" + module;
|
||||
var noti_url = "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")/api/notifications";
|
||||
GetMenu(module, "#mymenu", menu_url);
|
||||
GetNoti(noti_url, "#mynoti", "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")");
|
||||
|
||||
$( document ).on( 'focus', ':input', function(){
|
||||
$( this ).attr( 'autocomplete', 'off' );
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
<EmbeddedResource Remove="Uploads\**" />
|
||||
<EmbeddedResource Remove="wwwroot\js_app\**" />
|
||||
<Folder Include="Migrations\" />
|
||||
<Folder Include="wwwroot\json\" />
|
||||
<None Remove="Data\**" />
|
||||
<None Remove="Files\**" />
|
||||
<None Remove="Uploads\**" />
|
||||
|
||||
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