|  | @@ -12,6 +12,7 @@ angular.module('app', [
 | 
		
	
		
			
			| 12 | 12 |      'pascalprecht.translate',
 | 
		
	
		
			
			| 13 | 13 |      'angular-busy',
 | 
		
	
		
			
			| 14 | 14 |      'luticate2Utils',
 | 
		
	
		
			
			|  | 15 | +    'SignalR',
 | 
		
	
		
			
			| 15 | 16 |      // 'luticateAuth',
 | 
		
	
		
			
			| 16 | 17 |      'appSdk'
 | 
		
	
		
			
			| 17 | 18 |  ])
 | 
		
	
	
		
			
			|  | @@ -132,7 +133,10 @@ angular.module('app', [
 | 
		
	
		
			
			| 132 | 133 |                  toolbarTitle: "pkguid.add.defaultToolbarTitle",
 | 
		
	
		
			
			| 133 | 134 |                  reloadOnSearch: false,
 | 
		
	
		
			
			| 134 | 135 |                  templateUrl:'views/pkguidedit.html',
 | 
		
	
		
			
			| 135 |  | -                controller:'PkGuidEditController'
 | 
		
	
		
			
			|  | 136 | +                controller:'PkGuidEditController',
 | 
		
	
		
			
			|  | 137 | +                params: {
 | 
		
	
		
			
			|  | 138 | +                    pkguid: null
 | 
		
	
		
			
			|  | 139 | +                }
 | 
		
	
		
			
			| 136 | 140 |              });
 | 
		
	
		
			
			| 137 | 141 |  
 | 
		
	
		
			
			| 138 | 142 |              $stateProvider.state('pkguid_edit', {
 | 
		
	
	
		
			
			|  | @@ -150,41 +154,85 @@ angular.module('app', [
 | 
		
	
		
			
			| 150 | 154 |  
 | 
		
	
		
			
			| 151 | 155 |              $urlRouterProvider.otherwise('/');
 | 
		
	
		
			
			| 152 | 156 |      }])
 | 
		
	
		
			
			| 153 |  | -    .run(['$rootScope', '$transitions', 'AppUtilsBusiness', 'ssSideNav', '$translate', 'luRequest', '$mdDialog',
 | 
		
	
		
			
			| 154 |  | -        function ($rootScope, $transitions, AppUtilsBusiness, ssSideNav, $translate, luRequest, $mdDialog) {
 | 
		
	
		
			
			| 155 |  | -
 | 
		
	
		
			
			| 156 |  | -        var apiVersion = null;
 | 
		
	
		
			
			|  | 157 | +    .run(['$rootScope', '$transitions', 'AppUtilsBusiness', 'ssSideNav', '$translate', 'luRequest', '$mdDialog', 'luNotificationsBusiness', '$mdToast', '$state',
 | 
		
	
		
			
			|  | 158 | +        function ($rootScope, $transitions, AppUtilsBusiness, ssSideNav, $translate, luRequest, $mdDialog, luNotificationsBusiness, $mdToast, $state) {
 | 
		
	
		
			
			| 157 | 159 |  
 | 
		
	
		
			
			| 158 |  | -        function apiVersionChanged(oldVersion, newVersion) {
 | 
		
	
		
			
			|  | 160 | +        AppUtilsBusiness.addApiVersionChangedCallback(function(oldVersion, newVersion) {
 | 
		
	
		
			
			| 159 | 161 |              $mdDialog.show(
 | 
		
	
		
			
			| 160 | 162 |                  $mdDialog.alert()
 | 
		
	
		
			
			| 161 | 163 |                      .title(AppUtilsBusiness.tr('common.updateDetected.title'))
 | 
		
	
		
			
			| 162 |  | -                    .textContent(AppUtilsBusiness.tr('common.updateDetected.text', {oldVersion: oldVersion, newVersion: newVersion}))
 | 
		
	
		
			
			|  | 164 | +                    .textContent(AppUtilsBusiness.tr('common.updateDetected.text',
 | 
		
	
		
			
			|  | 165 | +                        {oldVersion: oldVersion, newVersion: newVersion}))
 | 
		
	
		
			
			| 163 | 166 |                      .ok(AppUtilsBusiness.tr('common.ok')));
 | 
		
	
		
			
			| 164 |  | -        }
 | 
		
	
		
			
			| 165 |  | -
 | 
		
	
		
			
			| 166 |  | -        luRequest.addHook('resolve', function(url, method, dataGet, dataPost, luBusyGroups, data)
 | 
		
	
		
			
			| 167 |  | -        {
 | 
		
	
		
			
			| 168 |  | -            if (apiVersion == null) {
 | 
		
	
		
			
			| 169 |  | -                apiVersion = data.version;
 | 
		
	
		
			
			| 170 |  | -            }
 | 
		
	
		
			
			| 171 |  | -            else if (data.version != null && data.version != apiVersion) {
 | 
		
	
		
			
			| 172 |  | -                apiVersionChanged(apiVersion, data.version);
 | 
		
	
		
			
			| 173 |  | -                apiVersion = data.version;
 | 
		
	
		
			
			| 174 |  | -            }
 | 
		
	
		
			
			| 175 | 167 |          });
 | 
		
	
		
			
			| 176 | 168 |  
 | 
		
	
		
			
			| 177 |  | -        luRequest.addHook('reject', function(url, method, dataGet, dataPost, luBusyGroups, error)
 | 
		
	
		
			
			|  | 169 | +        luNotificationsBusiness.init();
 | 
		
	
		
			
			|  | 170 | +
 | 
		
	
		
			
			|  | 171 | +        luNotificationsBusiness.addEventCrudCallback('pkguid', function(eventName, entityType, oldEntity, newEntity)
 | 
		
	
		
			
			| 178 | 172 |          {
 | 
		
	
		
			
			| 179 |  | -            if (apiVersion == null) {
 | 
		
	
		
			
			| 180 |  | -                apiVersion = error.data.version;
 | 
		
	
		
			
			|  | 173 | +            var text = null;
 | 
		
	
		
			
			|  | 174 | +            if (eventName == luNotificationsBusiness.EVENT_CREATE) {
 | 
		
	
		
			
			|  | 175 | +                text = AppUtilsBusiness.tr('pkguid.notifications.create', {text: newEntity.someText});
 | 
		
	
		
			
			|  | 176 | +            }
 | 
		
	
		
			
			|  | 177 | +            else if (eventName == luNotificationsBusiness.EVENT_UPDATE) {
 | 
		
	
		
			
			|  | 178 | +                text = AppUtilsBusiness.tr('pkguid.notifications.update', {text: newEntity.someText});
 | 
		
	
		
			
			| 181 | 179 |              }
 | 
		
	
		
			
			| 182 |  | -            else if (error.data.version != null && error.data.version != apiVersion) {
 | 
		
	
		
			
			| 183 |  | -                apiVersionChanged(apiVersion, error.data.version);
 | 
		
	
		
			
			| 184 |  | -                apiVersion = error.data.version;
 | 
		
	
		
			
			|  | 180 | +            else if (eventName == luNotificationsBusiness.EVENT_DELETE) {
 | 
		
	
		
			
			|  | 181 | +                text = AppUtilsBusiness.tr('pkguid.notifications.delete', {text: oldEntity.someText});
 | 
		
	
		
			
			| 185 | 182 |              }
 | 
		
	
		
			
			|  | 183 | +            var toast = $mdToast.simple()
 | 
		
	
		
			
			|  | 184 | +                .textContent(text)
 | 
		
	
		
			
			|  | 185 | +                .action(eventName == luNotificationsBusiness.EVENT_DELETE ? AppUtilsBusiness.tr('common.undo') : AppUtilsBusiness.tr('common.view'))
 | 
		
	
		
			
			|  | 186 | +                .highlightAction(true)
 | 
		
	
		
			
			|  | 187 | +                .highlightClass('md-accent')
 | 
		
	
		
			
			|  | 188 | +                .position('bottom right');
 | 
		
	
		
			
			|  | 189 | +
 | 
		
	
		
			
			|  | 190 | +            $mdToast.show(toast).then(function(response) {
 | 
		
	
		
			
			|  | 191 | +                if (response == 'ok') {
 | 
		
	
		
			
			|  | 192 | +                    if (eventName == luNotificationsBusiness.EVENT_DELETE) {
 | 
		
	
		
			
			|  | 193 | +                        oldEntity.id = null;
 | 
		
	
		
			
			|  | 194 | +                        $state.go('pkguid_add', {pkguid: oldEntity});
 | 
		
	
		
			
			|  | 195 | +                    }
 | 
		
	
		
			
			|  | 196 | +                    else {
 | 
		
	
		
			
			|  | 197 | +                        $state.go('pkguid_edit', {id: newEntity.id, pkguid: newEntity});
 | 
		
	
		
			
			|  | 198 | +                    }
 | 
		
	
		
			
			|  | 199 | +                }
 | 
		
	
		
			
			|  | 200 | +            });
 | 
		
	
		
			
			| 186 | 201 |          });
 | 
		
	
		
			
			| 187 | 202 |  
 | 
		
	
		
			
			|  | 203 | +        // luNotificationsBusiness.addEventDeleteCallback('pkguid', function(eventName, entityType, oldEntity)
 | 
		
	
		
			
			|  | 204 | +        // {
 | 
		
	
		
			
			|  | 205 | +        //     var toast = $mdToast.simple()
 | 
		
	
		
			
			|  | 206 | +        //         .textContent("PkGuid \'" + oldEntity.someText + "\' was deleted")
 | 
		
	
		
			
			|  | 207 | +        //         .action("Undo")
 | 
		
	
		
			
			|  | 208 | +        //         .highlightAction(true)
 | 
		
	
		
			
			|  | 209 | +        //         .highlightClass('md-accent')
 | 
		
	
		
			
			|  | 210 | +        //         .position('bottom right');
 | 
		
	
		
			
			|  | 211 | +        //
 | 
		
	
		
			
			|  | 212 | +        //     $mdToast.show(toast).then(function(response) {
 | 
		
	
		
			
			|  | 213 | +        //         if (response == 'ok') {
 | 
		
	
		
			
			|  | 214 | +        //             oldEntity.id = null;
 | 
		
	
		
			
			|  | 215 | +        //             $state.go('pkguid_add', {pkguid: oldEntity});
 | 
		
	
		
			
			|  | 216 | +        //         }
 | 
		
	
		
			
			|  | 217 | +        //     });
 | 
		
	
		
			
			|  | 218 | +        // });
 | 
		
	
		
			
			|  | 219 | +        //
 | 
		
	
		
			
			|  | 220 | +        // luNotificationsBusiness.addEventCreateCallback('pkguid', function(eventName, entityType, oldEntity, newEntity)
 | 
		
	
		
			
			|  | 221 | +        // {
 | 
		
	
		
			
			|  | 222 | +        //     var toast = $mdToast.simple()
 | 
		
	
		
			
			|  | 223 | +        //         .textContent("PkGuid \'" + newEntity.someText + "\' was added")
 | 
		
	
		
			
			|  | 224 | +        //         .action("View")
 | 
		
	
		
			
			|  | 225 | +        //         .highlightAction(true)
 | 
		
	
		
			
			|  | 226 | +        //         .highlightClass('md-accent')
 | 
		
	
		
			
			|  | 227 | +        //         .position('bottom right');
 | 
		
	
		
			
			|  | 228 | +        //
 | 
		
	
		
			
			|  | 229 | +        //     $mdToast.show(toast).then(function(response) {
 | 
		
	
		
			
			|  | 230 | +        //         if (response == 'ok') {
 | 
		
	
		
			
			|  | 231 | +        //             $state.go('pkguid_edit', {id: newEntity.id, pkguid: newEntity});
 | 
		
	
		
			
			|  | 232 | +        //         }
 | 
		
	
		
			
			|  | 233 | +        //     });
 | 
		
	
		
			
			|  | 234 | +        // });
 | 
		
	
		
			
			|  | 235 | +
 | 
		
	
		
			
			| 188 | 236 |          $translate('common.appName').then(function() {
 | 
		
	
		
			
			| 189 | 237 |              for (var i = 0; i < ssSideNav.sections.length; ++i) {
 | 
		
	
		
			
			| 190 | 238 |                  var a = ssSideNav.sections[i];
 |