controller.js 1 KB
angular.module('focaBotoneraPrincipal')
    .controller('focaBotoneraPrincipalController', [
        '$scope', '$location', '$localStorage', 'botones', 'focaModalService', 'APP',
        function($scope, $location, $localStorage, botones, focaModalService, APP) {
            $scope.paginas = [];
            var botonesPorPagina = 12;
            if(APP === 'distribuidor' || APP === 'transportista') {
                botonesPorPagina = 3;
            }
            for(var i = 0; i < botones.data.length; i += botonesPorPagina){
                $scope.paginas.push(botones.data.slice(i, i + botonesPorPagina));
            }

            $scope.irA = function(accion) {
                $location.path(accion);
            };

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

            $scope.showTerminal = function() {
                var key = $localStorage.terminalKey;
                focaModalService.alert('SU TERMINAL ES: ' + key);
            };
        }
    ]);