Commit d0c69fa0c812b80052a3174ffa15fe05be20e039
1 parent
e645dcb5a9
Exists in
master
modal recibe cotización para cálculo de precios
Showing
2 changed files
with
12 additions
and
3 deletions
Show diff stats
index.html
src/js/controller.js
| ... | ... | @@ -5,8 +5,11 @@ angular.module('focaBusquedaProductos') |
| 5 | 5 | '$scope', |
| 6 | 6 | '$uibModalInstance', |
| 7 | 7 | 'idLista', |
| 8 | + 'cotizacion', | |
| 8 | 9 | 'focaBusquedaProductosService', |
| 9 | - function($filter, $scope, $uibModalInstance, idLista, focaBusquedaProductosService) { | |
| 10 | + function($filter, $scope, $uibModalInstance, idLista, | |
| 11 | + cotizacion, focaBusquedaProductosService | |
| 12 | + ) { | |
| 10 | 13 | |
| 11 | 14 | $scope.filters = ''; |
| 12 | 15 | $scope.productos = []; |
| ... | ... | @@ -28,6 +31,9 @@ angular.module('focaBusquedaProductos') |
| 28 | 31 | .getProductosByIdLista(idLista, $scope.filters) |
| 29 | 32 | .then( |
| 30 | 33 | function(res) { |
| 34 | + for(var i = 0; i < res.data.length; i++) { | |
| 35 | + res.data[i].precio = res.data[i].precio / cotizacion; | |
| 36 | + } | |
| 31 | 37 | $scope.searchLoading = false; |
| 32 | 38 | $scope.primerBusqueda = true; |
| 33 | 39 | $scope.productos = res.data; |
| ... | ... | @@ -38,6 +44,9 @@ angular.module('focaBusquedaProductos') |
| 38 | 44 | } else if(idLista === -1) { |
| 39 | 45 | focaBusquedaProductosService.getProductos().then( |
| 40 | 46 | function(res) { |
| 47 | + for(var i = 0; i < res.data.length; i++) { | |
| 48 | + res.data[i].precio = res.data[i].precio / cotizacion; | |
| 49 | + } | |
| 41 | 50 | $scope.searchLoading = false; |
| 42 | 51 | $scope.primerBusqueda = true; |
| 43 | 52 | $scope.productos = res.data; |
| ... | ... | @@ -52,7 +61,7 @@ angular.module('focaBusquedaProductos') |
| 52 | 61 | $scope.search = function() { |
| 53 | 62 | if($scope.productos.length > 0) { |
| 54 | 63 | $scope.filteredProductos = $filter('filter')( |
| 55 | - $scope.productos, | |
| 64 | + $scope.productos, | |
| 56 | 65 | {$: $scope.filters} |
| 57 | 66 | ); |
| 58 | 67 |