Commit 62fba03f565d0227144b419c98c364003f42175c

Authored by Eric Fernandez
1 parent 00fbea86ea
Exists in master and in 1 other branch develop

Modal recibe objeto como parámetro

... ... @@ -44,8 +44,11 @@
44 44 controller: 'modalBusquedaProductosCtrl',
45 45 size: 'lg',
46 46 resolve: {
47   - idLista : function() { return -1; },
48   - cotizacion: function() { return 1;}
  47 + parametroProducto: {
  48 + idLista: -1,
  49 + cotizacion: 1,
  50 + simbolo:'$'
  51 + }
49 52 }
50 53 }
51 54 );
src/js/controller.js
... ... @@ -4,13 +4,13 @@ angular.module('focaBusquedaProductos')
4 4 '$filter',
5 5 '$scope',
6 6 '$uibModalInstance',
7   - 'idLista',
8   - 'cotizacion',
  7 + 'parametroProducto',
9 8 'focaBusquedaProductosService',
10   - function($filter, $scope, $uibModalInstance, idLista,
11   - cotizacion, focaBusquedaProductosService
  9 + function($filter, $scope, $uibModalInstance, parametroProducto,
  10 + focaBusquedaProductosService
12 11 ) {
13 12  
  13 + $scope.simbolo = parametroProducto.simbolo;
14 14 $scope.filters = '';
15 15 $scope.productos = [];
16 16 $scope.primerBusqueda = false;
... ... @@ -26,11 +26,11 @@ angular.module('focaBusquedaProductos')
26 26 $scope.busquedaPress = function(key) {
27 27 if (key === 13) {
28 28 $scope.searchLoading = true;
29   - if(idLista > 0) {
  29 + if(parametroProducto.idLista > 0) {
30 30 focaBusquedaProductosService
31   - .getProductosByIdLista(idLista, $scope.filters)
  31 + .getProductosByIdLista(parametroProducto.idLista, $scope.filters)
32 32 .then(llenarDatos);
33   - } else if(idLista === -1) {
  33 + } else if(parametroProducto.idLista === -1) {
34 34 focaBusquedaProductosService.getProductos()
35 35 .then(llenarDatos);
36 36 }
... ... @@ -38,7 +38,7 @@ angular.module('focaBusquedaProductos')
38 38 };
39 39 function llenarDatos(res) {
40 40 for(var i = 0; i < res.data.length; i++) {
41   - res.data[i].precio = res.data[i].precio / cotizacion;
  41 + res.data[i].precio = res.data[i].precio / parametroProducto.cotizacion;
42 42 }
43 43 $scope.searchLoading = false;
44 44 $scope.primerBusqueda = true;
src/views/modal-busqueda-productos.html
... ... @@ -48,7 +48,7 @@
48 48 <td ng-bind="producto.sector"></td>
49 49 <td ng-bind="producto.codigo"></td>
50 50 <td ng-bind="producto.descripcion"></td>
51   - <td ng-bind="producto.precio | currency"></td>
  51 + <td ng-bind="producto.precio | currency: simbolo : 4"></td>
52 52 <td>
53 53 <button
54 54 type="button"