| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 | 
							- 'use strict';
 - 
 - /* App Module */
 - function addCrudStates($stateProvider, itemType, listState, addState, editState) {
 -     if (listState == null || listState === true) {
 -         $stateProvider.state(itemType, {
 -             url: '/' + itemType,
 -             parent: 'root',
 -             title: itemType + '.name',
 -             templateUrl: 'views/' + itemType + '.html',
 -             controller: itemType + 'Controller'
 -         });
 -     }
 - 
 -     if (addState == null || addState === true) {
 -         $stateProvider.state(itemType + '_add', {
 -             url: '/' + itemType + '/add',
 -             parent: 'root',
 -             title: itemType + '.add.defaultTitle',
 -             toolbarTitle: itemType + '.add.defaultToolbarTitle',
 -             templateUrl: 'views/' + itemType + 'edit.html',
 -             controller: itemType + 'EditController',
 -             params: {
 -                 item: null
 -             }
 -         });
 -     }
 - 
 - 
 -     if (editState == null || editState === true) {
 -         $stateProvider.state(itemType + '_edit', {
 -             url: '/' + itemType + '/edit/:id',
 -             parent: 'root',
 -             title: itemType + '.edit.defaultTitle',
 -             toolbarTitle: itemType + '.edit.defaultToolbarTitle',
 -             templateUrl: 'views/' + itemType + 'edit.html',
 -             controller: itemType + 'EditController',
 -             params: {
 -                 item: null
 -             }
 -         });
 -     }
 - 
 - }
 - 
 - function addCrudNotifications(luNotificationsBusiness, AppUtilsBusiness, $mdToast, $state, itemType) {
 -     luNotificationsBusiness.addEventCrudCallback(itemType, function(eventName, entityType, oldEntity, newEntity)
 -     {
 -         var text = null;
 -         if (eventName == luNotificationsBusiness.EVENT_CREATE) {
 -             text = AppUtilsBusiness.tr(itemType + '.notifications.create', {text: newEntity.toString()});
 -         }
 -         else if (eventName == luNotificationsBusiness.EVENT_UPDATE) {
 -             text = AppUtilsBusiness.tr(itemType + '.notifications.update', {text: newEntity.toString()});
 -         }
 -         else if (eventName == luNotificationsBusiness.EVENT_DELETE) {
 -             text = AppUtilsBusiness.tr(itemType + '.notifications.delete', {text: oldEntity.toString()});
 -         }
 -         var toast = $mdToast.simple()
 -             .textContent(text)
 -             .action(eventName == luNotificationsBusiness.EVENT_DELETE ? AppUtilsBusiness.tr('common.undo') : AppUtilsBusiness.tr('common.view'))
 -             .highlightAction(true)
 -             .highlightClass('md-accent')
 -             .position('bottom right');
 - 
 -         $mdToast.show(toast).then(function(response) {
 -             if (response == 'ok') {
 -                 if (eventName == luNotificationsBusiness.EVENT_DELETE) {
 -                     oldEntity.id = null;
 -                     $state.go(itemType + '_add', {item: oldEntity});
 -                 }
 -                 else {
 -                     $state.go(itemType + '_edit', {id: newEntity.id, item: newEntity});
 -                 }
 -             }
 -         }, function (error) {console.log(error)});
 -     });
 - }
 - 
 - angular.module('app', [
 -     'ui.bootstrap',
 -     'ui.router',
 -     'LocalStorageModule',
 -     'ngMaterial',
 -     'md.data.table',
 -     'sasrio.angular-material-sidenav',
 -     'pascalprecht.translate',
 -     'angular-busy',
 -     'luticate2Utils',
 -     'ngSanitize',
 -     'SignalR',
 -     // 'luticateAuth',
 -     'appSdk'
 - ])
 -     .config(['$stateProvider', '$urlRouterProvider', 'ssSideNavSectionsProvider', '$mdThemingProvider',
 -         '$mdIconProvider', '$translateProvider', '$provide',
 -         function($stateProvider, $urlRouterProvider, ssSideNavSectionsProvider, $mdThemingProvider,
 -                  $mdIconProvider, $translateProvider, $provide) {
 - 
 -             // $mdThemingProvider
 -             //     .theme('default')
 -             //     .primaryPalette('blue', {
 -             //         'default': '700'
 -             //     });
 - 
 -             // $mdThemingProvider.theme('default')
 -             //     .primaryPalette('blue')
 -             //     .accentPalette('pink');
 - 
 -             $provide.decorator('$mdDialog', ['$delegate', function ($delegate) {
 -                 // Get a handle of the show method
 -                 var c = $delegate.show;
 - 
 -                 function decorateDialogShow () {
 -                     var args = angular.extend({}, arguments[0], {
 -                         skipHide: true
 -                     });
 -                     if (args._options != null) {
 -                         args._options = angular.extend({}, args._options, {
 -                             skipHide: true
 -                         });
 -                     }
 -                     return c(args);
 -                 }
 - 
 -                 $delegate.show = decorateDialogShow;
 -                 return $delegate;
 -             }]);
 - 
 -             $translateProvider.useSanitizeValueStrategy('escapeParameters');
 -             $translateProvider.useMessageFormatInterpolation();
 -             $translateProvider.useStaticFilesLoader({
 -                 prefix: 'translations/',
 -                 suffix: '.json'
 -             });
 -             $translateProvider.preferredLanguage('en');
 - 
 -             $mdIconProvider
 -                 .icon('md-toggle-arrow', 'img/arrow.svg');
 - 
 -             ssSideNavSectionsProvider.initWithTheme($mdThemingProvider);
 -             ssSideNavSectionsProvider.initWithSections([{
 -                 id: 'toogle_1',
 -                 name: 'home.categories',
 -                 type: 'heading',
 -                 children: [{
 -                     id: 'persons.name',
 -                     name: 'persons.name',
 -                     state: 'persons',
 -                     type: 'link'
 -                 }, {
 -                     id: 'locations.name',
 -                     name: 'locations.name',
 -                     state: 'locations',
 -                     type: 'link'
 -                 }, {
 -                     id: 'countries.name',
 -                     name: 'countries.name',
 -                     state: 'countries',
 -                     type: 'link'
 -                 }]
 -             }]);
 - 
 -             $stateProvider.state('root', {
 -                 abstract: true,
 -                 template: '<div ui-view=""></div>',
 -                 // resolve: ['luticateAuthUsers', function(luticateAuthUsers)
 -                 // {
 -                 //     return luticateAuthUsers.loadUserData(null);
 -                 // }]
 -             });
 - 
 -             $stateProvider.state('home', {
 -                 url:'/',
 -                 parent: 'root',
 -                 title: 'home.name',
 -                 reloadOnSearch: false,
 -                 templateUrl:'views/home.html',
 -                 controller:'HomeController'
 -             });
 - 
 -             $stateProvider.state('locations', {
 -                 url:'/locations',
 -                 parent: 'root',
 -                 title: 'locations.name',
 -                 reloadOnSearch: false,
 -                 templateUrl:'views/articlesCategory.html',
 -                 controller:'articleCategoryController',
 -                 params: {
 -                     type: 'locations'
 -                 }
 -             });
 - 
 -             $stateProvider.state('persons', {
 -                 url:'/persons',
 -                 parent: 'root',
 -                 title: 'persons.name',
 -                 reloadOnSearch: false,
 -                 templateUrl:'views/articlesCategory.html',
 -                 controller:'articleCategoryController',
 -                 params: {
 -                     type: 'persons'
 -                 }
 -             });
 - 
 -             $stateProvider.state('countries', {
 -                 url:'/countries',
 -                 parent: 'root',
 -                 title: 'countries.name',
 -                 reloadOnSearch: false,
 -                 templateUrl:'views/articlesCategory.html',
 -                 controller:'articleCategoryController',
 -                 params: {
 -                     type: 'countries'
 -                 }
 -             });
 - 
 -             $stateProvider.state('articles_view', {
 -                 url:'/articles/:id',
 -                 parent: 'root',
 -                 title: 'articles.name',
 -                 reloadOnSearch: false,
 -                 templateUrl:'views/articlesview.html',
 -                 controller:'articlesViewController',
 -                 params: {
 -                     id: null,
 -                     item: null
 -                 }
 -             });
 - 
 -             addCrudStates($stateProvider, 'articles');
 - 
 -             $urlRouterProvider.otherwise('/');
 -     }])
 -     .run(['$rootScope', '$transitions', 'AppUtilsBusiness', 'ssSideNav', '$translate', 'luRequest', '$mdDialog',
 -         'luNotificationsBusiness', '$mdToast', '$state', 'articlesBusiness',
 -         function ($rootScope, $transitions, AppUtilsBusiness, ssSideNav, $translate, luRequest, $mdDialog,
 -                   luNotificationsBusiness, $mdToast, $state, articlesBusiness) {
 - 
 -         AppUtilsBusiness.addApiVersionChangedCallback(function(oldVersion, newVersion) {
 -             $mdDialog.show(
 -                 $mdDialog.alert()
 -                     .title(AppUtilsBusiness.tr('common.updateDetected.title'))
 -                     .textContent(AppUtilsBusiness.tr('common.updateDetected.text',
 -                         {oldVersion: oldVersion, newVersion: newVersion}))
 -                     .ok(AppUtilsBusiness.tr('common.ok')));
 -         });
 - 
 -         luNotificationsBusiness.init({
 -             'articles': articlesBusiness
 -         });
 -         addCrudNotifications(luNotificationsBusiness, AppUtilsBusiness, $mdToast, $state, 'articles');
 - 
 -         $translate('common.appName').then(function() {
 -             for (var i = 0; i < ssSideNav.sections.length; ++i) {
 -                 var a = ssSideNav.sections[i];
 -                 a.name = AppUtilsBusiness.tr(a.name);
 -                 if (a.children != null) {
 -                     for (var j = 0; j < a.children.length; ++j) {
 -                         var b = a.children[j];
 -                         b.name = AppUtilsBusiness.tr(b.name);
 -                         if (b.pages != null) {
 -                             for (var k = 0; k < b.pages.length; ++k) {
 -                                 var c = b.pages[k];
 -                                 c.name = AppUtilsBusiness.tr(c.name);
 -                             }
 -                         }
 -                     }
 -                 }
 -             }
 -         }, function (error) {
 -             console.error(error);
 -         });
 - 
 -         $transitions.onEnter({}, function($transitions)
 -         {
 -             var toState = $transitions.$to();
 -             var title = toState.title != null ? toState.title : toState.toolbarTitle != null ? toState.toolbarTitle : null;
 -             var toolbarTitle = toState.toolbarTitle != null ? toState.toolbarTitle : toState.title != null ? toState.title : null;
 -             $translate('common.appName').then(function() {
 -                 if (title != null) {
 -                     AppUtilsBusiness.setTitle(AppUtilsBusiness.tr(title));
 -                 }
 -                 if (toolbarTitle != null) {
 -                     AppUtilsBusiness.setToolbarTitle(AppUtilsBusiness.tr(toolbarTitle));
 -                 }
 -             }, function (error) {
 -                 console.error(error);
 -             });
 -         });
 -     }]);
 
 
  |