Commit ac228012b3d12d4371b2188bb6696119dc448114
Exists in
master
and in
1 other branch
Merge branch 'develop' into 'master'
Develop See merge request !7
Showing
1 changed file
Show diff stats
src/js/controller.js
... | ... | @@ -5,11 +5,11 @@ angular.module('focaModalResumenCuenta') |
5 | 5 | '$scope', |
6 | 6 | '$uibModalInstance', |
7 | 7 | 'focaModalResumenCuentaService', |
8 | - 'idCliente', | |
8 | + 'cliente', | |
9 | 9 | '$uibModal', |
10 | 10 | 'focaModalService', |
11 | 11 | function($timeout, $filter, $scope, $uibModalInstance, |
12 | - focaModalResumenCuentaService, idCliente, $uibModal, focaModalService) { | |
12 | + focaModalResumenCuentaService, cliente, $uibModal, focaModalService) { | |
13 | 13 | var fecha = new Date(); |
14 | 14 | $scope.generado = false; |
15 | 15 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); |
... | ... | @@ -20,7 +20,7 @@ angular.module('focaModalResumenCuenta') |
20 | 20 | |
21 | 21 | $scope.generar = function() { |
22 | 22 | focaModalResumenCuentaService |
23 | - .getResumenCuenta(idCliente, $scope.fechaDesde) | |
23 | + .getResumenCuenta(cliente.COD, $scope.fechaDesde) | |
24 | 24 | .then(function(res) { |
25 | 25 | res.data.facturas = calcularSaldos(res.data.facturas); |
26 | 26 | $scope.generado = true; |
... | ... | @@ -39,34 +39,41 @@ angular.module('focaModalResumenCuenta') |
39 | 39 | }; |
40 | 40 | |
41 | 41 | $scope.enviarMail = function(factura) { |
42 | - focaModalService | |
43 | - .prompt({ | |
44 | - titulo: 'Ingrese los emails separados por coma para enviar comprobante', | |
45 | - value: factura.cliente.MAIL, | |
46 | - email: true | |
47 | - }) | |
48 | - .then(function(res) { | |
49 | - return focaModalResumenCuentaService.enviarFacturaPorMail(res, factura); | |
50 | - }) | |
51 | - .then(function() { | |
52 | - focaModalService.alert('Mensaje enviado correctamente'); | |
53 | - }); | |
42 | + focaModalService.mail( | |
43 | + { | |
44 | + titulo: 'Enviar comprobante', | |
45 | + descarga: { | |
46 | + nombre: factura.numeroFactura + '.pdf', | |
47 | + url: '/mail/comprobante/descargar', | |
48 | + }, | |
49 | + envio: { | |
50 | + mailCliente: cliente.MAIL, | |
51 | + url: '/mail/comprobante' | |
52 | + }, | |
53 | + options: { | |
54 | + factura: factura | |
55 | + } | |
56 | + } | |
57 | + ); | |
54 | 58 | }; |
55 | 59 | |
56 | 60 | $scope.enviarResumen = function() { |
57 | - focaModalService | |
58 | - .prompt({ | |
59 | - titulo: 'Ingrese los emails separados por coma para enviar comprobante', | |
60 | - value: $scope.results.facturas[0].cliente.MAIL, | |
61 | - email: true | |
62 | - }) | |
63 | - .then(function(res) { | |
64 | - return focaModalResumenCuentaService.enviarResumenPorMail(res, | |
65 | - $scope.results); | |
66 | - }) | |
67 | - .then(function() { | |
68 | - focaModalService.alert('Mensaje enviado correctamente'); | |
69 | - }); | |
61 | + focaModalService.mail( | |
62 | + { | |
63 | + titulo: 'Enviar resumen de cuenta', | |
64 | + descarga: { | |
65 | + nombre: 'resumen-de-cuenta.pdf', | |
66 | + url: '/mail/resumen-cuenta/descargar', | |
67 | + }, | |
68 | + envio: { | |
69 | + mailCliente: cliente.MAIL, | |
70 | + url: '/mail/resumen-cuenta', | |
71 | + }, | |
72 | + options: { | |
73 | + resumen: $scope.results | |
74 | + } | |
75 | + } | |
76 | + ); | |
70 | 77 | }; |
71 | 78 | |
72 | 79 | $scope.verFactura = function(factura) { |