From 7bed244e754a89ef500aa2b762c9c22d52575479 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 3 May 2019 12:40:52 -0300 Subject: [PATCH] img's checked --- src/js/app.js | 6 +++--- src/js/controller.js | 43 ++++++++++++++++++++++++++------------ src/views/botonera-facturador.html | 15 ++++++++++++- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/src/js/app.js b/src/js/app.js index 3946717..c2ed0aa 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -2,8 +2,8 @@ angular.module('focaBotoneraFacturador', []) .component('focaBotoneraFacturador', { templateUrl: 'src/views/botonera-facturador.html', controller: 'focaBotoneraFacturadorController', - bindings: { - botones: '<', - max: '<' + bindings: { + max: '<', + botones: '<' } }); diff --git a/src/js/controller.js b/src/js/controller.js index fc056dd..a0b8da9 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -5,21 +5,13 @@ angular.module('focaBotoneraFacturador') 'APP', function($scope, $window, APP) { this.$onInit = function() { - $scope.botones = $scope.$ctrl.botones; - //TODO: controlar que no se estiren los botones - if(APP) return; - var max = ($scope.$ctrl.max) ? $scope.$ctrl.max : 12; - if($window.innerWidth > 576) { - while(($scope.botones.length % max) !== 0) { - $scope.botones.push(''); - } - }else { - while(($scope.botones.length % 4) !== 0) { - $scope.botones.push(''); - } - } + ordenarBotones(); }; + this.$onChanges = function(p) { + ordenarBotones(); + } + function nombreFuncion(string) { var texto = 'seleccionar'; var arr = string.split(' '); @@ -33,4 +25,29 @@ angular.module('focaBotoneraFacturador') $scope.ejecutarFuncion = function(nombre) { $scope.$parent[nombreFuncion(nombre)](); }; + + $scope.ejecutarFuncionDelete = function(variable) { + $scope.$parent['clean' + variable](); + }; + + $scope.existeFuncionDelete = function(variable) { + if ($scope.$parent['clean' + variable]) return true; + return false; + } + + function ordenarBotones() { + $scope.botones = $scope.$ctrl.botones; + //TODO: controlar que no se estiren los botones + if(APP) return; + var max = ($scope.$ctrl.max) ? $scope.$ctrl.max : 12; + if ($window.innerWidth > 576) { + while(($scope.botones.length % max) !== 0) { + $scope.botones.push(''); + } + } else { + while(($scope.botones.length % 4) !== 0) { + $scope.botones.push(''); + } + } + } }]); diff --git a/src/views/botonera-facturador.html b/src/views/botonera-facturador.html index e9ba2e2..c27fa86 100644 --- a/src/views/botonera-facturador.html +++ b/src/views/botonera-facturador.html @@ -2,6 +2,19 @@ class="col-4 col-sm-2 px-1 py-1 m-auto m-md-0" ng-repeat="boton in botones track by $index" ng-class="{'d-md-grid': boton == ''}"> + + -- 1.9.1