Commit ae792d6f27991f4c568a8fc497214b05d76650aa

Authored by Jose Pinto
1 parent 7d19d80579
Exists in master

ok servicios modal mail

Showing 2 changed files with 13 additions and 4 deletions   Show diff stats
src/js/controllerMail.js
... ... @@ -4,11 +4,10 @@ angular.module('focaModal')
4 4 '$uibModalInstance',
5 5 'FileSaver',
6 6 'Blob',
7   - 'focaModalEnviarMailService',
8 7 'focaModalService',
9 8 'options',
10 9 function($scope, $uibModalInstance, FileSaver, Blob,
11   - focaModalEnviarMailService, focaModalService, options) {
  10 + focaModalService, options) {
12 11  
13 12 var regexMail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
14 13 $scope.descargado = false;
... ... @@ -27,7 +26,7 @@ angular.module(&#39;focaModal&#39;)
27 26 $scope.imprimir = function () {
28 27 $scope.descargado = true;
29 28 $scope.esperando = true;
30   - focaModalEnviarMailService
  29 + focaModalService
31 30 .imprimirComprobante(options.descarga.url, options.options)
32 31 .then(function(res) {
33 32 var data = new Blob([res.data], {type: 'application/pdf'});
... ... @@ -49,7 +48,7 @@ angular.module(&#39;focaModal&#39;)
49 48 $scope.esperando = true;
50 49 Object.assign(options.options, {receiver: $scope.mailCliente});
51 50  
52   - focaModalEnviarMailService
  51 + focaModalService
53 52 .enviarCorreo(options.envio.url, options.options)
54 53 .then(function() {
55 54 $scope.correoEnviado = true;
... ... @@ -100,6 +100,16 @@ angular.module(&#39;focaModal&#39;)
100 100 return resultado;
101 101 }
102 102 );
  103 + },
  104 + imprimirComprobante: function(url, options) {
  105 + return $http.post(
  106 + API_ENDPOINT.URL + url,
  107 + options,
  108 + {responseType: 'arraybuffer'}
  109 + );
  110 + },
  111 + enviarCorreo: function(url, options) {
  112 + return $http.post(API_ENDPOINT.URL + url, options);
103 113 }
104 114 };
105 115 }