ปรับปรุงระบบ Notification

This commit is contained in:
Nakorn Rientrakrunchai
2021-02-18 13:27:48 +07:00
parent c5ebef0700
commit 884c0effff
6 changed files with 2272 additions and 2202 deletions

View File

@@ -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(); noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
} }
//if (need_noti) if (need_noti)
//{ {
// SendNotification(noti_to_employee_id, owner_eva_employee_id, existingEntity.id, noti_message, noti_url); SendNotification(noti_to_employee_id, owner_eva_employee_id, existingEntity.id, noti_message, noti_url);
//} }
var updated = _repository.Update(id, existingEntity); var updated = _repository.Update(id, existingEntity);
return Get(updated.id); return Get(updated.id);

View File

@@ -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> <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>
<div style="position: relative;" id="mynoti">
</div>
<div data-toggle="dropdown" style="display: flex; cursor: pointer; align-items: center;"> <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> <span class="username" style="font-size:19px; line-height:23px; font-weight:bold;" id="username">no user</span>
<b class="caret"></b> <b class="caret"></b>
@@ -231,7 +236,9 @@
var module = "eva"; var module = "eva";
//var menu_url = appsite+"/json/"+module+".json"; //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); GetMenu(module, "#mymenu", menu_url);
GetNoti(noti_url, "#mynoti", "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")");
$( document ).on( 'focus', ':input', function(){ $( document ).on( 'focus', ':input', function(){
$( this ).attr( 'autocomplete', 'off' ); $( this ).attr( 'autocomplete', 'off' );

View File

@@ -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> <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>
<div style="position: relative;" id="mynoti">
</div>
<div> <div>
<div data-toggle="dropdown" style="display: flex; cursor: pointer; align-items: center;"> <div data-toggle="dropdown" style="display: flex; cursor: pointer; align-items: center;">
@@ -229,7 +233,9 @@
var module = "eva"; var module = "eva";
//var menu_url = appsite+"/json/"+module+".json"; //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); GetMenu(module, "#mymenu", menu_url);
GetNoti(noti_url, "#mynoti", "@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")");
$( document ).on( 'focus', ':input', function(){ $( document ).on( 'focus', ':input', function(){
$( this ).attr( 'autocomplete', 'off' ); $( this ).attr( 'autocomplete', 'off' );

View File

@@ -63,7 +63,6 @@
<EmbeddedResource Remove="Uploads\**" /> <EmbeddedResource Remove="Uploads\**" />
<EmbeddedResource Remove="wwwroot\js_app\**" /> <EmbeddedResource Remove="wwwroot\js_app\**" />
<Folder Include="Migrations\" /> <Folder Include="Migrations\" />
<Folder Include="wwwroot\json\" />
<None Remove="Data\**" /> <None Remove="Data\**" />
<None Remove="Files\**" /> <None Remove="Files\**" />
<None Remove="Uploads\**" /> <None Remove="Uploads\**" />

View File

@@ -6,10 +6,10 @@ Website: http://thevectorlab.net/
*/ */
/* Import fonts */ /* Import fonts */
@import url("//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic"); @import url( //fonts.googleapis.com/css?family=Open+Sans:400, 300, 300italic, 400italic, 600, 600italic, 700, 700italic, 800, 800italic );
body { body {
color: #000000; color: #797979;
background: #f1f2f7; background: #f1f2f7;
font-family: "Open Sans", sans-serif; font-family: "Open Sans", sans-serif;
padding: 0px !important; padding: 0px !important;
@@ -208,7 +208,6 @@ a:focus {
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
} }
/*---*/ /*---*/
.nav-collapse.collapse { .nav-collapse.collapse {
@@ -307,7 +306,6 @@ ul.sidebar-menu li a:focus {
display: block; display: block;
border-radius: 4px; border-radius: 4px;
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
-webkit-transition: all 0.3s ease; -webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease; -moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease; -o-transition: all 0.3s ease;
@@ -445,33 +443,36 @@ ul.top-menu>li>a:focus {
} }
.dropdown-menu.extended { .dropdown-menu.extended {
max-width: 300px !important; max-width: 480px !important;
min-width: 160px !important; min-width: 380px !important;
top: 42px; top: 42px;
width: 235px !important;
padding: 0; padding: 0;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.176) !important;
border: none !important; border: none !important;
border-radius: 4px;
-webkit-border-radius: 4px;
} }
@media screen and (-webkit-min-device-pixel-ratio: 0) { .dropdown-menu.extended li {
padding: 0 !important;
/* Safari and Chrome */
.dropdown-menu.extended {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.176) !important;
}
} }
.dropdown-menu.extended li p { .dropdown-menu.extended li p {
background-color: #f1f2f7; /* background-color: #b2bcee;
color: #666666; color: #000; */
margin: 0; margin: 0;
padding: 10px; padding: 10px 0 10px 10px;
font-size: 14px; font-size: 1.2em;
border-radius: 4px 4px 0px 0px; /* border-radius: 4px 4px 0px 0px; */
-webkit-border-radius: 4px 4px 0px 0px; /* -webkit-border-radius: 4px 4px 0px 0px; */
}
.badge-noti {
z-index: 100;
color: red;
border-radius: 30px;
}
.dropdown-menu.extended li p.gray {
background-color: #ccc;
color: #fff;
} }
.dropdown-menu.extended li p.green { .dropdown-menu.extended li p.green {
@@ -491,7 +492,7 @@ ul.top-menu>li>a:focus {
.dropdown-menu.extended li a { .dropdown-menu.extended li a {
border-bottom: 1px solid #ebebeb !important; border-bottom: 1px solid #ebebeb !important;
font-size: 12px; font-size: 1.2em;
list-style: none; list-style: none;
} }
@@ -961,7 +962,8 @@ ul.top-menu>li>a:focus {
display: inline-block; display: inline-block;
} }
.chart-tittle .title {} .chart-tittle .title {
}
.card.green-chart .chart-tittle .value { .card.green-chart .chart-tittle .value {
float: right; float: right;
@@ -1012,7 +1014,7 @@ ul.top-menu>li>a:focus {
/**/ /**/
.card-body.chart-texture { .card-body.chart-texture {
background: url("/BackendScript/img/chart-texture.jpg"); background: url("../img/chart-texture.jpg");
-webkit-border-radius: 4px 4px 0px 0px; -webkit-border-radius: 4px 4px 0px 0px;
border-radius: 4px 4px 0px 0px; border-radius: 4px 4px 0px 0px;
} }
@@ -1473,7 +1475,6 @@ h3.timeline-title {
} }
@media screen and (-webkit-min-device-pixel-ratio: 0) { @media screen and (-webkit-min-device-pixel-ratio: 0) {
/* Safari and Chrome */ /* Safari and Chrome */
.card-footer.revenue-foot { .card-footer.revenue-foot {
margin-bottom: -4px; margin-bottom: -4px;
@@ -1511,7 +1512,7 @@ h3.timeline-title {
padding: 14px 15px; padding: 14px 15px;
text-align: center; text-align: center;
border-right: 1px solid #d5d8df; border-right: 1px solid #d5d8df;
color: #000000; color: #797979;
} }
.card-footer.revenue-foot ul li a:hover, .card-footer.revenue-foot ul li a:hover,
@@ -1622,7 +1623,7 @@ ul.ft-link li a i {
.owl-buttons .owl-prev { .owl-buttons .owl-prev {
text-indent: -9999px; text-indent: -9999px;
background: url("/BackendScript/img/left-arrow.png") no-repeat; background: url("../img/left-arrow.png") no-repeat;
width: 6px; width: 6px;
height: 10px; height: 10px;
display: inline-block; display: inline-block;
@@ -1630,7 +1631,7 @@ ul.ft-link li a i {
.owl-buttons .owl-next { .owl-buttons .owl-next {
text-indent: -9999px; text-indent: -9999px;
background: url("/BackendScript/img/right-arrow.png") no-repeat; background: url("../img/right-arrow.png") no-repeat;
width: 6px; width: 6px;
height: 10px; height: 10px;
display: inline-block; display: inline-block;
@@ -1945,7 +1946,8 @@ ul.ft-link li a i {
font-size: 14px; font-size: 14px;
} }
.weather-category ul li a {} .weather-category ul li a {
}
.weather-category ul li:last-child { .weather-category ul li:last-child {
border-right: none; border-right: none;
@@ -1970,7 +1972,7 @@ ul.ft-link li a i {
} }
.fontawesome-icon-list a { .fontawesome-icon-list a {
color: #000000; color: #797979;
} }
.fontawesome-icon-list a:hover { .fontawesome-icon-list a:hover {
@@ -2004,7 +2006,7 @@ ul.ft-link li a i {
} }
.menu-list a { .menu-list a {
color: #000000; color: #797979;
} }
.menu-list a:hover { .menu-list a:hover {
@@ -2378,7 +2380,7 @@ ul.inbox-pagination li {
.sender-dropdown { .sender-dropdown {
background: #eaeaea; background: #eaeaea;
padding: 0 3px; padding: 0 3px;
color: #000000; color: #777;
font-size: 10px; font-size: 10px;
} }
@@ -2967,14 +2969,14 @@ ul.amounts li {
} }
.dataTables_paginate.paging_bootstrap.pagination li a { .dataTables_paginate.paging_bootstrap.pagination li a {
color: #000000; color: #797979;
padding: 5px 10px; padding: 5px 10px;
display: inline-block; display: inline-block;
} }
.dataTables_paginate.paging_bootstrap.pagination li:hover a, .dataTables_paginate.paging_bootstrap.pagination li:hover a,
.dataTables_paginate.paging_bootstrap.pagination li.active a { .dataTables_paginate.paging_bootstrap.pagination li.active a {
color: #000000; color: #797979;
background: #eee; background: #eee;
border-radius: 3px; border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
@@ -3115,7 +3117,7 @@ ul.amounts li {
.tab-head .nav-tabs > li.active > a:focus { .tab-head .nav-tabs > li.active > a:focus {
background-color: #f1f2f7; background-color: #f1f2f7;
border-color: #f1f2f7; border-color: #f1f2f7;
color: #000000; color: #797979;
} }
/*general page*/ /*general page*/
@@ -3364,7 +3366,7 @@ input.spinner[type="url"],
input.spinner[type="search"], input.spinner[type="search"],
input.spinner[type="tel"], input.spinner[type="tel"],
input.spinner[type="color"] { input.spinner[type="color"] {
background: url("/BackendScript/img/input-spinner.gif") right no-repeat !important; background: url("../img/input-spinner.gif") right no-repeat !important;
} }
/*form validation*/ /*form validation*/
@@ -3838,7 +3840,6 @@ select.form-control-lg {
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.picker-form .form-group label, .picker-form .form-group label,
.right-text-label-form .form-group label { .right-text-label-form .form-group label {
text-align: right; text-align: right;
@@ -4899,7 +4900,7 @@ tr.odd.gradeU td.sorting_1 {
/*lock screen*/ /*lock screen*/
.lock-screen { .lock-screen {
background: #02bac6 url("/BackendScript/img/lock-bg.jpg"); background: #02bac6 url("../img/lock-bg.jpg");
background-size: cover; background-size: cover;
background-repeat: repeat; background-repeat: repeat;
} }
@@ -5239,7 +5240,7 @@ tr.odd.gradeU td.sorting_1 {
.pricing-head h2 { .pricing-head h2 {
padding: 30px 0; padding: 30px 0;
background: #000000777; background: #777777;
color: #fff; color: #fff;
font-size: 50px; font-size: 50px;
font-weight: 100; font-weight: 100;
@@ -5329,7 +5330,7 @@ tr.odd.gradeU td.sorting_1 {
margin-bottom: 5px; margin-bottom: 5px;
border-radius: 4px; border-radius: 4px;
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
color: #000000; color: #797979;
-webkit-transition: all 0.3s ease; -webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease; -moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease; -o-transition: all 0.3s ease;
@@ -5640,7 +5641,7 @@ tr.odd.gradeU td.sorting_1 {
-o-transition: all 0.3s ease; -o-transition: all 0.3s ease;
transition: all 0.3s ease; transition: all 0.3s ease;
box-shadow: none; box-shadow: none;
background: #01a6b2 url("/BackendScript/img/chat-search.png") no-repeat 12px 9px; background: #01a6b2 url("../img/chat-search.png") no-repeat 12px 9px;
padding: 0 5px 0 35px; padding: 0 5px 0 35px;
margin-top: 2px; margin-top: 2px;
border: none; border: none;
@@ -6193,7 +6194,7 @@ a.guest-on i {
} }
.mega-bg { .mega-bg {
background-image: url("/BackendScript/img/mega-menu/corner_image.jpg"); background-image: url("../img/mega-menu/corner_image.jpg");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: bottom right; background-position: bottom right;
position: absolute; position: absolute;
@@ -6300,7 +6301,7 @@ a.guest-on i {
display: inline-block; display: inline-block;
border: 1px solid #ddd; border: 1px solid #ddd;
padding: 3px 10px; padding: 3px 10px;
color: #000000; color: #797979;
border-radius: 4px; border-radius: 4px;
font-size: 12px; font-size: 12px;
} }
@@ -6630,10 +6631,11 @@ header.blue-bg .search:focus {
.select2-container { .select2-container {
width: 100% !important; width: 100% !important;
z-index: 5000;
} }
.select2-container--default .select2-selection--multiple .select2-selection__rendered { .select2-container--default
.select2-selection--multiple
.select2-selection__rendered {
padding: 3px; padding: 3px;
} }
@@ -6647,15 +6649,18 @@ header.blue-bg .search:focus {
height: 36px; height: 36px;
} }
.select2-container--default .select2-selection--single .select2-selection__rendered { .select2-container--default
.select2-selection--single
.select2-selection__rendered {
line-height: 34px; line-height: 34px;
} }
.select2-container--default .select2-selection--single .select2-selection__arrow { .select2-container--default
.select2-selection--single
.select2-selection__arrow {
height: 34px; height: 34px;
} }
/*-----*/ /*-----*/
.is-sidebar-nav-open #sidebar { .is-sidebar-nav-open #sidebar {

View File

@@ -562,6 +562,59 @@ function GetSubMenu(result){
return x; 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){ function GetMenu(module, mymenu, menu_url){
var refresh_menu = function (result) { var refresh_menu = function (result) {
$.each(result, function (i, data) { $.each(result, function (i, data) {