From 02ce8ad9fb57f0a555aa103d76eb62ff1e0a0465 Mon Sep 17 00:00:00 2001 From: efernandez Date: Tue, 27 Nov 2018 09:56:59 -0300 Subject: [PATCH] =?UTF-8?q?selecci=C3=B3n=20m=C3=BAltiple=20de=20items=20v?= =?UTF-8?q?alidaci=C3=B3n=20que=20elija=20al=20menos=20un=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/controller.js | 17 ++++++++++++----- src/views/foca-modal-factura.html | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index d0f5774..8353f31 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -48,6 +48,17 @@ angular.module('focaModalFactura') .then(llenarDatos); } }; + + $scope.aceptar = function() { + var result = $scope.facturas.filter(function(a) {return a.checked === true;}); + $uibModalInstance.close(result); + }; + + $scope.tieneAlMenosUno = function() { + var result = $scope.facturas.filter(function(a) {return a.checked === true;}); + return result.length === 0 ? true : false; + }; + function llenarDatos(res) { $scope.facturas = []; $scope.filteredFacturas = []; @@ -88,10 +99,6 @@ angular.module('focaModalFactura') $scope.currentPage = page; }; - $scope.select = function(notaPedido) { - $uibModalInstance.close(notaPedido); - }; - $scope.cancel = function() { $uibModalInstance.dismiss('cancel'); }; @@ -102,7 +109,7 @@ angular.module('focaModalFactura') } }; - $scope.itemNotaPedido = function(key) { + $scope.itemFactura = function(key) { if (key === 38) { anterior(key); } diff --git a/src/views/foca-modal-factura.html b/src/views/foca-modal-factura.html index 3cc5049..8e61810 100644 --- a/src/views/foca-modal-factura.html +++ b/src/views/foca-modal-factura.html @@ -80,27 +80,21 @@ + ng-repeat="(key,factura) in currentPageFacturas"> - - - + type="checkbox" + ng-model="factura.checked"/> @@ -136,4 +130,10 @@ -- 1.9.1