Commit 85f3f7fd64c12d02c6940a09518253dae7b93369
Exists in
master
Merge branch 'master' into 'master'
Master (pmarco) See merge request modulos-npm/foca-crear-nota-pedido!40
Showing
2 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -313,7 +313,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
313 | 313 | var plazosConcat = ''; |
314 | 314 | if(!Array.isArray(precioCondicion)) { |
315 | 315 | $scope.plazosPagos = precioCondicion.plazoPago; |
316 | - idLista = precioCondicion.idListaPrecio; | |
316 | + idLista = precioCondicion.idListaPrecio; | |
317 | 317 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
318 | 318 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
319 | 319 | } |
... | ... | @@ -325,7 +325,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
325 | 325 | plazosConcat += precioCondicion[j].dias + ' '; |
326 | 326 | } |
327 | 327 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
328 | - } | |
328 | + } | |
329 | 329 | $scope.articulosTabla = []; |
330 | 330 | addCabecera('Precios y condiciones:', cabecera); |
331 | 331 | }, function() { |
... | ... | @@ -391,6 +391,35 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
391 | 391 | }; |
392 | 392 | |
393 | 393 | addCabecera('Moneda:', moneda.DETALLE); |
394 | + $scope.abrirModalCotizacion(moneda.ID); | |
395 | + }, function() { | |
396 | + | |
397 | + } | |
398 | + ); | |
399 | + }; | |
400 | + | |
401 | + $scope.abrirModalCotizacion = function(idMoneda) { | |
402 | + var modalInstance = $uibModal.open( | |
403 | + { | |
404 | + ariaLabelledBy: 'Busqueda de Cotización', | |
405 | + templateUrl: 'modal-cotizacion.html', | |
406 | + controller: 'focaModalCotizacionController', | |
407 | + size: 'lg', | |
408 | + resolve: {idMoneda: function() {return idMoneda;}} | |
409 | + } | |
410 | + ); | |
411 | + modalInstance.result.then( | |
412 | + function(cotizacion) { | |
413 | + $scope.notaPedido.cotizacion = { | |
414 | + id: cotizacion.ID, | |
415 | + cotizacion: cotizacion.COTIZACION | |
416 | + }; | |
417 | + | |
418 | + addCabecera( | |
419 | + 'Fecha cotizacion:', | |
420 | + $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | |
421 | + ); | |
422 | + addCabecera('Cotizacion:', cotizacion.COTIZACION); | |
394 | 423 | }, function() { |
395 | 424 | |
396 | 425 | } |
... | ... | @@ -466,7 +495,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
466 | 495 | }; |
467 | 496 | |
468 | 497 | function addCabecera(label, valor) { |
469 | - var propiedad = $filter('filter')($scope.cabecera, {label: label}); | |
498 | + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | |
470 | 499 | if(propiedad.length === 1) { |
471 | 500 | propiedad[0].valor = valor; |
472 | 501 | } else { |
... | ... | @@ -475,7 +504,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
475 | 504 | } |
476 | 505 | |
477 | 506 | function removeCabecera(label) { |
478 | - var propiedad = $filter('filter')($scope.cabecera, {label: label}); | |
507 | + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | |
479 | 508 | if(propiedad.length === 1){ |
480 | 509 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
481 | 510 | } |