Commit 18d689890fd986f471088b24062627c710e9768d

Authored by Benjamin Rodriguez
1 parent 2f3ef9cc66
Exists in develop

checkbox funciona para ambas opciones

src/js/controllerMail.js
... ... @@ -15,7 +15,6 @@ angular.module('focaModal')
15 15 $scope.correoNoEnviado = false;
16 16 $scope.esperando = false;
17 17 $scope.titulo = options.titulo;
18   - $scope.mailCliente = options.envio.mailCliente;
19 18 $scope.checkboxVar = false;
20 19  
21 20 $scope.aceptar = function () {
... ... @@ -26,11 +25,7 @@ angular.module('focaModal')
26 25 };
27 26 $scope.validarImpresion = function () {
28 27 var rutaComprobante;
29   - if ($scope.checkboxVar === true) {
30   - rutaComprobante = options.descargaSinValorizar;
31   - } else {
32   - rutaComprobante = options.descarga;
33   - }
  28 + rutaComprobante = $scope.checkboxVar === true ? options.descargaSinValorizar : options.descarga;
34 29 imprimir(rutaComprobante);
35 30 }
36 31 imprimir = function (rutaComprobante) {
... ... @@ -48,7 +43,12 @@ angular.module('focaModal')
48 43 $scope.esperando = false;
49 44 });
50 45 };
51   - $scope.enviarCorreo = function (key) {
  46 + $scope.enviarComprobante = function(){
  47 + var rutaEnvioComprobante;
  48 + rutaEnvioComprobante = $scope.checkboxVar === true ? options.envioSinValorizar : options.envio;
  49 + enviarCorreo(rutaEnvioComprobante, 13);
  50 + }
  51 + enviarCorreo = function (rutaEnvioComprobante, key) {
52 52 if (key === 13) {
53 53 if (!validarMail()) {
54 54 focaModalService.alert('Ingrese email/s válido/s');
... ... @@ -56,10 +56,11 @@ angular.module('focaModal')
56 56 }
57 57 $scope.descargado = true;
58 58 $scope.esperando = true;
  59 + $scope.mailCliente = rutaEnvioComprobante.mailCliente;
59 60 Object.assign(options.options, { receiver: $scope.mailCliente });
60 61  
61 62 focaModalService
62   - .enviarCorreo(options.envio.url, options.options)
  63 + .enviarCorreo(rutaEnvioComprobante.url, options.options)
63 64 .then(function () {
64 65 $scope.correoEnviado = true;
65 66 $scope.esperando = false;
... ... @@ -116,7 +116,6 @@ angular.module('focaModal')
116 116 );
117 117 },
118 118 imprimirComprobante: function(url, options) {
119   - console.log('imprimirComprobante', url, options);
120 119 return $http.post(
121 120 API_ENDPOINT.URL + url,
122 121 options,
... ... @@ -124,7 +123,6 @@ angular.module('focaModal')
124 123 );
125 124 },
126 125 enviarCorreo: function(url, options) {
127   - console.log('enviarCorreo', url, options);
128 126 return $http.post(API_ENDPOINT.URL + url, options);
129 127 }
130 128 };
src/views/modal-mail.html
... ... @@ -14,12 +14,12 @@
14 14 <input
15 15 class="form-control col-9"
16 16 ng-model="mailCliente"
17   - ng-keypress="enviarCorreo($event.keyCode)"
  17 + ng-keypress="enviarComprobante($event.keyCode)"
18 18 teclado-virtual/>
19 19 <button
20 20 type="button"
21 21 class="btn btn-enviar ml-auto"
22   - ng-click="enviarCorreo(13)"
  22 + ng-click="enviarComprobante(13)"
23 23 ladda="esperando"
24 24 >Enviar</button>
25 25 </div>
... ... @@ -28,16 +28,6 @@
28 28 <div>
29 29 <label>Descargar comprobante</label>
30 30 <div class="col my-1 d-flex justify-content-end">
31   - <div class="custom-control custom-checkbox my-auto mr-2">
32   - <input
33   - type="checkbox"
34   - class="custom-control-input"
35   - id="check"
36   - ng-click="checkboxVar = !checkboxVar">
37   - <label class="custom-control-label disable-selection" for="check">
38   - Combrobante sin valorizar
39   - </label>
40   - </div>
41 31 <button
42 32 class="btn btn-enviar float-right"
43 33 ng-click="validarImpresion()"
... ... @@ -47,6 +37,16 @@
47 37 </div>
48 38 </div>
49 39 <div class="modal-footer">
  40 + <div class="custom-control custom-checkbox my-auto mr-5">
  41 + <input
  42 + type="checkbox"
  43 + class="custom-control-input mr-5"
  44 + id="check"
  45 + ng-click="checkboxVar = !checkboxVar">
  46 + <label class="custom-control-label disable-selection" for="check">
  47 + Combrobante sin valorizar
  48 + </label>
  49 + </div>
50 50 <button
51 51 type="button"
52 52 class="btn btn-secondary"