Commit ad4ad9b64d61387d806f87c6c69f345db39ec9a7

Authored by Nicolás Guarnieri
Exists in master

Merge branch 'master' into 'master'

Master (pmarco)

See merge request modulos-npm/foca-botonera-principal!10
src/js/controller.js
1 angular.module('focaBotoneraPrincipal') 1 angular.module('focaBotoneraPrincipal')
2 .controller('focaBotoneraPrincipalController', [ 2 .controller('focaBotoneraPrincipalController', [
3 '$scope', '$location', '$localStorage', 'botones', 'focaModalService', 'APP', 3 '$scope', '$location', '$localStorage', 'botones', 'focaModalService', 'APP',
4 function($scope, $location, $localStorage, botones, focaModalService, APP) { 4 function($scope, $location, $localStorage, botones, focaModalService, APP) {
5 $scope.paginas = []; 5 $scope.paginas = [];
6 if(APP === 'distribuidor') { 6 var botonesPorPagina = 12;
7 $scope.paginas.push(botones.data.slice(0, 3)); 7 if(APP === 'distribuidor' || APP === 'transportista') {
8 $scope.paginas.push(botones.data.slice(3, 6)); 8 botonesPorPagina = 3;
9 } else { 9 }
10 $scope.paginas.push(botones.data); 10 for(var i = 0; i < botones.data.length; i += botonesPorPagina){
11 $scope.paginas.push(botones.data.slice(i, i + botonesPorPagina));
11 } 12 }
12 13
13 $scope.irA = function(accion) { 14 $scope.irA = function(accion) {
14 $location.path(accion); 15 $location.path(accion);
15 }; 16 };
16 17
17 $scope.logout = function() { 18 $scope.logout = function() {
18 $location.path('/logout'); 19 $location.path('/logout');
19 }; 20 };
20 21
21 $scope.showTerminal = function() { 22 $scope.showTerminal = function() {
22 var key = $localStorage.terminalKey; 23 var key = $localStorage.terminalKey;
23 focaModalService.alert('SU TERMINAL ES: ' + key); 24 focaModalService.alert('SU TERMINAL ES: ' + key);
24 }; 25 };
25 } 26 }
26 ]); 27 ]);
27 28