Commit 921fade2fe16ded2f23736ca5eea6853a6081889
1 parent
38153067d5
Exists in
master
and in
1 other branch
Arreglo de identacion y de funcion en un foreach.
Showing
1 changed file
with
12 additions
and
12 deletions
 
Show diff stats
src/js/controllerTarjetas.js
| 1 | angular.module('focaBotoneraFacturador') | 1 | angular.module('focaBotoneraFacturador') | 
| 2 | .controller('focaBotoneraTarjetasController', [ | 2 | .controller('focaBotoneraTarjetasController', [ | 
| 3 | '$scope', | 3 | '$scope', | 
| 4 | '$window', | 4 | '$window', | 
| 5 | 'APP', | 5 | 'APP', | 
| 6 | function($scope, $window, APP) { | 6 | function ($scope, $window, APP) { | 
| 7 | this.$onInit = function() { | 7 | this.$onInit = function () { | 
| 8 | $scope.botones = $scope.$ctrl.botones; | 8 | $scope.botones = $scope.$ctrl.botones; | 
| 9 | //TODO: controlar que no se estiren los botones | 9 | //TODO: controlar que no se estiren los botones | 
| 10 | if(APP) return; | 10 | if (APP) return; | 
| 11 | var max = ($scope.$ctrl.max) ? $scope.$ctrl.max : 12; | 11 | var max = ($scope.$ctrl.max) ? $scope.$ctrl.max : 12; | 
| 12 | if($window.innerWidth > 576) { | 12 | if ($window.innerWidth > 576) { | 
| 13 | while(($scope.botones.length % max) !== 0) { | 13 | while (($scope.botones.length % max) !== 0) { | 
| 14 | $scope.botones.push(''); | 14 | $scope.botones.push(''); | 
| 15 | } | 15 | } | 
| 16 | }else { | 16 | } else { | 
| 17 | while(($scope.botones.length % 4) !== 0) { | 17 | while (($scope.botones.length % 4) !== 0) { | 
| 18 | $scope.botones.push(''); | 18 | $scope.botones.push(''); | 
| 19 | } | 19 | } | 
| 20 | } | 20 | } | 
| 21 | }; | 21 | }; | 
| 22 | 22 | ||
| 23 | function nombreFuncion(string) { | 23 | function nombreFuncion(string) { | 
| 24 | var texto = 'seleccionar'; | 24 | var texto = 'seleccionar'; | 
| 25 | var arr = string.split(' '); | 25 | var arr = string.split(' '); | 
| 26 | arr.forEach(function(palabra) { | 26 | arr.forEach(function (palabra) { | 
| 27 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); | 27 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); | 
| 28 | texto += palabra; | 28 | texto += palabra; | 
| 29 | }); | 29 | }); | 
| 30 | return texto; | 30 | return texto; | 
| 31 | } | 31 | } | 
| 32 | 32 | ||
| 33 | $scope.ejecutarFuncion = function(nombre) { | 33 | $scope.ejecutarFuncion = function (nombre) { | 
| 34 | $scope.$parent[nombreFuncion(nombre)](); | 34 | $scope.$parent[nombreFuncion(nombre)](); | 
| 35 | }; | 35 | }; | 
| 36 | 36 | ||
| 37 | $scope.activarBoton = function (boton){ | 37 | $scope.activarBoton = function (boton) { | 
| 38 | $scope.botones.forEach(boton => { | 38 | $scope.botones.forEach(function (boton) { | 
| 39 | boton.active = false; | 39 | boton.active = false; | 
| 40 | }); | 40 | }); | 
| 41 | boton.active = true; | 41 | boton.active = true; | 
| 42 | }; | 42 | }; | 
| 43 | }]); | 43 | }]); | 
| 44 | 44 |