Commit 773cdbeb3d539d31431a49174e247863b8d8355b
1 parent
0de0110d70
Exists in
master
aplico modal mail al guardar
Showing
2 changed files
with
22 additions
and
24 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -297,28 +297,10 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 297 | 297 | .guardarCobranza(cobranza) |
| 298 | 298 | .then( |
| 299 | 299 | function(result) { |
| 300 | - var cliente = angular.copy($scope.cobranza.cliente); | |
| 301 | 300 | focaBotoneraLateralService.endGuardar(true); |
| 302 | 301 | $scope.saveLoading = false; |
| 303 | 302 | |
| 304 | - focaModalService | |
| 305 | - .prompt({ | |
| 306 | - titulo: 'Ingrese los emails separados por' + | |
| 307 | - ' coma para enviar comprobante', | |
| 308 | - value: cliente.MAIL, | |
| 309 | - email: true | |
| 310 | - }) | |
| 311 | - .then(function(res) { | |
| 312 | - return Promise.all([ | |
| 313 | - focaCrearCobranzaService | |
| 314 | - .enviarComprobantePorMail(res, cobranzaMail), | |
| 315 | - focaCrearCobranzaService | |
| 316 | - .actualizarEmail(res, cliente.COD) | |
| 317 | - ]); | |
| 318 | - }) | |
| 319 | - .then(function() { | |
| 320 | - focaModalService.alert('Mensaje enviado correctamente'); | |
| 321 | - }); | |
| 303 | + enviarMail(cobranzaMail); | |
| 322 | 304 | |
| 323 | 305 | focaSeguimientoService.guardarPosicion( |
| 324 | 306 | 'Cobranza', |
| ... | ... | @@ -400,7 +382,8 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 400 | 382 | var clienteMayus = { |
| 401 | 383 | COD: cliente.cod, |
| 402 | 384 | NOM: cliente.nom, |
| 403 | - CUIT: cliente.cuit | |
| 385 | + CUIT: cliente.cuit, | |
| 386 | + MAIL: cliente.mail | |
| 404 | 387 | }; |
| 405 | 388 | |
| 406 | 389 | $scope.$broadcast('addCabecera', { |
| ... | ... | @@ -780,5 +763,24 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 780 | 763 | delete $localStorage.cobranza; |
| 781 | 764 | } |
| 782 | 765 | } |
| 766 | + | |
| 767 | + function enviarMail(recibo) { | |
| 768 | + focaModalService.mail( | |
| 769 | + { | |
| 770 | + titulo: 'Enviar recibo', | |
| 771 | + descarga: { | |
| 772 | + nombre: recibo.recibo.PVE + '-' + recibo.recibo.NCO + '.pdf', | |
| 773 | + url: '/mail/recibo/descargar', | |
| 774 | + }, | |
| 775 | + envio: { | |
| 776 | + mailCliente: recibo.cliente.MAIL, | |
| 777 | + url: '/mail/recibo', | |
| 778 | + }, | |
| 779 | + options: { | |
| 780 | + recibo: recibo | |
| 781 | + } | |
| 782 | + } | |
| 783 | + ); | |
| 784 | + } | |
| 783 | 785 | } |
| 784 | 786 | ]); |
src/js/service.js
| ... | ... | @@ -14,10 +14,6 @@ angular.module('focaCrearCobranza') |
| 14 | 14 | getCobradorById: function(id) { |
| 15 | 15 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); |
| 16 | 16 | }, |
| 17 | - enviarComprobantePorMail: function(mail, data) { | |
| 18 | - return $http.post(API_ENDPOINT.URL + '/mail/comprobante', | |
| 19 | - {receiver: mail, comprobante: data}); | |
| 20 | - }, | |
| 21 | 17 | actualizarEmail: function(mail, idCliente) { |
| 22 | 18 | return $http.post(API_ENDPOINT.URL + '/cliente/update/email', |
| 23 | 19 | {mail: mail, id: idCliente}); |