From 89aafe6a28f94ea42f6cd0d7a733a198d911b4b2 Mon Sep 17 00:00:00 2001 From: Jose Pinto Date: Thu, 24 Jan 2019 17:23:03 -0300 Subject: [PATCH] calcula extra --- src/js/app.js | 3 +-- src/js/controller.js | 13 ++++++++++--- src/views/botonera-facturador.html | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/js/app.js b/src/js/app.js index 9430f89..583e34d 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -3,7 +3,6 @@ angular.module('focaBotoneraFacturador', []) templateUrl: 'src/views/botonera-facturador.html', controller: 'focaBotoneraFacturadorController', bindings: { - botones: '<', - extra: '<' + botones: '<' } }); diff --git a/src/js/controller.js b/src/js/controller.js index b961a3a..2abada7 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -1,12 +1,19 @@ angular.module('focaBotoneraFacturador') .controller('focaBotoneraFacturadorController', [ '$scope', - function($scope) { + '$window', + function($scope, $window) { this.$onInit = function() { $scope.botones = $scope.$ctrl.botones; - for(var i = 0; i < $scope.$ctrl.extra; i++) { - $scope.botones.push(''); + if($window.innerWidth > 576) { + while(($scope.botones.length % 12) !== 0) { + $scope.botones.push(''); + } + }else { + while(($scope.botones.length % 3) !== 0) { + $scope.botones.push(''); + } } }; diff --git a/src/views/botonera-facturador.html b/src/views/botonera-facturador.html index e93cb60..a793415 100644 --- a/src/views/botonera-facturador.html +++ b/src/views/botonera-facturador.html @@ -1,7 +1,7 @@
+ ng-class="{'d-md-grid': boton == ''}">