From ebf3e5e8d688ec8d0a37c3b5ae738eee6a62afc8 Mon Sep 17 00:00:00 2001 From: Pablo Marco del Pont Date: Wed, 31 Oct 2018 17:41:45 -0300 Subject: [PATCH] =?UTF-8?q?-=20Agregu=C3=A9=20el=20modal=20de=20cotizaci?= =?UTF-8?q?=C3=B3n.=20-=20Modifiqu=C3=A9=20la=20l=C3=B3gica=20para=20conti?= =?UTF-8?q?nuar=20desde=20moneda=20a=20cotizaci=C3=B3n.=20-=20Modifiqu?= =?UTF-8?q?=C3=A9=20addCabecera=20y=20removeCabecera=20para=20hacer=20perf?= =?UTF-8?q?ect=20match.=20-=20Agregu=C3=A9=20l=C3=ADmite=20de=20fecha=20ha?= =?UTF-8?q?sta=20hoy.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/controller.js | 37 +++++++++++++++++++++++++++++++++---- src/views/nota-pedido.html | 1 + 2 files changed, 34 insertions(+), 4 deletions(-) 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 /> -- 1.9.1