//
// app module for online DPMS
//
var app = angular.module('adminApp', ['ui.tree', 'ui.bootstrap', 'ui.bootstrap.tpls', 'ui.event', 'pascalprecht.translate', 'ngMessages', 'ui.utils',
        'ngRoute', 'ngCookies', 'ngSanitize', 'ct.ui.router.extras', 'chieffancypants.loadingBar', 'ngDraggable', 'ngFileUpload', 'LocalStorageModule', 'exceptionless',
        'app.config', 'app.common', 'app.webservices', 'app.framework', 'app.infrastructure', 'app.basicData', 'app.adminHomePage', 'app.noPermissionPage', 'pasvaz.bindonce', 'vs-repeat', 'ivh.treeview', 'angular-cache',
        'app.systemConfiguration', 'app.cache', 'angularBootstrapNavTree', 'ngAnimate', 'cgNotify', 'angularInlineEdit'
])
    //run blocks are executed after the injector is created and are the first
    //methods that are executed in any Angular app.
    .run(['$log', '$http', 'CacheFactory', '$rootScope', 'userService', 'loginContext', '$q', function ($log, $http, CacheFactory, $rootScope, userService, loginContext, $q) {
        $log.debug('adminApp.run()...');

        $rootScope.adminPermission = constant.adminPermission;

        // 控制用户admin操作权限
        $rootScope.checkUserPermission = function (permissionCode) {
            var deferred = $q.defer();
            var promise = deferred.promise;
            var ret = false;
            userService.getUserPermissionNew(loginContext.userName, function (data) {
                var ret = window.PWC.isHavePermission(permissionCode, data);
                deferred.resolve(ret);
            });

            var successFunction = function (fn) {
                promise.then(function (ret) {
                    fn(ret);
                });
                return this;
            }

            return {
                success: successFunction,
            };
        };

        // 控制用户admin操作权限
        $rootScope.checkUserPermissionList = function (permissionCodeList) {
            var deferred = $q.defer();
            var promise = deferred.promise;
            var model = {};
            userService.getUserPermissionNew(loginContext.userName, function (data) {


                permissionCodeList.forEach(function (permissionCode) {
                    var ret = window.PWC.isHavePermission(permissionCode, data);
                    model[permissionCode] = ret;
                });

                deferred.resolve(model);
            });

            var successFunction = function (fn) {
                promise.then(function (model) {
                    fn(model);
                });
                return this;
            }

            return {
                success: successFunction,
            };
        };

        $http.defaults.headers.common['X-XSRF-Token'] =
            angular.element('input[name="__RequestVerificationToken"]').attr('value');
    }])
    // We always place constant at the beginning of all configuration blocks.
    .constant('application', {
        // the current logged on user
        currentUser: {},
        // convert date to display time based on current user
        toDisplayTimeString: function (dateTime) {
            if (!_.isDate(dateTime)) {
                throw new TypeError('"dateTime" should be "Date" type!');
            }
            return dateTime.toString('h:mmtt').toLowerCase();
        },
        // define angular events for $broadcast/$emit and $on
        events: {
            beforeUnload: 'event:beforeUnload',
            navigateToTab: 'event:navigateToTab',
            showNotificationBar: 'event:showNotificationBar'
        }
    })
    .config(['$urlRouterProvider', function ($urlRouterProvider) {
        //$urlRouterProvider.otherwise('/basicDataInfrastructure/regionManage'); 
    }])
    // only providers and constants should be injected in config block
    .config(['$logProvider', '$translateProvider', '$translatePartialLoaderProvider', 'region', '$compileProvider',
        function ($logProvider, $translateProvider, $translatePartialLoaderProvider, region, $compileProvider) {
            'use strict';

            // to disable various debug runtime information in the compiler to DOM elements.
            $compileProvider.debugInfoEnabled(false);
            // enable output $log.debug by default
            $logProvider.debugEnabled(true);

            // angular-translate configuration
            var configurateTranslation = function () {

                $translateProvider.useLoader('$translatePartialLoader', {
                    // the translation table are organized by language and module under folder 'app/i18n/'
                    urlTemplate: '/app-resources/i18n/{lang}/{part}.json'
                });

                $translateProvider
                    .preferredLanguage(region)
                    .fallbackLanguage(region);

                //https://github.com/Contactis/translations-manager/issues/7
                //https://angular-translate.github.io/docs/#/guide/19_security
                $translateProvider.useSanitizeValueStrategy('escape');
            };

            configurateTranslation();
        }
    ])
    // IE10 fires input event when a placeholder is defined so that form element is in dirty instead of pristine state 
    // refer to: https://github.com/angular/angular.js/issues/2614
    .config(['$provide', function ($provide) {
        $provide.decorator('$sniffer', ['$delegate', function ($sniffer) {
            var msieVersion = parseInt((/msie (\d+)/.exec(angular.lowercase(navigator.userAgent)) || [])[1], 10);
            var hasEvent = $sniffer.hasEvent;
            $sniffer.hasEvent = function (event) {
                if (event === 'input' && msieVersion === 10) {
                    return false;
                }
                hasEvent.call(this, event);
            };
            return $sniffer;
        }]);
    }])
    .config(['$ExceptionlessClient', 'exceptionlessServerURL', function ($ExceptionlessClient, exceptionlessServerURL) {
        if (!PWC.isNullOrEmpty(exceptionlessServerURL)) {
            $ExceptionlessClient.config.apiKey = 'HK0XK49LbufV6E4q8HLW7CGncwSBJvdBrJQwUnzw';
            $ExceptionlessClient.config.serverUrl = exceptionlessServerURL;
            $ExceptionlessClient.config.setUserIdentity('0', 'Anonymous');
            $ExceptionlessClient.config.useSessions();
            $ExceptionlessClient.config.defaultTags.push('JavaScript', 'Angular');
        }
    }])
    .config(['CacheFactoryProvider', function (CacheFactoryProvider) {
        var options = {
            storageMode: 'localStorage', // This cache will use `localStorage`.
            storagePrefix: 'atms.'
        };
        if (!window.localStorage) {
            options.storageImpl = localStoragePolyfill;
        }
        angular.extend(CacheFactoryProvider.defaults, options);
    }])
    .config(['ivhTreeviewOptionsProvider', function (ivhTreeviewOptionsProvider) {
        ivhTreeviewOptionsProvider.set({
            defaultSelectedState: false,
            validate: true,
            // Twisties can be images, custom html, or plain text
            twistieCollapsedTpl: '<i class="fa fa-plus" aria-hidden="true"></i>',
            twistieExpandedTpl: '<i class="fa fa-minus" aria-hidden="true"></i>',
            twistieLeafTpl: '<span style="color:white">&#9679;</span>'
        });
    }])
    // refer to: https://github.com/oitozero/ngSweetAlert
    .factory('SweetAlert', ['$rootScope', '$log', '$translate', function ($rootScope, $log, $translate) {
        $log.debug('SweetAlert.run()...');
        var swal = window.swal;
        //public methods
        var self = {

            swal: function (arg1, arg2, arg3) {
                $rootScope.$evalAsync(function () {
                    if (typeof (arg2) === 'function') {
                        swal(arg1, function (isConfirm) {
                            $rootScope.$evalAsync(function () {
                                arg2(isConfirm);
                            });
                        }, arg3);
                    } else {
                        swal(arg1, arg2, arg3);
                    }
                });
            },
            success: function (title, message) {
                $rootScope.$evalAsync(function () {
                    //swal(title, message, 'success');

                    swal({
                        title: title,
                        text: message,
                        type: "success",
                        confirmButtonText: $translate.instant('Confirm'),
                    });
                });
            },
            error: function (title, message) {
                $rootScope.$evalAsync(function () {
                    //swal(title, message, 'error');
                    swal({
                        title: title,
                        text: message,
                        type: "error",
                        confirmButtonText: $translate.instant('Confirm'),
                    });

                });
            },
            warning: function (title, message) {
                $rootScope.$evalAsync(function () {
                    //swal(title, message, 'warning');
                    swal({
                        title: title,
                        text: message,
                        type: "warning",
                        confirmButtonText: $translate.instant('Confirm'),
                    });
                });
            },
            info: function (title, message) {
                $rootScope.$evalAsync(function () {
                    //swal(title, message, 'info');
                    swal({
                        title: title,
                        text: message,
                        type: "info",
                        confirmButtonText: $translate.instant('Confirm'),
                    });
                });
            }
        };

        return self;
    }])
    //turn off angular-loading-bar spinner
    //refer to https://github.com/chieffancypants/angular-loading-bar
    .config(['cfpLoadingBarProvider', function (cfpLoadingBarProvider) {
        cfpLoadingBarProvider.includeSpinner = false;
    }])
    //initialize localStorage
    //refer to https://github.com/grevory/angular-local-storage#get-started
    .config(['localStorageServiceProvider', function (localStorageServiceProvider) {
        localStorageServiceProvider.setPrefix('pwcdashboard').setStorageType('sessionStorage');
    }])
    // Provide the localization function for application and support async load translation table by parts on demand.
    // Note: When trying to adding new translation resource into .json file, please check if the same KEY is existing 
    // in .json files under i18n folder. Because if two parts have the same property, the property value will be overwrited 
    // by the loaded last part.
    // for example,
    // We load app.json first and then load patient.json. "app.json" file contains a property {"Text" : "Test"} 
    // and "patient.json" file contains property {"Text" : "Overwrite Test"} the "Text" on view will be translated to 
    // be "Overwrite Test".
    .factory('appTranslation', ['$log', '$translatePartialLoader', '$translate',
        function ($log, $translatePartialLoader, $translate) {
            'use strict';
            $log.debug('appTranslation.ctor()...');

            var translation = {
                // part names for modules
                // AppPart is for the translation of application level, not for a module for a business logic.
                appPart: 'app',
                // other parts for business logic
                //worklist: 'worklist',
                //registration: 'registration',
                //report: 'report',
                //clientSetting: 'clientSetting',
                //selfServiceSetting: 'selfServiceSetting',
                cit: 'cit',
                //menu: 'menu',
                role: 'role',
                infrastructure: 'infrastructure',
                //materiallist: 'materiallist',
                basicData: 'basicData',
                systemConfiguration: 'systemConfiguration',
                adminHomePage: 'adminHomePage',
                noPermissionPage: 'noPermissionPage',
                //declarationFormConfiguration: 'declarationFormConfiguration',

                /// <summary>
                /// async load translation tables into application for specified part names that required for the view.
                /// </summary>
                /// <param name="partNames">part names of array type</param>
                load: function (partNames) {
                    if (!angular.isArray(partNames)) {
                        throw new TypeError('"partNames" should be an array!');
                    }

                    partNames.forEach(function (name) {
                        $translatePartialLoader.addPart(name);
                    });

                    $translate.refresh();
                },
                loadAll: function () {
                    _.map(_.values(translation), function (part) {
                        if (_.isString(part)) {
                            $translatePartialLoader.addPart(part);
                        }
                    });
                    $translate.refresh();
                }
            };
            return translation;
        }
    ])
    .controller('AdminAppController', ['$rootScope', '$scope', '$log', '$location', '$translate', '$translatePartialLoader',
        '$window', 'appRoute', 'application', 'appTranslation', '$timeout', '$uibModal', 'loginContext', '$ExceptionlessClient', 'signalRSvc', 'userService', '$state', '$q',
       'exceptionlessServerURL', function ($rootScope, $scope, $log, $location, $translate, $translatePartialLoader, $window, appRoute,
            application, appTranslation, $timeout, $uibModal, loginContext, $ExceptionlessClient, signalRSvc, userService, $state, $q, exceptionlessServerURL) {
           'use strict';
           $log.debug('AdminAppController.ctor()...');

           $scope.localName = loginContext.localName;

           if (!PWC.isNullOrEmpty(exceptionlessServerURL)) {
               $ExceptionlessClient.config.setUserIdentity(loginContext.userId, loginContext.localName);
               $ExceptionlessClient.config.useSessions();
           }

           $scope.$on('$locationChangeSuccess', function () {
               $scope.actualLocation = $location.path();
           });

           $scope.$watch(function () {
               return $location.path()
           }, function (newLocation) {
               if ($scope.actualLocation === newLocation) {
                   // back or forward
                   $log.debug('Go back or go forward to view browser history. Url: ' + newLocation);
               }
           });

           $scope.$on('$stateChangeSuccess',
               function () {
                   $log.debug('$stateChangeSuccess: ');
               });

           $scope.$on("$locationChangeStart", function (e, currentLocation, previousLocation) {
               // Do whatever you need to do.
               $rootScope.previousLocation = previousLocation;

           });

           $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {

               // permission control
               var url = toState.url;
               // url: /organizationBusinessUnitView

               if (toState.name) {

                   // 特殊处理有name中有.,也就是那种tab的情况
                   if (toState.name.indexOf('organizationView') > -1) {
                       url = '#/organizationViewInfrastructure' + url;
                   } else if (toState.name.indexOf('masterData.') > -1) {
                       url = '#/masterData' + url;
                   } else if (toState.name.indexOf('financialData.') > -1) {
                       url = '#/financialData' + url;
                   }

                   else {
                       url = '#' + url;
                   }

               } else {
                   url = '#' + url;
               }

               $log.debug('url:' + url + 'toState:' + JSON.stringify(toState));
               if (url.indexOf('noPermissionPage') > -1) {
                   return;
               }

               userService.getUserPermission(loginContext.userName).success(function (data) {
                   var find = null;
                   if (data.navigationUrlList) {
                       find = _.find(data.navigationUrlList, function (num) {

                           // 完全匹配
                           if (url === num) {
                               return true;
                           }

                           // 匹配查询单个机构这种
                           if (url.indexOf(num) > -1) {
                               return true;
                           }

                           return false;
                       });
                   }
                   if (data && (data.isAdmin || find)) {
                       return;
                   } else {
                       $log.debug(url + ':noPermissionPage');
                       event.preventDefault();
                       $state.go('noPermissionPage');
                   }
               });

           });


           // publish unbeforeunload event to child scopes
           $scope.onbeforeunload = function () {
               $scope.$broadcast(application.events.beforeUnload);
           };

           $scope.main = function () {
               $location.path('/main');
               $location.url('main');
           };

           $scope.createDemo = function () {
               $location.path('/accountDemo');
               $location.url($location.path());
           };

           appTranslation.loadAll();

           signalRSvc.initialize();
       }
    ]);

(function () {
    'use strict';

    angular.module('app.config', [])
        // region of current application
        .constant('region', 'zh-CN')
        //.constant('region', 'en-US')
        // version of current application
        .constant('version', '1.0.0.0')
        // Exceptionless Server URL
        .constant('exceptionlessServerURL', '')
        .run([
            'region', function (region) {
                $.when(
                    $.getJSON("/Scripts/cldr/main/zh/numbers.json"),
                    $.getJSON("/Scripts/cldr/main/zh/ca-gregorian.json"),
                    $.getJSON("/Scripts/cldr/supplemental/likelySubtags.json")
                ).then(function () {
                    return [].slice.apply(arguments, [0]).map(function (result) {
                        return result[0];
                    });
                }).then(Globalize.load).then(function () {
                     Globalize.locale("zh-CN");
                   // Globalize.locale("en-US");
                    DevExpress.localization.locale(region);
                    //DevExpress.localization.locale(navigator.language || navigator.browserLanguage);
                });
            }
        ]);
}());
// register common module for shared functionalities for all other feature modules
var commonModule = angular.module('app.common', ['pascalprecht.translate', 'ngAnimate', 'ui.grid', 'ui.grid.selection',
    'ui.grid.treeView', 'ui.grid.resizeColumns', 'mentio', 'app.config'])
    .run(['$log', function ($log) {
        $log.debug('app.common.run()...');
    }])
    // define the script files for lazy loading and method to create depencency map for resovle config in route
    .provider('scriptDependency', ['version', function (version) {
        'use strict';
        // Here must add version parameter ?v=***, 
        // to solve the problem that the bundle is not refreshed when its content changed.

        this.materiallist = [{
            url: '/bundles/materiallist.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/materiallist.css?v=' + version,
            type: 'text/css'
        }];

        this.menu = [{
            url: '/bundles/menu.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/menu.css?v=' + version,
            type: 'text/css'
        }];

        this.commdataimport = [{
            url: '/bundles/commdataimport.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/commdataimport.css?v=' + version,
            type: 'text/css'
        }];

        this.subjectRecategory = [{
            url: '/bundles/subject-recategory.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/subject-recategory.css?v=' + version,
            type: 'text/css'
        }];

        this.role = [{
            url: '/bundles/role.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/role.css?v=' + version,
            type: 'text/css'
        }];

        this.infrastructure = [{
            url: '/bundles/infrastructure.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/infrastructure.less?v=' + version,
            type: 'text/css'
        }];

        this.organization = [{
            url: '/bundles/organization.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/organization.css?v=' + version,
            type: 'text/css'
        }];

        this.project = [{
            url: '/bundles/project.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/project.css?v=' + version,
            type: 'text/css'
        }];

        this.basicDataInfrastructure = [{
            url: '/bundles/basicData.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/basicData.css?v=' + version,
            type: 'text/css'
        }, {
            url: '/bundles/basicData.less?v=' + version,
            type: 'text/css'
        }];

        this.regionManage = [{
            url: '/bundles/regionManage.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/regionManage.css?v=' + version,
            type: 'text/css'
        }, {
            url: '/bundles/regionManage.less?v=' + version,
            type: 'text/css'
        }];

        this.keyvalueManage = [{
            url: '/bundles/keyvalueManage.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/keyvalueManage.css?v=' + version,
            type: 'text/css'
        }, {
            url: '/bundles/keyvalueManage.less?v=' + version,
            type: 'text/css'
        }];

        this.customerListManage = [{
            url: '/bundles/customerListManage.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/customerListManage.css?v=' + version,
            type: 'text/css'
        }, {
            url: '/bundles/customerListManage.less?v=' + version,
            type: 'text/css'
        }];


        this.wordLibraryManage = [{
            url: '/bundles/wordLibraryManage.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/wordLibraryManage.css?v=' + version,
            type: 'text/css'
        }, {
            url: '/bundles/wordLibraryManage.less?v=' + version,
            type: 'text/css'
        }];

        this.standardAccountManage = [{
            url: '/bundles/standardAccountManage.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/standardAccountManage.css?v=' + version,
            type: 'text/css'
        }, {
            url: '/bundles/standardAccountManage.less?v=' + version,
            type: 'text/css'
        }];

        this.enterpriseAccountManage = [{
            url: '/bundles/enterpriseAccountManage.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/enterpriseAccountManage.css?v=' + version,
            type: 'text/css'
        }, {
            url: '/bundles/enterpriseAccountManage.less?v=' + version,
            type: 'text/css'
        }];

        this.systemConfiguration = [{
            url: '/bundles/systemConfiguration.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/systemConfiguration.less?v=' + version,
            type: 'text/css'
        }];

        this.adminHomePage = [{
            url: '/bundles/adminHomePage.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/adminHomePage.less?v=' + version,
            type: 'text/css'
        }];


        this.noPermissionPage = [{
            url: '/bundles/noPermissionPage.js?v=' + version,
            type: 'text/javascript'
        }, {
            url: '/bundles/noPermissionPage.less?v=' + version,
            type: 'text/css'
        }];
        
        this.createDependenciesMap = function (dependencies) {
            if (!angular.isArray(dependencies)) {
                throw new TypeError('"scriptUrls" should be an array type!');
            }

            var dependenciesMap = {
                dependency: ['$q', '$rootScope',
                    function ($q, $rootScope) {
                        var deferred = $q.defer();
                        PWC.Loader.load(dependencies, function (hasNewJsLoaded) {
                            // If has new JavaScript resource loaded, should call $apply, otherwise, 
                            // should not call it.
                            if (hasNewJsLoaded) {
                                $rootScope.$apply(function () {
                                    deferred.resolve();
                                });
                            } else {
                                deferred.resolve();
                            }
                        });
                        return deferred.promise;
                    }
                ]
            };

            return dependenciesMap;
        };

        this.$get = function () {
            return {
                worklist: worklist,
                registration: registration,
                report: report,
                clientSetting: clientSetting,
                selfServiceSetting: selfServiceSetting,
                createDependenciesMap: createDependenciesMap,
                menu: menu,
                infrastructure: infrastructure,
                organization: organization,
                project: project,
                basicDataInfrastructure: basicDataInfrastructure,
                regionManage: regionManage,
                keyvalueManage: keyvalueManage,
                wordLibraryManage: wordLibraryManage,
                standardAccountManage: standardAccountManage,
                enterpriceAccountManage: enterpriceAccountManage,
                systemConfiguration: systemConfiguration,
                customerListManage: customerListManage,
                adminHomePage: adminHomePage,
                noPermissionPage: noPermissionPage
            };
        };
    }]);

// register services module
var webservices = angular.module('app.webservices', ['app.common'])
    .run(['$log', function ($log) {
        $log.debug('app.webservices.run()...');
    }]);

// register framework module for application framework
var frameworkModule = angular.module('app.framework', ['app.webservices', 'app.common'])
    .run(['$log', function ($log) {
        $log.debug('app.framework.run()...');
    }]);

// register cache module for application framework
var cacheModule = angular.module('app.cache', ['app.common'])
    .run(['$log', 'cacheService', function ($log, cacheService) {
        $log.debug('app.cache.run()...');

    }]);

//Common Bind Module Method
var bindModule = function (thisModule, controllerProvider, compileProvider, filterProvider, provide) {

    thisModule.controller = controllerProvider.register;
    thisModule.directive = compileProvider.directive;
    thisModule.filter = filterProvider.register;
    thisModule.factory = provide.factory;
    thisModule.service = provide.service;

    return thisModule;
};

//infrastructure module create
var infrastructureModule = angular.module('app.infrastructure', ["isteven-multi-select", 'ui.grid', 'ui.grid.selection', 'ui.grid.selection', 'ui.grid.treeView', 'dx', 'perfect_scrollbar', 'ngMaterial'])
    .run(['$log', function ($log) {
        $log.debug('app.infrastructure.run()...');

    }])
    .config(['$controllerProvider', '$compileProvider', '$filterProvider', '$provide', 'scriptDependencyProvider', '$stateProvider', '$stickyStateProvider',
        function ($controllerProvider, $compileProvider, $filterProvider, $provide, scriptDependencyProvider, $stateProvider, $stickyStateProvider) {
            'use strict';
            // this is required to add controller/directive/filter/service after angular bootstrap
            bindModule(infrastructureModule, $controllerProvider, $compileProvider, $filterProvider, $provide);
            $stateProvider.state({
                name: 'organizationView',
                url: "/organizationViewInfrastructure",
                views: {
                    '@': {
                        controller: ['$scope', '$state',
                            function ($scope, $state) {
                                $scope.state = $state;
                            }],
                        template: '<organization-view-infrastructure state="state"></organization-view-infrastructure>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure)
            });

            //机构管理 覆盖区域
            $stateProvider.state('organizationView.organizationAreaView', {
                url: "/organizationAreaView",
                sticky: true,
                dsr: true,
                params: { "dimensionID": null },
                views: {
                    'organization-area@organizationView': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                     function ($scope, $stateParams, appTranslation) {
                         appTranslation.load([appTranslation.infrastructure, appTranslation.role]);
                     }],
                        template: '<organization-area-view></organization-area-view>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure)
            });

            //机构管理 事业部
            $stateProvider.state('organizationView.organizationBusinessUnitView', {
                url: "/organizationBusinessUnitView",
                sticky: true,
                dsr: true,
                params: {
                    "dimensionID": null
                },
                views: {
                    'organization-businessUnit@organizationView': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                     function ($scope, $stateParams, appTranslation) {
                         appTranslation.load([appTranslation.infrastructure, appTranslation.role]);
                     }],
                        template: '<organization-business-unit-view></organization-business-unit-view>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure)
            });

            //机构管理 子分公司
            $stateProvider.state('organizationView.organizationSubsidiaryView', {
                url: "/organizationSubsidiaryView",
                sticky: true,
                dsr: true,
                params: { "dimensionID": null },
                views: {
                    'organization-subsidiary@organizationView': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                     function ($scope, $stateParams, appTranslation) {
                         appTranslation.load([appTranslation.infrastructure, appTranslation.role]);
                     }],
                        template: '<organization-subsidiary-view></organization-subsidiary-view>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure)
            });

            //股权架构图
            $stateProvider.state('organizationView.storeArchitectureView', {
                url: "/storeArchitectureView",
                sticky: true,
                dsr: true,
                params: { "dimensionID": null },
                views: {
                    'store-architecture@organizationView': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                     function ($scope, $stateParams, appTranslation) {
                         appTranslation.load([appTranslation.infrastructure, appTranslation.role]);
                     }],
                        template: '<store-architecture-view></store-architecture-view>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure)
            });

            //机构管理详细列表
            $stateProvider.state({
                name: 'orgListView',
                url: '/orgListView',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                       }],
                        template: '<organization-list-view></organization-list-view>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });



            //用户明细
            $stateProvider.state({
                name: 'userDetail',
                url: '/userDetail/:id',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                       }],
                        template: '<user-detail-view></user-detail-view>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'usermanage',
                url: '/usermanage',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                                   function ($scope, $stateParams, appTranslation) {
                                       appTranslation.load([appTranslation.infrastructure]);
                                   }],
                        template: '<user-manage></user-manage>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'user',
                url: '/user',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                       }],
                        template: '<user-manage-list></user-manage-list>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });


            $stateProvider.state({
                name: 'userlist',
                url: '/userlist',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                       }],
                        template: '<user-list></user-list>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'role',
                url: '/role',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure, appTranslation.role]);
                       }],
                        template: '<role-manage></role-manage>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'organization',
                url: '/organization',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                       }],
                        template: '<organization-manage></organization-manage>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'organizationSingle',
                url: '/organization/{organizationId}',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                           $scope.organizationId = $stateParams.organizationId;
                       }],
                        template: '<organization-manage organization-id="{{organizationId}}"></organization-manage>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'project',
                url: '/project',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                       }],
                        template: '<project-manage></project-manage>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'projectSingle',
                url: '/project/{projectId}/{serviceType}',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                           $scope.projectId = $stateParams.projectId;
                           $scope.serviceType = $stateParams.serviceType;
                       }],
                        template: '<project-manage project-id="{{projectId}}" service-type="{{serviceType}}"></project-manage>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: "menu",
                url: '/menu',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                       }],
                        template: '<menu-manage></menu-manage>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });
            $stateProvider.state({
                name: "landManage",
                url: '/landManage',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.infrastructure]);
                       }],
                        template: '<land-manage></land-manage>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.infrastructure),
                deepStateRedirect: true,
                sticky: true
            });

            $stickyStateProvider.enableDebug(true);


        }]);

//basicDataModule module create
var basicDataModule = angular.module('app.basicData', ["isteven-multi-select", 'ui.grid', 'ui.grid.selection', 'ui.grid.selection', 'ui.grid.treeView', 'ui.grid.resizeColumns', 'mc.resizer', 'ngFileSaver'])
    .run(['$log', function ($log) {
        $log.debug('app.basicData.run()...');

    }])
    .config(['$controllerProvider', '$compileProvider', '$filterProvider', '$provide', 'scriptDependencyProvider', '$stateProvider',
        function ($controllerProvider, $compileProvider, $filterProvider, $provide, scriptDependencyProvider, $stateProvider) {
            'use strict';
            // this is required to add controller/directive/filter/service after angular bootstrap
            bindModule(basicDataModule, $controllerProvider, $compileProvider, $filterProvider, $provide);

        }]).config(['$stateProvider', '$urlRouterProvider', 'scriptDependencyProvider', '$stickyStateProvider',
            function ($stateProvider, $urlRouterProvider, scriptDependencyProvider, $stickyStateProvider) {
                'use strict';

                $urlRouterProvider.when('/masterData', '/masterData/orangizationStructureManage');
                $urlRouterProvider.when('/financialData', '/financialData/enterpriseAccountManage');
                //$urlRouterProvider.otherwise('/basicDataInfrastructure/regionManage');

                //主数据
                $stateProvider.state({
                    name: 'masterData',
                    url: "/masterData",
                    views: {
                        '@': {
                            controller: ['$scope', '$state',
                            function ($scope, $state) {
                                $scope.state = $state;
                            }],
                            template: '<basic-data-master-infrastructure state="state"></basic-data-master-infrastructure>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //财务数据
                $stateProvider.state({
                    name: 'financialData',
                    url: "/financialData",
                    views: {
                        '@': {
                            controller: ['$scope', '$state',
                            function ($scope, $state) {
                                $scope.state = $state;
                            }],
                            template: '<basic-data-financial-infrastructure state="state"></basic-data-financial-infrastructure>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //事业部
                $stateProvider.state('masterData.businessUnit', {
                    url: "/businessUnit",
                    sticky: true,
                    dsr: true,
                    views: {
                        'business-unit@masterData': {
                            template: '<business-unit bind="list" attr="{{updateflag}}" add-bs-fn="addbs(newrow)" edit-bs-fn="editbs(newcontent)" remove-bs-fn="removebs(id)" stop-bs-fn="stopbs(newcontent)"></business-unit>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //区域
                $stateProvider.state('masterData.regionManage', {
                    url: "/regionManage",
                    sticky: true,
                    dsr: true,
                    views: {
                        'region@masterData': {
                            template: '<region-manage></region-manage>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //关键数据配置
                $stateProvider.state('masterData.keyvalueManage', {
                    url: "/keyvalueManage",
                    sticky: true,
                    dsr: true,
                    views: {
                        'key-value@masterData': {
                            template: '<keyvalue-manage></keyvalue-manage>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //字库
                $stateProvider.state('masterData.wordLibraryManage', {
                    url: "/wordLibraryManage",
                    sticky: true,
                    dsr: true,
                    views: {
                        'word-library@masterData': {
                            template: '<word-library-manage></word-library-manage>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //机构层级
                $stateProvider.state('masterData.orangizationStructureManage', {
                    url: "/orangizationStructureManage",
                    sticky: true,
                    dsr: true,
                    views: {
                        'orangization-structure@masterData': {
                            template: '<orangization-structure-manage bind="list" attr="{{updateflag}}" add-fn="add(newrow)" edit-fn="edit(newcontent)" remove-fn="remove(id)" stop-fn="stop(newcontent)"></orangization-structure-manage>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //客户列表
                $stateProvider.state('financialData.customerListManage', {
                    url: "/customerListManage",
                    sticky: true,
                    dsr: true,
                    views: {
                        'customer-list@financialData': {
                            template: '<customer-list-manage ></customer-list-manage>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //标准科目
                $stateProvider.state('financialData.standardAccountManage', {
                    url: "/standardAccountManage",
                    sticky: true,
                    dsr: true,
                    views: {
                        'standardAccountManage@financialData': {
                            template: '<standard-account-manage></standard-account-manage>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //企业账套
                $stateProvider.state('financialData.enterpriseAccountManage', {
                    url: "/enterpriseAccountManage",
                    sticky: true,
                    dsr: true,
                    views: {
                        'enterprise-account@financialData': {
                            template: '<enterprise-account-manage></enterprise-account-manage>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                //产品清单
                $stateProvider.state('financialData.productManage', {
                    url: "/productManage",
                    sticky: true,
                    dsr: true,
                    views: {
                        'product-manage@financialData': {
                            template: '<product-manage></product-manage>'
                        }
                    },
                    resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.basicDataInfrastructure)
                });

                $stickyStateProvider.enableDebug(true);
            }]);


var systemConfigurationModule = angular.module('app.systemConfiguration', ['ngMessages', 'ngAnimate', 'ui.bootstrap', "isteven-multi-select", 'ui.grid', 'ui.grid.treeView', 'ui.grid.selection', 'dx', 'remoteValidation', 'ui.select', 'ngSanitize'])
    .run(['$log', function ($log) {
        $log.debug('app.systemConfiguration.run()...');
    }])
    .config(['$controllerProvider', '$compileProvider', '$filterProvider', '$provide', 'scriptDependencyProvider', '$stateProvider', '$urlRouterProvider',
        function ($controllerProvider, $compileProvider, $filterProvider, $provide, scriptDependencyProvider, $stateProvider, $urlRouterProvider) {
            'use strict';

            $urlRouterProvider.when('/subjectCorrespondingInfrastructure', '/subjectCorrespondingInfrastructure/enterpriseSubjectCorresponding');
            $urlRouterProvider.when('/ruleEngineConfiguration', '/ruleEngineConfiguration/vatRuleEnginee');
            // this is required to add controller/directive/filter/service after angular bootstrap
            bindModule(systemConfigurationModule, $controllerProvider, $compileProvider, $filterProvider, $provide);

            $stateProvider.state({
                name: 'declarationFormConfiguration',
                url: '/declarationFormConfiguration',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.systemConfiguration]);
                       }],
                        template: '<declaration-form-configuration></declaration-form-configuration>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'declarationTemplateConfiguration',
                url: '/declarationTemplateConfiguration',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.systemConfiguration]);
                       }],
                        template: '<declaration-template-configuration></declaration-template-configuration>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'declarationFormConfigurationLocation',
                url: '/declarationFormConfiguration/{templateGroupId}/{templateId}/{cellTemplateId}',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.systemConfiguration]);
                           $scope.templateGroupId = $stateParams.templateGroupId;
                           $scope.templateId = $stateParams.templateId;
                           $scope.cellTemplateId = $stateParams.cellTemplateId;
                       }],
                        template: '<declaration-form-configuration template-group-id="{{templateGroupId}}" template-id="{{templateId}}" cell-template-id="{{cellTemplateId}}"></declaration-form-configuration>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'subjectCorresponding',
                url: '/subjectCorresponding',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.systemConfiguration]);
                       }],
                        template: '<subject-corresponding></subject-corresponding>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
                deepStateRedirect: true,
                sticky: true
            });


            $stateProvider.state({
                name: 'modelConfiguration',
                url: '/modelconfiguration',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.systemConfiguration]);
                       }],
                        template: '<model-configuration></model-configuration>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'modelConfigurationLocation',
                url: '/modelconfiguration/{organizationId}/{selectedModelCode}',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.systemConfiguration]);
                           $scope.organizationId = $stateParams.organizationId;
                           $scope.selectedModelCode = $stateParams.selectedModelCode;
                       }],
                        template: '<model-configuration organization-id="{{organizationId}}" selected-model-code="{{selectedModelCode}}"></model-configuration>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'keyCodeConfiguration',
                url: '/keyCodeConfiguration',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.systemConfiguration]);
                       }],
                        template: '<key-value-config></key-value-config>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state({
                name: 'ruleEngineConfiguration',
                url: '/ruleEngineConfiguration',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation','$state',
                       function ($scope, $stateParams, appTranslation, $state) {
                           appTranslation.load([appTranslation.systemConfiguration]);
                           $scope.state = $state;
                       }],
                        template: '<rule-engine-infrastructure state="state"></rule-engine-infrastructure>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
                deepStateRedirect: true,
                sticky: true
            });

            $stateProvider.state('ruleEngineConfiguration.vatRuleEnginee', {
                url: "/vatRuleEnginee",
                sticky: true,
                dsr: true,
                views: {
                    'vat-rule@ruleEngineConfiguration': {
                        //template: '<rule-enginee-config></rule-enginee-config>'
                        template: '<rule-engine-config></rule-engine-config>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration)
            });

            $stateProvider.state('ruleEngineConfiguration.fixedAssets', {
                url: "/fixedAssets",
                sticky: true,
                dsr: true,
                views: {
                    'fixed-assets@ruleEngineConfiguration': {
                        //template: '<rule-enginee-config></rule-enginee-config>'
                        template: '<fixed-assets-rule-enginee></fixed-assets-rule-enginee>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration)
            });
        }]);

var adminHomePageModule = angular.module('app.adminHomePage', ["isteven-multi-select", 'ui.grid', 'ui.grid.treeView', 'ui.grid.selection', 'dx', 'remoteValidation', 'ui.select', 'ngSanitize'])
    .run(['$log', function ($log) {
        $log.debug('app.systemConfiguration.run()...');
    }])
    .config(['$controllerProvider', '$compileProvider', '$filterProvider', '$provide', 'scriptDependencyProvider', '$stateProvider', '$urlRouterProvider',
        function ($controllerProvider, $compileProvider, $filterProvider, $provide, scriptDependencyProvider, $stateProvider, $urlRouterProvider) {
            'use strict';

            bindModule(adminHomePageModule, $controllerProvider, $compileProvider, $filterProvider, $provide);

            $stateProvider.state({
                name: 'adminHomePage',
                url: '/adminHomePage',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.adminHomePage]);
                       }],
                        template: '<admin-home-page></admin-home-page>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.adminHomePage),
                deepStateRedirect: true,
                sticky: true
            });

        }]);


var noPermissionPageModule = angular.module('app.noPermissionPage', ["isteven-multi-select", 'ui.grid', 'ui.grid.treeView', 'ui.grid.selection', 'dx', 'remoteValidation', 'ui.select', 'ngSanitize'])
    .run(['$log', function ($log) {
        $log.debug('app.noPermissionPage.run()...');
    }])
    .config(['$controllerProvider', '$compileProvider', '$filterProvider', '$provide', 'scriptDependencyProvider', '$stateProvider', '$urlRouterProvider',
        function ($controllerProvider, $compileProvider, $filterProvider, $provide, scriptDependencyProvider, $stateProvider, $urlRouterProvider) {
            'use strict';


            // this is required to add controller/directive/filter/service after angular bootstrap
            bindModule(noPermissionPageModule, $controllerProvider, $compileProvider, $filterProvider, $provide);


            $stateProvider.state({
                name: 'noPermissionPage',
                url: '/noPermissionPage',
                views: {
                    '@': {
                        controller: ['$scope', '$stateParams', 'appTranslation',
                       function ($scope, $stateParams, appTranslation) {
                           appTranslation.load([appTranslation.adminHomePage]);
                       }],
                        template: '<no-permission-page></no-permission-page>'
                    }
                },
                resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.noPermissionPage),
                deepStateRedirect: true,
                sticky: true
            });
        }]);