(function () {
'use strict';
// Users service used for communicating with the users REST endpoint
angular
.module('core')
.factory('NotifycationService', NotifycationService);
NotifycationService.$inject = ['$translate', 'Notification'];
function NotifycationService($translate, Notification) {
var service = {
showNotify: showNotify,
showSuccessNotify: showSuccessNotify,
showErrorNotify: showErrorNofity
};
return service;
function showNotify(type, icon, msgid) {
var msg = $translate.instant(msgid);
switch (type) {
case 'info':
Notification.info({
message: ' ' + msg
});
break;
case 'success':
Notification.success({
message: ' ' + msg
});
break;
case 'primary':
Notification.primary({
message: ' ' + msg
});
break;
case 'warning':
Notification.warning({
message: ' ' + msg
});
break;
case 'error':
Notification.error({
message: ' ' + msg
});
break;
default:
Notification.info({
message: ' ' + msg
});
}
}
function showSuccessNotify(msgId) {
var msg = $translate.instant(msgId);
Notification.success({
message: ' ' + msg
});
}
function showErrorNofity(msg, titleMsgId) {
var title_msg = $translate.instant(titleMsgId);
if (msg) {
Notification.error({
message: msg,
title: ' ' + title_msg
});
} else {
Notification.error({
message: ' ' + title_msg
});
}
}
}
}());