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 @@