(function () {
window.dfNotification = {
notificationsServiceLink: "https://service.dflexnr.sk/SubjectsModule.EventDataHandler.moh.ashx", // "https://service.dflexnr.sk/DflexnrServiceModule.NotificationHandler.moh.ashx",
targetId: "dfService",
load: function (onLoad, onError) {
var target = $("#" + dfNotification.targetId);
if (target.length > 0) {
dfGet(dfNotification.notificationsServiceLink, function (d) {
//try {
target.accordion().accordion("destroy");
//} catch { }
target.empty();
if (d.Data) {
d.Data.forEach(function (item) {
var d = '
' + dfNotification.auGetIcon(item.Category + "") + '' + item.Name + '' + dfNotification.auFormatDate(new Date(item.CreationDate)) + '
';
d += '' + item.Description;
if (item.WebPage) d += '
Čítať viac...
';
d += '
';
target.append($(d));
});
target.accordion({ icons: false, heightStyle: "content" });
}
if (onLoad)
onLoad();
}, function(){
if (onError)
onError();
else
target.remove();
});
};
},
auGetIcon: function (c) {//⚠🙁👍🗹
switch (c) {
case "0": return '🛈';
case "1": return '⚠';
case "2": return '🛈';
case "3": return '⚠';
case "4": return '👍';
case "Info": return '🛈';
case "Error": return '⚠';
case "Warning": return '⚠';
case "Update": return '👍';
}
return '🛈';
},
auFormatDate: function (date) {
if (!date) return "";
year = date.getFullYear();
month = date.getMonth() + 1;
dt = date.getDate();
if (dt < 10) {
dt = '0' + dt;
}
if (month < 10) {
month = '0' + month;
}
return dt + '.' + month + '.' + year;
}
}
})();