| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- app.controller('menuCtrl',
-
- function ($scope,$http,$cookies, $location, $route, $timeout, $mdSidenav, $mdMedia, $window, $cookies, utilsSvc, userService, UserManager, menuService) {
- $scope.appVersion = '1.7.9.2';
- $scope.currentMenu = '';
-
- $scope.isUserLoggedIn = function(){
- return userService.getCurrentUser() != null;
- }
-
- $scope.isAmbienteTest = function(){
- return ($location.$$host.toLowerCase().indexOf('tamtest')>=0) || ($location.$$host.toLowerCase().indexOf('localhost')>=0)
- }
-
- $scope.forcedClose = false;
-
- $window.addEventListener('resize', onResize);
- function onResize() {
- $scope.$digest();
- }
- $scope.$on('$destroy', function() {
- $window.removeEventListener('resize', onResize);
- });
-
- $scope.shouldLockOpen = function() {
- if ($scope.forcedClose)
- return false;
- else
- return $mdMedia('gt-sm');
- }
-
- $scope.isCurrentMenu=function(url) {
- return $scope.currentMenu==url;//($location.path().indexOf(url)>=0);
- }
-
- $scope.toggleMenu = function() {
- $scope.forcedClose = !$scope.forcedClose;
- if ($scope.forcedClose)
- $mdSidenav('menuSidenav').close();
- else
- $mdSidenav('menuSidenav').open();
- }
- $scope.showMenu = function(){
- $mdSidenav('menuSidenav').open();
- }
- $scope.largeScreen =function(){
- return utilsSvc.largeScreen();
- }
-
- $scope.notSmallScreen =function(){
- console.log($mdMedia('gt-sm'));
- return $mdMedia('gt-sm');
- }
-
- $scope.closeSideNav = function(){
- if ($mdMedia('sm')||$mdMedia('xs')||$scope.forcedClose)
- $mdSidenav('menuSidenav').close();
- }
-
- $scope.forceSidenavOpen = function() {
- return $mdMedia('gt-sm') || ($scope.requestMenuOpen && $mdMedia('gt-sm'));
- }
-
- $scope.appVariables = {};
-
- $scope.checkUserPermission = function() {
- if ($scope.isUserLoggedIn()) {
- UserManager.AppVariables().$promise.then(function(data){
-
- $scope.appVariables = data;
-
-
- if ($scope.appVariables.profiloLocale=='UO' || $scope.appVariables.profiloLocale=='UR') {
- if (!$scope.appVariables.abilitaBonifici) {
- $('#BONIFICI').css('display','none');
- $('#SBBONIFICI').css('display','none');
- }
- if (!$scope.appVariables.abilitaAEA) {
- $('#AEA').css('display','none');
- $('#SBAEA').css('display','none');
- }
- if (!$scope.appVariables.abilitaRID) {
- $('#RID').css('display','none');
- $('#SBRID').css('display','none');
- }
- $('#DistinteBanca').css('display','none');
- $('#SBDistinteBanca').css('display','none');
- $('#TabellaBanche').css('display','none');
- $('#SBTabellaBanche').css('display','none');
- $('#RemunerationSeda').css('display','none');
- $('#SBRemunerationSeda').css('display','none');
-
- if ($scope.appVariables.abilitaAEA ==false && $scope.appVariables.abilitaRID==false) {
- $('#AcquisizioneFlussiDispositivi').css('display','none');
- $('#SBAcquisizioneFlussiDispositivi').css('display','none');
- }
-
- }
-
- if ($scope.appVariables.profiloLocale=='UO' || $scope.appVariables.profiloLocale=='UR' || $scope.appVariables.profiloLocale=='VI' ) {
- if (!$scope.appVariables.abilitaAccessoAnagrafica){
- $('#AnagraficaOrdinanti').css('display','none');
- $('#SBAnagraficaOrdinanti').css('display','none');
- }
-
- }
-
-
-
- });
- }
- }
-
- $scope.visibleToProfile = function(menu){
- if (typeof menu!="undefined" && typeof menu.visible != "undefined" && $scope.getCurrentUser()!=null)
- return menu.visible.indexOf($scope.getCurrentUser().userProfile)>=0;
- return false;
- }
-
- $scope.getCurrentUser = function(){
- return userService.getCurrentUser();
- }
-
- $scope.logout = function() {
- userService.logout();
- }
-
- $scope.menu = function(){
- return menuService.getMenu().mainMenu;
- }
- $scope.go = function(url, tipoChiamata) {
- if (tipoChiamata!='') {
- $scope.currentMenu = url;
- var filtro = userService.getFiltroIncassiSDD();
- filtro.tipoChiamata = tipoChiamata;
-
- filtro.idDistintaBanca = 0;
- filtro.idDistintaFlusso = 0;
- filtro.codiceClienteDebitore='';
-
- userService.setFiltroIncassiSDD(filtro);
-
- if (url.indexOf("distinteBanca")==-1) {
- localStorage.removeItem("filterDistinte");
- localStorage.removeItem("filterDistinteAttivo");
- localStorage.removeItem("filterDistinteSelectedIndex");
- }
-
- $route.reload();
- }
-
- $location.path(url);
- }
-
- $scope.closeOnClick = function() {
- if (!$mdMedia('gt-sm')){
- $mdSidenav('menuSidenav').close();
- }
- }
-
- $scope.isMenuSelected = function(menuId) {
- return menuService.isMenuSelected(menuId);
- }
- $scope.setSelectedMenu = function (menu) {
- return menuService.setSelectedMenu(menu)
- }
- $scope.isSubMenuSelected = function(subMenuId) {
- return menuService.isSubMenuSelected(subMenuId);
- }
- $scope.setSelectedSubMenu = function (subMenuId) {
- return menuService.setSelectedSubMenu(subMenuId)
- }
- $scope.hasSubMenu = function(menu) {
- return menuService.hasSubMenu(menu);
- }
-
- });
|