'use strict'; /* App Module */ angular.module('app', [ 'ui.bootstrap', 'ui.router', 'LocalStorageModule', 'ngMaterial', 'md.data.table', 'sasrio.angular-material-sidenav', 'pascalprecht.translate', 'luticate2Utils', // 'luticateAuth', 'appSdk' ]) .config(['$stateProvider', '$urlRouterProvider', 'ssSideNavSectionsProvider', '$mdThemingProvider', '$mdIconProvider', '$translateProvider', function($stateProvider, $urlRouterProvider, ssSideNavSectionsProvider, $mdThemingProvider, $mdIconProvider, $translateProvider) { // $mdThemingProvider // .theme('default') // .primaryPalette('blue', { // 'default': '700' // }); // $mdThemingProvider.theme('default') // .primaryPalette('blue') // .accentPalette('pink'); $translateProvider.useSanitizeValueStrategy('escape'); $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.name', type: 'heading', children: [{ name: 'home.name', type: 'toggle', pages: [{ id: 'toogle_1_link_1', name: 'home.name', state: 'home' }, { id: 'toogle_1_link_2', name: 'Home 1 2', state: 'home.1.2', hidden: true }, { id: 'toogle_1_link_3', name: 'home.name', state: 'home.1.3' }] }] }, { id: 'link_1', name: 'home.name', state: 'home.2', type: 'link', icon: 'fa fa-check' }, { id: 'link_2', name: 'home.name', state: 'home.3', type: 'link' }, { id: 'link_3', name: 'home.name', state: 'common.link3', type: 'link', hidden: true }, { id: 'toogle_2', name: 'pkguid.name', type: 'heading', children: [{ name: 'pkguid.name', type: 'toggle', pages: [{ id: 'toogle_2_link_1', name: 'common.all', state: 'pkguid' },{ id: 'toogle_2_link_1', name: 'common.new', state: 'pkguid_add' }] }] }]); $stateProvider.state('root', { abstract: true, template: '
', // 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('pkguid', { url:'/pkguids', parent: 'root', title: "pkguid.name", reloadOnSearch: false, templateUrl:'views/pkguid.html', controller:'PkGuidController' }); $stateProvider.state('pkguid_add', { url:'/pkguids/add', parent: 'root', title: "pkguid.add.defaultTitle", toolbarTitle: "pkguid.add.defaultToolbarTitle", reloadOnSearch: false, templateUrl:'views/pkguidedit.html', controller:'PkGuidEditController' }); $stateProvider.state('pkguid_edit', { url:'/pkguids/edit/:id', parent: 'root', title: "pkguid.edit.defaultTitle", toolbarTitle: "pkguid.edit.defaultToolbarTitle", reloadOnSearch: false, templateUrl:'views/pkguidedit.html', controller:'PkGuidEditController', params: { pkguid: null } }); $urlRouterProvider.otherwise('/'); }]) .run(['$rootScope', '$transitions', 'AppUtilsBusiness', 'ssSideNav', '$translate', function ($rootScope, $transitions, AppUtilsBusiness, ssSideNav, $translate) { $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; if (title != null) { AppUtilsBusiness.setTitle(AppUtilsBusiness.tr(title)); } if (toolbarTitle != null) { AppUtilsBusiness.setToolbarTitle(AppUtilsBusiness.tr(toolbarTitle)); } }); }]);