From b8262d7287d42b987b5a2f4795d50dcb89eb9e30 Mon Sep 17 00:00:00 2001 From: Jose Pinto Date: Tue, 26 Mar 2019 16:26:17 -0300 Subject: [PATCH] fix bug mostrar imagenes --- src/js/controller.js | 25 ++++++++++++------------- src/views/modal-detalles.html | 10 +++++----- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index c95e9e6..79b4317 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -9,15 +9,18 @@ angular.module('focaModalDetalles') 'sugerido', function($scope, $uibModalInstance, focaModalService, APP, $timeout, sugerido) { $scope.mobile = APP === 'cobranza'; - $scope.files = []; - $scope.importe = Math.abs(sugerido); + $scope.detalles = { + files: [], + observaciones: '', + importe: Math.abs(sugerido) || 0 + }; - $scope.$watch('files', function() { + $scope.$watch('detalles.files', function() { validarExtSize(); }); $scope.eliminarImg = function(key) { - $scope.files.splice(key, 1); + $scope.detalles.files.splice(key, 1); }; $scope.cancel = function() { @@ -25,11 +28,7 @@ angular.module('focaModalDetalles') }; $scope.aceptar = function() { - $uibModalInstance.close({ - observacion: $scope.observaciones, - monto: $scope.importe, - imgs: $scope.files - }); + $uibModalInstance.close($scope.detalles); }; $scope.seleccionarFoto = function() { @@ -57,7 +56,7 @@ angular.module('focaModalDetalles') base64: imageBase64, }; $timeout(function() { - $scope.files.push(imagen); + $scope.detalles.files.push(imagen); }); } function cameraError(err) { @@ -80,7 +79,7 @@ angular.module('focaModalDetalles') function validarExtSize() { var totalSize = 0; var invalidExt = false; - $scope.files.forEach(function(file) { + $scope.detalles.files.forEach(function(file) { //CONVIERTO BYTES A MB totalSize += file.size / 1000000; var fileExt = file.name.split('.').pop(); @@ -92,10 +91,10 @@ angular.module('focaModalDetalles') if (totalSize > 150) { focaModalService.alert('El/los archivo/s exceden la capacidad máxima'); - $scope.files = []; + $scope.detalles.files = []; } else if (invalidExt) { focaModalService.alert('Ha ingresado un archivo con extensión inválida'); - $scope.files = []; + $scope.detalles.files = []; } } } diff --git a/src/views/modal-detalles.html b/src/views/modal-detalles.html index f33139b..4b15310 100644 --- a/src/views/modal-detalles.html +++ b/src/views/modal-detalles.html @@ -11,7 +11,7 @@