From 62fba03f565d0227144b419c98c364003f42175c Mon Sep 17 00:00:00 2001 From: efernandez Date: Fri, 2 Nov 2018 17:10:40 -0300 Subject: [PATCH] =?UTF-8?q?Modal=20recibe=20objeto=20como=20par=C3=A1metro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 7 +++++-- src/js/controller.js | 16 ++++++++-------- src/views/modal-busqueda-productos.html | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 8db23a0..90be9dd 100644 --- a/index.html +++ b/index.html @@ -44,8 +44,11 @@ controller: 'modalBusquedaProductosCtrl', size: 'lg', resolve: { - idLista : function() { return -1; }, - cotizacion: function() { return 1;} + parametroProducto: { + idLista: -1, + cotizacion: 1, + simbolo:'$' + } } } ); diff --git a/src/js/controller.js b/src/js/controller.js index bf04b81..ed32674 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -4,13 +4,13 @@ angular.module('focaBusquedaProductos') '$filter', '$scope', '$uibModalInstance', - 'idLista', - 'cotizacion', + 'parametroProducto', 'focaBusquedaProductosService', - function($filter, $scope, $uibModalInstance, idLista, - cotizacion, focaBusquedaProductosService + function($filter, $scope, $uibModalInstance, parametroProducto, + focaBusquedaProductosService ) { + $scope.simbolo = parametroProducto.simbolo; $scope.filters = ''; $scope.productos = []; $scope.primerBusqueda = false; @@ -26,11 +26,11 @@ angular.module('focaBusquedaProductos') $scope.busquedaPress = function(key) { if (key === 13) { $scope.searchLoading = true; - if(idLista > 0) { + if(parametroProducto.idLista > 0) { focaBusquedaProductosService - .getProductosByIdLista(idLista, $scope.filters) + .getProductosByIdLista(parametroProducto.idLista, $scope.filters) .then(llenarDatos); - } else if(idLista === -1) { + } else if(parametroProducto.idLista === -1) { focaBusquedaProductosService.getProductos() .then(llenarDatos); } @@ -38,7 +38,7 @@ angular.module('focaBusquedaProductos') }; function llenarDatos(res) { for(var i = 0; i < res.data.length; i++) { - res.data[i].precio = res.data[i].precio / cotizacion; + res.data[i].precio = res.data[i].precio / parametroProducto.cotizacion; } $scope.searchLoading = false; $scope.primerBusqueda = true; diff --git a/src/views/modal-busqueda-productos.html b/src/views/modal-busqueda-productos.html index a0de783..88b656f 100644 --- a/src/views/modal-busqueda-productos.html +++ b/src/views/modal-busqueda-productos.html @@ -48,7 +48,7 @@ - +