diff --git a/src/js/controller.js b/src/js/controller.js index 3612e94..a983ca8 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -305,7 +305,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', var plazosConcat = ''; if(!Array.isArray(precioCondicion)) { $scope.plazosPagos = precioCondicion.plazoPago; - idLista = precioCondicion.idListaPrecio; + idLista = precioCondicion.idListaPrecio; for(var i = 0; i < precioCondicion.plazoPago.length; i++) { plazosConcat += precioCondicion.plazoPago[i].dias + ' '; } @@ -317,7 +317,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', plazosConcat += precioCondicion[j].dias + ' '; } cabecera = 'Ingreso manual ' + plazosConcat.trim(); - } + } $scope.articulosTabla = []; addCabecera('Precios y condiciones:', cabecera); }, function() { @@ -383,6 +383,35 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', }; addCabecera('Moneda:', moneda.DETALLE); + $scope.abrirModalCotizacion(moneda.ID); + }, function() { + + } + ); + }; + + $scope.abrirModalCotizacion = function(idMoneda) { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Cotización', + templateUrl: 'modal-cotizacion.html', + controller: 'focaModalCotizacionController', + size: 'lg', + resolve: {idMoneda: function() {return idMoneda;}} + } + ); + modalInstance.result.then( + function(cotizacion) { + $scope.notaPedido.cotizacion = { + id: cotizacion.ID, + cotizacion: cotizacion.COTIZACION + }; + + addCabecera( + 'Fecha cotizacion:', + $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') + ); + addCabecera('Cotizacion:', cotizacion.COTIZACION); }, function() { } @@ -458,7 +487,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', }; function addCabecera(label, valor) { - var propiedad = $filter('filter')($scope.cabecera, {label: label}); + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); if(propiedad.length === 1) { propiedad[0].valor = valor; } else { @@ -467,7 +496,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', } function removeCabecera(label) { - var propiedad = $filter('filter')($scope.cabecera, {label: label}); + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); if(propiedad.length === 1){ $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); } diff --git a/src/views/nota-pedido.html b/src/views/nota-pedido.html index 18e16fd..42ee858 100644 --- a/src/views/nota-pedido.html +++ b/src/views/nota-pedido.html @@ -25,6 +25,7 @@ ng-blur="datepickerAbierto = false" class="form-control form-control-sm col-8 float-right" foca-focus="datepickerAbierto" + hasta-hoy />