Commit 9f2d599dd7c42a27fb5980125b5c7ffb50581fc6

Authored by Benjamin Rodriguez
1 parent a22a8c90dd
Exists in develop

evito cierre de modal al clickear fuera del mismo

1 angular.module('focaModal') 1 angular.module('focaModal')
2 .factory('focaModalService', [ 2 .factory('focaModalService', [
3 '$uibModal', 'API_ENDPOINT', '$http', 3 '$uibModal', 'API_ENDPOINT', '$http',
4 function($uibModal, API_ENDPOINT, $http) { 4 function($uibModal, API_ENDPOINT, $http) {
5 return { 5 return {
6 confirm: function(textoModal) { 6 confirm: function(textoModal) {
7 return $uibModal.open({ 7 return $uibModal.open({
8 templateUrl: 'modal-confirm.html', 8 templateUrl: 'modal-confirm.html',
9 controller: 'focaModalConfirmController', 9 controller: 'focaModalConfirmController',
10 animation: false, 10 animation: false,
11 backdrop: false, 11 backdrop: false,
12 resolve: { textoModal: function() { return textoModal; } } 12 resolve: { textoModal: function() { return textoModal; } }
13 }) 13 })
14 .result.then( 14 .result.then(
15 function(resultado) { 15 function(resultado) {
16 return resultado; 16 return resultado;
17 } 17 }
18 ); 18 );
19 }, 19 },
20 info: function(textoModal) { 20 info: function(textoModal) {
21 return $uibModal.open({ 21 return $uibModal.open({
22 templateUrl: 'modal-info.html', 22 templateUrl: 'modal-info.html',
23 controller: 'focaModalInfoController', 23 controller: 'focaModalInfoController',
24 animation: false, 24 animation: false,
25 backdrop: false, 25 backdrop: false,
26 resolve: { textoModal: function() { return textoModal; } } 26 resolve: { textoModal: function() { return textoModal; } }
27 }) 27 })
28 .result.then( 28 .result.then(
29 function(resultado) { 29 function(resultado) {
30 return resultado; 30 return resultado;
31 } 31 }
32 ); 32 );
33 }, 33 },
34 alert: function(textoModal) { 34 alert: function(textoModal) {
35 return $uibModal.open({ 35 return $uibModal.open({
36 templateUrl: 'modal-alert.html', 36 templateUrl: 'modal-alert.html',
37 controller: 'focaModalAlertController', 37 controller: 'focaModalAlertController',
38 animation: false, 38 animation: false,
39 backdrop: false, 39 backdrop: false,
40 resolve: { textoModal: function() { return textoModal; } } 40 resolve: { textoModal: function() { return textoModal; } }
41 }) 41 })
42 .result.then( 42 .result.then(
43 function(resultado) { 43 function(resultado) {
44 return resultado; 44 return resultado;
45 } 45 }
46 ); 46 );
47 }, 47 },
48 modal: function(parametrosModal) { 48 modal: function(parametrosModal) {
49 parametrosModal.size = (typeof parametrosModal.size === 'undefined') ? 49 parametrosModal.size = (typeof parametrosModal.size === 'undefined') ?
50 'lg' : parametrosModal.size; 50 'lg' : parametrosModal.size;
51 51
52 return $uibModal.open({ 52 return $uibModal.open({
53 templateUrl: 'foca-modal.html', 53 templateUrl: 'foca-modal.html',
54 controller: 'focaModalController', 54 controller: 'focaModalController',
55 size: parametrosModal.size, 55 size: parametrosModal.size,
56 resolve: { 56 resolve: {
57 parametrosModal: function() { return parametrosModal; } 57 parametrosModal: function() { return parametrosModal; }
58 } 58 }
59 }) 59 })
60 .result.then( 60 .result.then(
61 function(resultado) { 61 function(resultado) {
62 return resultado; 62 return resultado;
63 } 63 }
64 ); 64 );
65 }, 65 },
66 getEntidad: function(filters, query, tipo, json) { 66 getEntidad: function(filters, query, tipo, json) {
67 if (tipo === 'POST') { 67 if (tipo === 'POST') {
68 return $http.post(API_ENDPOINT.URL + query, json); 68 return $http.post(API_ENDPOINT.URL + query, json);
69 } else { 69 } else {
70 return $http.get(API_ENDPOINT.URL + query, {nombre: filters}); 70 return $http.get(API_ENDPOINT.URL + query, {nombre: filters});
71 } 71 }
72 }, 72 },
73 modalFecha: function(parametros) { 73 modalFecha: function(parametros) {
74 return $uibModal.open({ 74 return $uibModal.open({
75 templateUrl: 'foca-fecha.html', 75 templateUrl: 'foca-fecha.html',
76 controller: 'focaModalFechaController', 76 controller: 'focaModalFechaController',
77 size: 'md', 77 size: 'md',
78 resolve: { 78 resolve: {
79 parametros: function() { return parametros; } 79 parametros: function() { return parametros; }
80 } 80 }
81 }) 81 })
82 .result.then( 82 .result.then(
83 function(resultado) { 83 function(resultado) {
84 return resultado; 84 return resultado;
85 } 85 }
86 ); 86 );
87 }, 87 },
88 prompt: function(options) { 88 prompt: function(options) {
89 return $uibModal.open({ 89 return $uibModal.open({
90 templateUrl: 'modal-prompt.html', 90 templateUrl: 'modal-prompt.html',
91 controller: 'focaModalPromptController', 91 controller: 'focaModalPromptController',
92 size: 'md', 92 size: 'md',
93 resolve: { 93 resolve: {
94 options: function() {return options;}, 94 options: function() {return options;},
95 } 95 }
96 }) 96 })
97 .result.then( 97 .result.then(
98 function(resultado) { 98 function(resultado) {
99 return resultado; 99 return resultado;
100 } 100 }
101 ); 101 );
102 }, 102 },
103 mail: function(options) { 103 mail: function(options) {
104 return $uibModal.open({ 104 return $uibModal.open({
105 templateUrl: 'modal-mail.html', 105 templateUrl: 'modal-mail.html',
106 controller: 'focaModalMailController', 106 controller: 'focaModalMailController',
107 size: 'md', 107 size: 'md',
108 backdrop: false,
108 resolve: { 109 resolve: {
109 options: function() {return options;}, 110 options: function() {return options;},
110 } 111 }
111 }) 112 })
112 .result.then( 113 .result.then(
113 function(resultado) { 114 function(resultado) {
114 return resultado; 115 return resultado;
115 } 116 }
116 ); 117 );
117 }, 118 },
118 imprimirComprobante: function(url, options) { 119 imprimirComprobante: function(url, options) {
119 return $http.post( 120 return $http.post(
120 API_ENDPOINT.URL + url, 121 API_ENDPOINT.URL + url,
121 options, 122 options,
122 {responseType: 'arraybuffer'} 123 {responseType: 'arraybuffer'}
123 ); 124 );
124 }, 125 },
125 enviarCorreo: function(url, options) { 126 enviarCorreo: function(url, options) {
126 return $http.post(API_ENDPOINT.URL + url, options); 127 return $http.post(API_ENDPOINT.URL + url, options);
127 } 128 }
128 }; 129 };
129 } 130 }
130 ]); 131 ]);
131 132
src/views/modal-info.html
1 <div class="focus-in"> 1 <div class="focus-in">
2
3 <div class="modal-header"> 2 <div class="modal-header">
4 <h4>Información</h4> 3 <h4>Información</h4>
5 </div> 4 </div>
6
7 <div class="modal-body"> 5 <div class="modal-body">
8 <p ng-bind="textoModal" class="line-break m-0 pb-2"></p> 6 <p ng-bind="textoModal" class="line-break m-0 pb-2"></p>
9 <!-- La versión está tipeada, después habria que hacer que se haga una consulta y devuelva la versión --> 7 <!-- La versión está tipeada, después habria que hacer que se haga una consulta y devuelva la versión -->
10 <p class="m-0 border-bottom border-top pt-2 pb-2">DEBO® Distribuidores: Versión 2.0</p> 8 <p class="m-0 border-bottom border-top pt-2 pb-2">DEBO® Distribuidores: Versión 2.0</p>
11 <p class="mt-1">Ante un inconveniente con el sistema,</br> 9 <p class="mt-1">Ante un inconveniente con el sistema,</br>
12 comuniquese con nuestra <a href="http://focasoftware.com" target="__blank">mesa de ayuda</a></p> 10 comuniquese con nuestra <a href="http://focasoftware.com" target="__blank">mesa de ayuda</a></p>
13 <a href="http://focasoftware.com" target="__blank"> 11 <a href="http://focasoftware.com" target="__blank">
14 <img src="img/logo-foca.png" class="w-25 rounded mx-auto d-block mt-4"> 12 <img src="img/logo-foca.png" class="w-25 rounded mx-auto d-block mt-4">
15 </a> 13 </a>
16 </div> 14 </div>
17 <div class="modal-footer"> 15 <div class="modal-footer">
18 <button class="btn btn-primary" ng-click="aceptar()" foca-focus="true">Aceptar</button> 16 <button class="btn btn-primary" ng-click="aceptar()" foca-focus="true">Aceptar</button>
19 </div> 17 </div>
20 </div> 18 </div>
21 19
22 20
23 21
24 22
src/views/modal-mail.html
1 <div class="modal-header"> 1 <div class="modal-header" >
2 <h5 ng-bind="titulo"></h5> 2 <h5 ng-bind="titulo"></h5>
3 </div> 3 </div>
4 <div class="modal-body"> 4 <div class="modal-body">
5 <div >
6 <label
7 class="col-12 bg-success text-white"
8 ng-show="correoEnviado">Correo enviado con éxito</label>
9 <label
10 class="col-12 bg-danger text-white"
11 ng-show="correoNoEnviado">Hubo un error al enviar el correo</label>
12 <label>Enviar correo a</label>
13 <div class="d-flex">
14 <input
15 type="email"
16 class="form-control col-9"
17 ng-model="mailCliente"
18 ng-keypress="enviarComprobante($event.keyCode)"
19 teclado-virtual/>
20 <button
21 type="button"
22 class="btn btn-enviar ml-auto"
23 ng-click="enviarComprobante(13)"
24 ladda="esperando"
25 >Enviar</button>
26 </div>
27 </div>
28 <hr>
5 <div> 29 <div>
6 <label>Descargar comprobante</label> 30 <label>Descargar comprobante</label>
7 <div class="col my-1 d-flex justify-content-end"> 31 <div class="col my-1 d-flex justify-content-end">
8 <button 32 <button
9 class="btn btn-enviar float-right" 33 class="btn btn-enviar float-right"
10 ng-click="validarImpresion()" 34 ng-click="validarImpresion()"
11 ladda="esperando" 35 ladda="esperando"
12 >Descargar</button> 36 >Descargar</button>
13 </div> 37 </div>
14 </div> 38 </div>
15 </div> 39 </div>
16 <div class="modal-footer"> 40 <div class="modal-footer">
17 <div class="custom-control custom-checkbox my-auto mr-5"> 41 <div class="custom-control custom-checkbox my-auto mr-5">
18 <input 42 <input
19 type="checkbox" 43 type="checkbox"
20 class="custom-control-input mr-5" 44 class="custom-control-input mr-5"
21 id="check" 45 id="check"
22 ng-click="checkboxVar = !checkboxVar"> 46 ng-click="checkboxVar = !checkboxVar">
23 <label class="custom-control-label disable-selection" for="check"> 47 <label class="custom-control-label disable-selection" for="check">
24 Combrobante sin valorizar 48 Combrobante sin valorizar
25 </label> 49 </label>
26 </div> 50 </div>
27 <button 51 <button
28 type="button" 52 type="button"
29 class="btn btn-secondary" 53 class="btn btn-secondary"
30 ng-click="salir()" 54 ng-click="salir()"
31 ladda="esperando" 55 ladda="esperando"
32 >Salir</button> 56 >Salir</button>
33 <button 57 <button
34 type="button" 58 type="button"
35 class="btn btn-primary" 59 class="btn btn-primary"
36 ng-click="aceptar()" 60 ng-click="aceptar()"
37 ladda="esperando" 61 ladda="esperando"
38 ng-disabled="!descargado" 62 ng-disabled="!descargado"
39 >Aceptar</button> 63 >Aceptar</button>
40 </div> 64 </div>
65 </div>
41 66