diff --git a/src/js/controllerMail.js b/src/js/controllerMail.js index 85614c1..06461fb 100644 --- a/src/js/controllerMail.js +++ b/src/js/controllerMail.js @@ -15,7 +15,6 @@ angular.module('focaModal') $scope.correoNoEnviado = false; $scope.esperando = false; $scope.titulo = options.titulo; - $scope.mailCliente = options.envio.mailCliente; $scope.checkboxVar = false; $scope.aceptar = function () { @@ -26,11 +25,7 @@ angular.module('focaModal') }; $scope.validarImpresion = function () { var rutaComprobante; - if ($scope.checkboxVar === true) { - rutaComprobante = options.descargaSinValorizar; - } else { - rutaComprobante = options.descarga; - } + rutaComprobante = $scope.checkboxVar === true ? options.descargaSinValorizar : options.descarga; imprimir(rutaComprobante); } imprimir = function (rutaComprobante) { @@ -48,7 +43,12 @@ angular.module('focaModal') $scope.esperando = false; }); }; - $scope.enviarCorreo = function (key) { + $scope.enviarComprobante = function(){ + var rutaEnvioComprobante; + rutaEnvioComprobante = $scope.checkboxVar === true ? options.envioSinValorizar : options.envio; + enviarCorreo(rutaEnvioComprobante, 13); + } + enviarCorreo = function (rutaEnvioComprobante, key) { if (key === 13) { if (!validarMail()) { focaModalService.alert('Ingrese email/s vĂ¡lido/s'); @@ -56,10 +56,11 @@ angular.module('focaModal') } $scope.descargado = true; $scope.esperando = true; + $scope.mailCliente = rutaEnvioComprobante.mailCliente; Object.assign(options.options, { receiver: $scope.mailCliente }); focaModalService - .enviarCorreo(options.envio.url, options.options) + .enviarCorreo(rutaEnvioComprobante.url, options.options) .then(function () { $scope.correoEnviado = true; $scope.esperando = false; diff --git a/src/js/service.js b/src/js/service.js index b067d61..11a91ed 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -116,7 +116,6 @@ angular.module('focaModal') ); }, imprimirComprobante: function(url, options) { - console.log('imprimirComprobante', url, options); return $http.post( API_ENDPOINT.URL + url, options, @@ -124,7 +123,6 @@ angular.module('focaModal') ); }, enviarCorreo: function(url, options) { - console.log('enviarCorreo', url, options); return $http.post(API_ENDPOINT.URL + url, options); } }; diff --git a/src/views/modal-mail.html b/src/views/modal-mail.html index 8bf9936..e14e48b 100644 --- a/src/views/modal-mail.html +++ b/src/views/modal-mail.html @@ -14,12 +14,12 @@ @@ -28,16 +28,6 @@
-
- - -