diff --git a/src/js/controller.js b/src/js/controller.js index bbb6688..e000696 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -34,9 +34,11 @@ angular.module('focaBusquedaProductos') if (parametroProducto.idLista > 0) { focaBusquedaProductosService .getProductosByIdLista(parametroProducto.idLista, $scope.filters) - .then(llenarDatos); - focaBusquedaProductosService.getProductos() - .then(fillAllProductos); + .then(function (data) { + llenarDatos(data); + focaBusquedaProductosService.getProductos() + .then(fillAllProductos); + }); } } }; @@ -52,7 +54,13 @@ angular.module('focaBusquedaProductos') }; function fillAllProductos(res) { for (var i = 0; i < res.data.length; i++) { - res.data[i].precio = res.data[i].precio / parametroProducto.cotizacion; + var producto = $scope.listaProductos.filter(function(producto) { + return producto.id == res.data[i].id; + })[0]; + + if (producto) { + res.data[i].precio = producto.precio; + } } $scope.searchLoading = false; $scope.primerBusqueda = true; @@ -97,8 +105,6 @@ angular.module('focaBusquedaProductos') $scope.currentPage = page; }; $scope.select = function (producto) { - // if ($scope.useAllProducts) - // producto.precio = producto.precioBase; $uibModalInstance.close(producto); }; $scope.cancel = function () { diff --git a/src/views/modal-busqueda-productos.html b/src/views/modal-busqueda-productos.html index 260d3e7..5fff5ec 100644 --- a/src/views/modal-busqueda-productos.html +++ b/src/views/modal-busqueda-productos.html @@ -36,7 +36,9 @@