Commit 95334422e5241b30cc383c688f4d27756fe22644
1 parent
3bf21cb211
Exists in
master
and in
1 other branch
envia facturas por email
Showing
4 changed files
with
33 additions
and
8 deletions
 
Show diff stats
src/js/app.js
src/js/controller.js
| ... | ... | @@ -7,8 +7,9 @@ angular.module('focaModalFactura') | 
| 7 | 7 | 'focaModalFacturaService', | 
| 8 | 8 | 'parametrosFactura', | 
| 9 | 9 | '$uibModal', | 
| 10 | + 'focaModalService', | |
| 10 | 11 | function($filter, $scope, $uibModalInstance, | 
| 11 | - focaModalFacturaService, parametrosFactura, $uibModal | |
| 12 | + focaModalFacturaService, parametrosFactura, $uibModal, focaModalService | |
| 12 | 13 | ) { | 
| 13 | 14 | var fecha = new Date(); | 
| 14 | 15 | $scope.fechaHasta = new Date(); | 
| ... | ... | @@ -84,8 +85,7 @@ angular.module('focaModalFactura') | 
| 84 | 85 | controller: 'focaModalFacturaDetalleController', | 
| 85 | 86 | size: 'md', | 
| 86 | 87 | resolve: { | 
| 87 | - factura: factura, | |
| 88 | - cliente: parametrosFactura.cliente | |
| 88 | + factura: factura | |
| 89 | 89 | } | 
| 90 | 90 | } | 
| 91 | 91 | ); | 
| ... | ... | @@ -149,6 +149,17 @@ angular.module('focaModalFactura') | 
| 149 | 149 | } | 
| 150 | 150 | }; | 
| 151 | 151 | |
| 152 | + $scope.enviarMail = function(factura) { | |
| 153 | + focaModalService | |
| 154 | + .prompt('Ingrese email para enviar comprobante', factura.MAIL_COBRANZA) | |
| 155 | + .then(function(res) { | |
| 156 | + return focaModalFacturaService.enviarFacturaPorMail(res, factura); | |
| 157 | + }) | |
| 158 | + .then(function() { | |
| 159 | + focaModalService.alert('Mensaje enviado correctamente'); | |
| 160 | + }); | |
| 161 | + }; | |
| 162 | + | |
| 152 | 163 | function calcularPages(paginaActual) { | 
| 153 | 164 | var paginas = []; | 
| 154 | 165 | paginas.push(paginaActual); | 
src/js/service.js
| ... | ... | @@ -8,6 +8,10 @@ angular.module('focaModalFactura') | 
| 8 | 8 | return $http.get( | 
| 9 | 9 | API_ENDPOINT.URL + '/factura/cliente/' + idCliente + '/' + idMoneda + '/' + | 
| 10 | 10 | fechaDesde + '/' + fechaHasta); | 
| 11 | + }, | |
| 12 | + enviarFacturaPorMail: function(receiver, factura){ | |
| 13 | + return $http.post(API_ENDPOINT.URL + '/mail', | |
| 14 | + {receiver: receiver, factura: factura}); | |
| 11 | 15 | } | 
| 12 | 16 | }; | 
| 13 | 17 | } | 
src/views/foca-modal-factura.html
| ... | ... | @@ -26,13 +26,15 @@ | 
| 26 | 26 | </tr> | 
| 27 | 27 | <tr class="selectable" | 
| 28 | 28 | ng-repeat="(key, factura) in currentPageFacturas"> | 
| 29 | - <td>{{factura.numeroFactura}} {{factura.FECHA_COMPROBANTE | date : 'dd/MM/yyyy' : 'GMT'}}</td> | |
| 30 | - <td>{{(factura.TCO == 'FT') ? factura.NCU + ' - ' : ''}}{{factura.FEV | date : 'dd/MM/yyyy' : 'GMT'}}</td> | |
| 31 | - <td class="text-right"> | |
| 29 | + <td ng-click="factura.checked = !factura.checked">{{factura.numeroFactura}} {{factura.FECHA_COMPROBANTE | date : 'dd/MM/yyyy' : 'GMT'}}</td> | |
| 30 | + <td ng-click="factura.checked = !factura.checked">{{(factura.TCO == 'FT') ? factura.NCU + ' - ' : ''}}{{factura.FEV | date : 'dd/MM/yyyy' : 'GMT'}}</td> | |
| 31 | + <td class="text-right" | |
| 32 | + ng-click="factura.checked = !factura.checked"> | |
| 32 | 33 | {{ (factura.IPA_SHOW / parametrosFactura.cotizacion) | number:2 }} | 
| 33 | 34 | <span ng-class="{'invisible': factura.IPA >= 0}">-</span> | 
| 34 | 35 | </td> | 
| 35 | - <td class="text-right"> | |
| 36 | + <td class="text-right" | |
| 37 | + ng-click="factura.checked = !factura.checked"> | |
| 36 | 38 | {{ factura.saldo_show | number:2 }} | 
| 37 | 39 | <span ng-class="{'invisible': factura.saldo >= 0}">-</span> | 
| 38 | 40 | </td> | 
| ... | ... | @@ -51,6 +53,7 @@ | 
| 51 | 53 | <button | 
| 52 | 54 | class="btn p-1" | 
| 53 | 55 | ng-click="verFactura(factura)" | 
| 56 | + title="Ver comprobante" | |
| 54 | 57 | > | 
| 55 | 58 | <i class="fa fa-eye" aria-hidden="true"></i> | 
| 56 | 59 | </button> | 
| ... | ... | @@ -58,6 +61,8 @@ | 
| 58 | 61 | <td> | 
| 59 | 62 | <button | 
| 60 | 63 | class="btn p-1" | 
| 64 | + ng-click="enviarMail(factura)" | |
| 65 | + title="Enviar comprobante por mail" | |
| 61 | 66 | > | 
| 62 | 67 | <i class="fa fa-envelope-o" aria-hidden="true"></i> | 
| 63 | 68 | </button> |