Commit ea089af494763a96e55ed077306b0127d4622643
1 parent
ad1f83ff27
Exists in
master
and in
1 other branch
demo jorge
Showing
1 changed file
with
3 additions
and
2 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaBotoneraFacturador') | 1 | angular.module('focaBotoneraFacturador') |
2 | .controller('focaBotoneraFacturadorController', [ | 2 | .controller('focaBotoneraFacturadorController', [ |
3 | '$scope', | 3 | '$scope', |
4 | '$window', | 4 | '$window', |
5 | function($scope, $window) { | 5 | 'APP', |
6 | function($scope, $window, APP) { | ||
6 | this.$onInit = function() { | 7 | this.$onInit = function() { |
7 | $scope.botones = $scope.$ctrl.botones; | 8 | $scope.botones = $scope.$ctrl.botones; |
9 | if(APP) return; | ||
8 | var max = ($scope.$ctrl.max) ? $scope.$ctrl.max : 12; | 10 | var max = ($scope.$ctrl.max) ? $scope.$ctrl.max : 12; |
9 | |||
10 | if($window.innerWidth > 576) { | 11 | if($window.innerWidth > 576) { |
11 | while(($scope.botones.length % max) !== 0) { | 12 | while(($scope.botones.length % max) !== 0) { |
12 | $scope.botones.push(''); | 13 | $scope.botones.push(''); |
13 | } | 14 | } |
14 | }else { | 15 | }else { |
15 | while(($scope.botones.length % 4) !== 0) { | 16 | while(($scope.botones.length % 4) !== 0) { |
16 | $scope.botones.push(''); | 17 | $scope.botones.push(''); |
17 | } | 18 | } |
18 | } | 19 | } |
19 | }; | 20 | }; |
20 | 21 | ||
21 | function nombreFuncion(string) { | 22 | function nombreFuncion(string) { |
22 | var texto = 'seleccionar'; | 23 | var texto = 'seleccionar'; |
23 | var arr = string.split(' '); | 24 | var arr = string.split(' '); |
24 | arr.forEach(function(palabra) { | 25 | arr.forEach(function(palabra) { |
25 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); | 26 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); |
26 | texto += palabra; | 27 | texto += palabra; |
27 | }); | 28 | }); |
28 | return texto; | 29 | return texto; |
29 | } | 30 | } |
30 | 31 | ||
31 | $scope.ejecutarFuncion = function(nombre) { | 32 | $scope.ejecutarFuncion = function(nombre) { |
32 | $scope.$parent[nombreFuncion(nombre)](); | 33 | $scope.$parent[nombreFuncion(nombre)](); |
33 | }; | 34 | }; |
34 | }]); | 35 | }]); |