"use strict"; angular.module('app', [ 'app.cfg', 'chieffancypants.loadingBar', 'query', 'ngCookies', 'ui.router', 'tool', 'translate', 'app.service', 'app.filter', 'app.controller', 'app.directive', 'debounce', 'xeditable', 'pasvaz.bindonce' ]); angular.module('app.service', [ 'tool', 'app.cfg', 'query', 'translate.data', 'translate', 'debounce', 'take' ]); angular.module('app.filter', [ 'app.cfg', 'tool' ]); angular.module('app.directive', [ 'app.cfg', 'query', 'tool', 'translate', 'ui.keypress', 'app.service', 'app.filter', 'debounce', 'fix.name', 'fix.stopPropagation', 'xeditable', 'ui.bootstrap.datepicker', 'ui.bootstrap.typeahead', 'ui.bootstrap.dropdown', 'pasvaz.bindonce', 'angularFileUpload', 'ui.sortable', 'yaMap' ]); angular.module('app.controller', [ 'app.cfg', 'query', 'tool', 'translate', 'app.service', 'fix.stopPropagation', 'ui.bootstrap.datepicker' ]); angular.module('app') .config(['$httpProvider', '$locationProvider', '$provide', '$stateProvider', '$urlRouterProvider', 'cfg', 'navigationMenu', function ($httpProvider, $location, $provide, $stateProvider, $urlRouterProvider, cfg, navigationMenu) { $httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest'; $httpProvider.defaults.xsrfCookieName = cfg.xsrfCookieName; $httpProvider.defaults.xsrfHeaderName = cfg.xsrfHeaderName; $provide.value('apiUrl', cfg.apiUrl); $location.hashPrefix('!'); $urlRouterProvider .otherwise('/'); var addMenuList = function (menu) { angular.forEach(menu, function (state, key) { if ('_state' === key) { $stateProvider.state(state); } else { addMenuList(state); } }); }; angular.forEach(['global', 'user', 'manager', 'admin'], function (roleId) { addMenuList(navigationMenu[roleId]); }); }]) .run(['$rootScope', '$state', '$stateParams', '$locale', 'translate', 'user', 'datepickerConfig', 'datepickerPopupConfig', 'editableOptions', 'yaMapSettings', 'cfg', function ($rootScope, $state, $stateParams, $locale, translate, user, datepickerConfig, datepickerPopupConfig, editableOptions, yaMapSettings, cfg) { $rootScope.cfg = cfg; $rootScope.$state = $state; $rootScope.$stateParams = $stateParams; editableOptions.theme = 'bs3'; datepickerConfig.showWeeks = false; datepickerConfig.startingDay = 1; datepickerPopupConfig.datepickerPopup = $locale.DATETIME_FORMATS.shortDate; datepickerPopupConfig.currentText = translate('Today'); datepickerPopupConfig.clearText = translate('Clear'); datepickerPopupConfig.closeText = translate('Done'); datepickerPopupConfig.showButtonBar = false; yaMapSettings.lang = $locale.id; user.authenticate(); }]) ;