Commit f4a501cbc9d624a62a099e9db0c7c1901213f009
Exists in
master
Merge branch 'develop' into 'master'
Develop See merge request !25
Showing
5 changed files
Show diff stats
src/js/controllerMail.js
File was created | 1 | angular.module('focaModal') | |
2 | .controller('focaModalMailController', [ | ||
3 | '$scope', | ||
4 | '$uibModalInstance', | ||
5 | 'FileSaver', | ||
6 | 'Blob', | ||
7 | 'focaModalService', | ||
8 | 'options', | ||
9 | function($scope, $uibModalInstance, FileSaver, Blob, | ||
10 | focaModalService, options) { | ||
11 | |||
12 | var regexMail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | ||
13 | $scope.descargado = false; | ||
14 | $scope.correoEnviado = false; | ||
15 | $scope.correoNoEnviado = false; | ||
16 | $scope.esperando = false; | ||
17 | $scope.titulo = options.titulo; | ||
18 | $scope.mailCliente = options.envio.mailCliente; | ||
19 | |||
20 | $scope.aceptar = function() { | ||
21 | $uibModalInstance.close(); | ||
22 | }; | ||
23 | $scope.salir = function() { | ||
24 | $uibModalInstance.close($scope.descargado); | ||
25 | }; | ||
26 | $scope.imprimir = function () { | ||
27 | $scope.descargado = true; | ||
28 | $scope.esperando = true; | ||
29 | focaModalService | ||
30 | .imprimirComprobante(options.descarga.url, options.options) | ||
31 | .then(function(res) { | ||
32 | var data = new Blob([res.data], {type: 'application/pdf'}); | ||
33 | |||
34 | FileSaver.saveAs( | ||
35 | data, | ||
36 | options.descarga.nombre | ||
37 | ); | ||
38 | $scope.esperando = false; | ||
39 | }); | ||
40 | }; | ||
41 | $scope.enviarCorreo = function(key) { | ||
42 | if (key === 13) { | ||
43 | if (!validarMail()) { | ||
44 | focaModalService.alert('Ingrese email/s válido/s'); | ||
45 | return; | ||
46 | } | ||
47 | $scope.descargado = true; | ||
48 | $scope.esperando = true; | ||
49 | Object.assign(options.options, {receiver: $scope.mailCliente}); | ||
50 | |||
51 | focaModalService | ||
52 | .enviarCorreo(options.envio.url, options.options) | ||
53 | .then(function() { | ||
54 | $scope.correoEnviado = true; | ||
55 | $scope.esperando = false; | ||
56 | }, function() { | ||
57 | $scope.esperando = false; | ||
58 | $scope.correoNoEnviado = true; | ||
59 | }); | ||
60 | } | ||
61 | }; | ||
62 | function validarMail() { | ||
63 | var emails = $scope.mailCliente.split(','); | ||
64 | var result = true; | ||
65 | emails.forEach(function(email) { | ||
66 | if (!regexMail.test(email.trim())) result = false; | ||
67 | }); | ||
68 | return result; | ||
69 | } | ||
70 | } | ||
71 | ]); | ||
72 |
src/js/controllerModal.js
1 | angular.module('focaModal') | 1 | angular.module('focaModal') |
2 | .controller('focaModalController', [ | 2 | .controller('focaModalController', [ |
3 | '$timeout', | 3 | '$timeout', |
4 | '$filter', | 4 | '$filter', |
5 | '$scope', | 5 | '$scope', |
6 | '$uibModalInstance', | 6 | '$uibModalInstance', |
7 | 'focaModalService', | 7 | 'focaModalService', |
8 | 'parametrosModal', | 8 | 'parametrosModal', |
9 | function($timeout, $filter, $scope, $uibModalInstance, focaModalService, parametrosModal) { | 9 | function($timeout, $filter, $scope, $uibModalInstance, focaModalService, parametrosModal) { |
10 | 10 | ||
11 | $scope.parametrosModal = parametrosModal; | 11 | $scope.parametrosModal = parametrosModal; |
12 | $scope.filters = parametrosModal.searchText || ''; | 12 | $scope.filters = parametrosModal.searchText || ''; |
13 | $scope.entidades = []; | 13 | $scope.entidades = []; |
14 | $scope.primerBusqueda = false; | 14 | $scope.primerBusqueda = false; |
15 | $scope.searchLoading = false; | 15 | $scope.searchLoading = false; |
16 | // pagination | 16 | // pagination |
17 | $scope.numPerPage = 10; | 17 | $scope.numPerPage = 10; |
18 | $scope.currentPage = 1; | 18 | $scope.currentPage = 1; |
19 | $scope.filteredEntidades = []; | 19 | $scope.filteredEntidades = []; |
20 | $scope.currentPageEntidades = []; | 20 | $scope.currentPageEntidades = []; |
21 | $scope.selectedEntidad = -1; | 21 | $scope.selectedEntidad = -1; |
22 | 22 | ||
23 | $scope.busquedaPress = function(key) { | 23 | $scope.busquedaPress = function(key) { |
24 | if (key === 13) { | 24 | if (key === 13) { |
25 | $scope.searchLoading = true; | 25 | $scope.searchLoading = true; |
26 | if (parametrosModal.query) { | 26 | if (parametrosModal.query) { |
27 | focaModalService.getEntidad( | 27 | focaModalService.getEntidad( |
28 | $scope.filters, | 28 | $scope.filters, |
29 | parametrosModal.query, | 29 | parametrosModal.query, |
30 | parametrosModal.tipo, | 30 | parametrosModal.tipo, |
31 | parametrosModal.json | 31 | parametrosModal.json |
32 | ).then( | 32 | ).then( |
33 | function(res) { | 33 | function(res) { |
34 | $scope.searchLoading = false; | 34 | $scope.searchLoading = false; |
35 | $scope.primerBusqueda = true; | 35 | $scope.primerBusqueda = true; |
36 | $scope.entidades = res.data; | 36 | $scope.entidades = res.data; |
37 | filtros($scope.entidades); | 37 | filtros($scope.entidades); |
38 | $scope.search(true); | 38 | $scope.search(true); |
39 | } | 39 | } |
40 | ); | 40 | ); |
41 | } else { | 41 | } else { |
42 | $scope.searchLoading = false; | 42 | $scope.searchLoading = false; |
43 | $scope.primerBusqueda = true; | 43 | $scope.primerBusqueda = true; |
44 | $scope.entidades = parametrosModal.data; | 44 | $scope.entidades = parametrosModal.data; |
45 | filtros($scope.entidades); | 45 | filtros($scope.entidades); |
46 | $scope.search(true); | 46 | $scope.search(true); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | }; | 49 | }; |
50 | function filtros(entidades) { | 50 | function filtros(entidades) { |
51 | for (var i = 0; i < $scope.parametrosModal.columnas.length; i++) { | 51 | for (var i = 0; i < $scope.parametrosModal.columnas.length; i++) { |
52 | var filtro = $scope.parametrosModal.columnas[i].filtro; | 52 | var filtro = $scope.parametrosModal.columnas[i].filtro; |
53 | if (filtro) { | 53 | if (filtro) { |
54 | if (filtro.nombre === 'comprobante') { | 54 | if (filtro.nombre === 'comprobante') { |
55 | for (var j = 0; j < entidades.length; j++) { | 55 | for (var j = 0; j < entidades.length; j++) { |
56 | var array = []; | 56 | var array = []; |
57 | $scope.parametrosModal.columnas[i].propiedad | 57 | $scope.parametrosModal.columnas[i].propiedad |
58 | .forEach(function(prop) { | 58 | .forEach(function(prop) { |
59 | array.push(entidades[j][prop]); | 59 | array.push(entidades[j][prop]); |
60 | }); | 60 | }); |
61 | entidades[j][$scope.parametrosModal.columnas[i].propiedad] = | 61 | entidades[j][$scope.parametrosModal.columnas[i].propiedad] = |
62 | $filter('comprobante')(array); | 62 | $filter('comprobante')(array); |
63 | } | 63 | } |
64 | } else { | 64 | } else { |
65 | for (var j = 0; j < entidades.length; j++) { | 65 | for (var j = 0; j < entidades.length; j++) { |
66 | entidades[j][$scope.parametrosModal.columnas[i].propiedad] = | 66 | entidades[j][$scope.parametrosModal.columnas[i].propiedad] = |
67 | $filter(filtro.nombre)(entidades[j][$scope | 67 | $filter(filtro.nombre)(entidades[j][$scope |
68 | .parametrosModal.columnas[i].propiedad], filtro.parametro); | 68 | .parametrosModal.columnas[i].propiedad], filtro.parametro); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |
73 | } | 73 | } |
74 | $scope.search = function(pressed) { | 74 | $scope.search = function(pressed) { |
75 | if ($scope.entidades.length > 0) { | 75 | if ($scope.entidades.length > 0) { |
76 | $scope.filteredEntidades = $filter('filter')( | 76 | $scope.filteredEntidades = $filter('filter')( |
77 | $scope.entidades, { $: $scope.filters } | 77 | $scope.entidades, { $: $scope.filters } |
78 | ); | 78 | ); |
79 | $scope.lastPage = Math.ceil( | 79 | $scope.lastPage = Math.ceil( |
80 | $scope.filteredEntidades.length / $scope.numPerPage | 80 | $scope.filteredEntidades.length / $scope.numPerPage |
81 | ); | 81 | ); |
82 | $scope.resetPage(); | 82 | $scope.resetPage(); |
83 | } else if (pressed) { | 83 | } else if (pressed) { |
84 | $timeout(function() { | 84 | $timeout(function() { |
85 | angular.element('#search')[0].focus(); | 85 | angular.element('#search')[0].focus(); |
86 | $scope.filters = ''; | 86 | $scope.filters = ''; |
87 | }); | 87 | }); |
88 | } | 88 | } |
89 | }; | 89 | }; |
90 | 90 | ||
91 | $scope.resetPage = function() { | 91 | $scope.resetPage = function() { |
92 | $scope.currentPage = 1; | 92 | $scope.currentPage = 1; |
93 | $scope.selectPage(1); | 93 | $scope.selectPage(1); |
94 | }; | 94 | }; |
95 | 95 | ||
96 | $scope.selectPage = function(page) { | 96 | $scope.selectPage = function(page) { |
97 | var start = (page - 1) * $scope.numPerPage; | 97 | var start = (page - 1) * $scope.numPerPage; |
98 | var end = start + $scope.numPerPage; | 98 | var end = start + $scope.numPerPage; |
99 | $scope.paginas = []; | 99 | $scope.paginas = []; |
100 | $scope.paginas = calcularPages(page); | 100 | $scope.paginas = calcularPages(page); |
101 | $scope.currentPageEntidades = $scope.filteredEntidades.slice(start, end); | 101 | $scope.currentPageEntidades = $scope.filteredEntidades.slice(start, end); |
102 | $scope.currentPage = page; | 102 | $scope.currentPage = page; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | $scope.select = function(vendedor) { | 105 | $scope.select = function(vendedor) { |
106 | $uibModalInstance.close(vendedor); | 106 | $uibModalInstance.close(vendedor); |
107 | }; | 107 | }; |
108 | 108 | ||
109 | $scope.cancel = function() { | 109 | $scope.cancel = function() { |
110 | $uibModalInstance.dismiss('cancel'); | 110 | $uibModalInstance.dismiss('cancel'); |
111 | }; | 111 | }; |
112 | 112 | ||
113 | $scope.busquedaDown = function(key) { | 113 | $scope.busquedaDown = function(key) { |
114 | if (key === 40) { | 114 | if (key === 40) { |
115 | primera(key); | 115 | primera(key); |
116 | } | 116 | } |
117 | }; | 117 | }; |
118 | 118 | ||
119 | $scope.itemEntidad = function(key) { | 119 | $scope.itemEntidad = function(key) { |
120 | if (key === 38) { | 120 | if (key === 38) { |
121 | anterior(key); | 121 | anterior(key); |
122 | } | 122 | } |
123 | if (key === 40) { | 123 | if (key === 40) { |
124 | siguiente(key); | 124 | siguiente(key); |
125 | } | 125 | } |
126 | if (key === 37) { | 126 | if (key === 37) { |
127 | retrocederPagina(); | 127 | retrocederPagina(); |
128 | } | 128 | } |
129 | if (key === 39) { | 129 | if (key === 39) { |
130 | avanzarPagina(); | 130 | avanzarPagina(); |
131 | } | 131 | } |
132 | }; | 132 | }; |
133 | $scope.esFecha = function(fecha) { | 133 | $scope.esFecha = function(fecha) { |
134 | if (fecha.includes('fecha')) { | 134 | if (fecha.includes('fecha')) { |
135 | return true; | 135 | return true; |
136 | } | 136 | } |
137 | return false; | 137 | return false; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | function calcularPages(paginaActual) { | 140 | function calcularPages(paginaActual) { |
141 | var paginas = []; | 141 | var paginas = []; |
142 | paginas.push(paginaActual); | 142 | paginas.push(paginaActual); |
143 | 143 | ||
144 | if (paginaActual - 1 > 1) { | 144 | if (paginaActual - 1 > 1) { |
145 | 145 | ||
146 | paginas.unshift(paginaActual - 1); | 146 | paginas.unshift(paginaActual - 1); |
147 | if (paginaActual - 2 > 1) { | 147 | if (paginaActual - 2 > 1) { |
148 | paginas.unshift(paginaActual - 2); | 148 | paginas.unshift(paginaActual - 2); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | if (paginaActual + 1 < $scope.lastPage) { | 151 | if (paginaActual + 1 < $scope.lastPage) { |
152 | paginas.push(paginaActual + 1); | 152 | paginas.push(paginaActual + 1); |
153 | if (paginaActual + 2 < $scope.lastPage) { | 153 | if (paginaActual + 2 < $scope.lastPage) { |
154 | paginas.push(paginaActual + 2); | 154 | paginas.push(paginaActual + 2); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | if (paginaActual !== 1) { | 157 | if (paginaActual !== 1) { |
158 | paginas.unshift(1); | 158 | paginas.unshift(1); |
159 | } | 159 | } |
160 | if (paginaActual !== $scope.lastPage) { | 160 | if (paginaActual !== $scope.lastPage) { |
161 | paginas.push($scope.lastPage); | 161 | paginas.push($scope.lastPage); |
162 | } | 162 | } |
163 | return paginas; | 163 | return paginas; |
164 | } | 164 | } |
165 | 165 | ||
166 | function primera() { | 166 | function primera() { |
167 | $scope.selectedEntidad = 0; | 167 | $scope.selectedEntidad = 0; |
168 | } | 168 | } |
169 | 169 | ||
170 | function anterior() { | 170 | function anterior() { |
171 | if ($scope.selectedEntidad === 0 && $scope.currentPage > 1) { | 171 | if ($scope.selectedEntidad === 0 && $scope.currentPage > 1) { |
172 | retrocederPagina(); | 172 | retrocederPagina(); |
173 | } else { | 173 | } else { |
174 | $scope.selectedEntidad--; | 174 | $scope.selectedEntidad--; |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | function siguiente() { | 178 | function siguiente() { |
179 | if($scope.selectedEntidad < $scope.currentPageEntidades.length - 1) { | 179 | if($scope.selectedEntidad < $scope.currentPageEntidades.length - 1) { |
180 | $scope.selectedEntidad++; | 180 | $scope.selectedEntidad++; |
181 | } else { | 181 | } else { |
182 | avanzarPagina(); | 182 | avanzarPagina(); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | function retrocederPagina() { | 186 | function retrocederPagina() { |
187 | if ($scope.currentPage > 1) { | 187 | if ($scope.currentPage > 1) { |
188 | $scope.selectPage($scope.currentPage - 1); | 188 | $scope.selectPage($scope.currentPage - 1); |
189 | $scope.selectedEntidad = $scope.numPerPage - 1; | 189 | $scope.selectedEntidad = $scope.numPerPage - 1; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | function avanzarPagina() { | 193 | function avanzarPagina() { |
194 | if ($scope.currentPage < $scope.lastPage) { | 194 | if ($scope.currentPage < $scope.lastPage) { |
195 | $scope.selectPage($scope.currentPage + 1); | 195 | $scope.selectPage($scope.currentPage + 1); |
196 | $scope.selectedEntidad = 0; | 196 | $scope.selectedEntidad = 0; |
197 | } | 197 | } |
198 | } | 198 | } |
199 | $scope.busquedaPress(13); | 199 | $scope.busquedaPress(13); |
200 | |||
201 | $scope.clearInput = function(){ | ||
202 | $scope.filters = ''; | ||
203 | }; | ||
200 | }] | 204 | }] |
201 | ); | 205 | ); |
202 | 206 |
src/js/service.js
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 | alert: function(textoModal) { | 20 | alert: function(textoModal) { |
21 | return $uibModal.open({ | 21 | return $uibModal.open({ |
22 | templateUrl: 'modal-alert.html', | 22 | templateUrl: 'modal-alert.html', |
23 | controller: 'focaModalAlertController', | 23 | controller: 'focaModalAlertController', |
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 | modal: function(parametrosModal) { | 34 | modal: function(parametrosModal) { |
35 | parametrosModal.size = (typeof parametrosModal.size === 'undefined') ? | 35 | parametrosModal.size = (typeof parametrosModal.size === 'undefined') ? |
36 | 'lg' : parametrosModal.size; | 36 | 'lg' : parametrosModal.size; |
37 | 37 | ||
38 | return $uibModal.open({ | 38 | return $uibModal.open({ |
39 | templateUrl: 'foca-modal.html', | 39 | templateUrl: 'foca-modal.html', |
40 | controller: 'focaModalController', | 40 | controller: 'focaModalController', |
41 | size: parametrosModal.size, | 41 | size: parametrosModal.size, |
42 | resolve: { | 42 | resolve: { |
43 | parametrosModal: function() { return parametrosModal; } | 43 | parametrosModal: function() { return parametrosModal; } |
44 | } | 44 | } |
45 | }) | 45 | }) |
46 | .result.then( | 46 | .result.then( |
47 | function(resultado) { | 47 | function(resultado) { |
48 | return resultado; | 48 | return resultado; |
49 | } | 49 | } |
50 | ); | 50 | ); |
51 | }, | 51 | }, |
52 | getEntidad: function(filters, query, tipo, json) { | 52 | getEntidad: function(filters, query, tipo, json) { |
53 | if (tipo === 'POST') { | 53 | if (tipo === 'POST') { |
54 | return $http.post(API_ENDPOINT.URL + query, json); | 54 | return $http.post(API_ENDPOINT.URL + query, json); |
55 | } else { | 55 | } else { |
56 | return $http.get(API_ENDPOINT.URL + query, {nombre: filters}); | 56 | return $http.get(API_ENDPOINT.URL + query, {nombre: filters}); |
57 | } | 57 | } |
58 | }, | 58 | }, |
59 | modalFecha: function(parametros) { | 59 | modalFecha: function(parametros) { |
60 | return $uibModal.open({ | 60 | return $uibModal.open({ |
61 | templateUrl: 'foca-fecha.html', | 61 | templateUrl: 'foca-fecha.html', |
62 | controller: 'focaModalFechaController', | 62 | controller: 'focaModalFechaController', |
63 | size: 'md', | 63 | size: 'md', |
64 | resolve: { | 64 | resolve: { |
65 | parametros: function() { return parametros; } | 65 | parametros: function() { return parametros; } |
66 | } | 66 | } |
67 | }) | 67 | }) |
68 | .result.then( | 68 | .result.then( |
69 | function(resultado) { | 69 | function(resultado) { |
70 | return resultado; | 70 | return resultado; |
71 | } | 71 | } |
72 | ); | 72 | ); |
73 | }, | 73 | }, |
74 | prompt: function(options) { | 74 | prompt: function(options) { |
75 | return $uibModal.open({ | 75 | return $uibModal.open({ |
76 | templateUrl: 'modal-prompt.html', | 76 | templateUrl: 'modal-prompt.html', |
77 | controller: 'focaModalPromptController', | 77 | controller: 'focaModalPromptController', |
78 | size: 'md', | 78 | size: 'md', |
79 | resolve: { | 79 | resolve: { |
80 | options: function() {return options;}, | 80 | options: function() {return options;}, |
81 | } | 81 | } |
82 | }) | 82 | }) |
83 | .result.then( | 83 | .result.then( |
84 | function(resultado) { | 84 | function(resultado) { |
85 | return resultado; | 85 | return resultado; |
86 | } | 86 | } |
87 | ); | 87 | ); |
88 | }, | ||
89 | mail: function(options) { | ||
90 | return $uibModal.open({ | ||
91 | templateUrl: 'modal-mail.html', | ||
92 | controller: 'focaModalMailController', | ||
93 | size: 'md', | ||
94 | resolve: { | ||
95 | options: function() {return options;}, | ||
96 | } | ||
97 | }) | ||
98 | .result.then( | ||
99 | function(resultado) { | ||
100 | return resultado; | ||
101 | } | ||
102 | ); | ||
103 | }, | ||
104 | imprimirComprobante: function(url, options) { | ||
105 | return $http.post( | ||
106 | API_ENDPOINT.URL + url, | ||
107 | options, | ||
108 | {responseType: 'arraybuffer'} | ||
109 | ); | ||
110 | }, | ||
111 | enviarCorreo: function(url, options) { | ||
112 | return $http.post(API_ENDPOINT.URL + url, options); | ||
88 | } | 113 | } |
89 | }; | 114 | }; |
90 | } | 115 | } |
91 | ]); | 116 | ]); |
92 | 117 |
src/views/foca-modal.html
1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> |
2 | <div class="row w-100"> | 2 | <div class="row w-100"> |
3 | <div ng-class="(parametrosModal.size == 'md') ? 'col-lg-12' : 'col-lg-6'"> | 3 | <div ng-class="(parametrosModal.size == 'md') ? 'col-lg-12' : 'col-lg-6'"> |
4 | <h5 class="modal-title my-1">{{parametrosModal.titulo}}</h5> | 4 | <h5 class="modal-title my-1">{{parametrosModal.titulo}}</h5> |
5 | <small ng-if="parametrosModal.subTitulo">{{parametrosModal.subTitulo}}</small> | 5 | <small ng-if="parametrosModal.subTitulo">{{parametrosModal.subTitulo}}</small> |
6 | </div> | 6 | </div> |
7 | <div class="input-group pr-0 my-2" ng-class="(parametrosModal.size == 'md') ? 'col-lg-12' : 'col-lg-6'"> | 7 | <div class="input-group pr-0 my-2" ng-class="(parametrosModal.size == 'md') ? 'col-lg-12' : 'col-lg-6'"> |
8 | <input | 8 | <input |
9 | type="text" | 9 | type="text" |
10 | class="form-control form-control-sm" | 10 | class="form-control form-control-sm" |
11 | id="search" | 11 | id="search" |
12 | placeholder="Busqueda" | 12 | placeholder="Busqueda" |
13 | ng-model="filters" | 13 | ng-model="filters" |
14 | ng-change="search()" | 14 | ng-change="search()" |
15 | ng-keydown="busquedaDown($event.keyCode)" | 15 | ng-keydown="busquedaDown($event.keyCode)" |
16 | ng-keypress="busquedaPress($event.keyCode)" | 16 | ng-keypress="busquedaPress($event.keyCode)" |
17 | foca-focus="selectedEntidad == -1" | 17 | foca-focus="selectedEntidad == -1" |
18 | ng-focus="selectedEntidad = -1" | 18 | ng-focus="selectedEntidad = -1" |
19 | teclado-virtual | 19 | teclado-virtual |
20 | > | 20 | > |
21 | <button | ||
22 | ng-show="filters.length >= 1" | ||
23 | type="button" | ||
24 | class="clear-input" | ||
25 | ng-click="clearInput()" | ||
26 | > | ||
27 | <i class="fa fa-times"></i> | ||
28 | </button> | ||
21 | <div class="input-group-append"> | 29 | <div class="input-group-append"> |
22 | <button | 30 | <button |
23 | ladda="searchLoading" | 31 | ladda="searchLoading" |
24 | data-spinner-color="#FF0000" | 32 | data-spinner-color="#FF0000" |
25 | class="btn btn-outline-secondary" | 33 | class="btn btn-outline-secondary" |
26 | type="button" | 34 | type="button" |
27 | ng-click="busquedaPress(13)" | 35 | ng-click="busquedaPress(13)" |
28 | > | 36 | > |
29 | <i class="fa fa-search" aria-hidden="true"></i> | 37 | <i class="fa fa-search" aria-hidden="true"></i> |
30 | </button> | 38 | </button> |
31 | </div> | 39 | </div> |
32 | </div> | 40 | </div> |
33 | </div> | 41 | </div> |
34 | </div> | 42 | </div> |
35 | <div class="modal-body" id="modal-body"> | 43 | <div class="modal-body" id="modal-body"> |
36 | 44 | ||
37 | <div ng-show="!primerBusqueda"> | 45 | <div ng-show="!primerBusqueda"> |
38 | Debe realizar una primer búsqueda. | 46 | Debe realizar una primer búsqueda. |
39 | </div> | 47 | </div> |
40 | 48 | ||
41 | <table ng-show="primerBusqueda" class="table table-striped table-sm col-12"> | 49 | <table ng-show="primerBusqueda" class="table table-striped table-sm col-12"> |
42 | <thead> | 50 | <thead> |
43 | <tr> | 51 | <tr> |
44 | <th ng-repeat="columna in parametrosModal.columnas" ng-bind="columna.nombre"></th> | 52 | <th ng-repeat="columna in parametrosModal.columnas" ng-bind="columna.nombre"></th> |
45 | <th></th> | 53 | <th></th> |
46 | </tr> | 54 | </tr> |
47 | </thead> | 55 | </thead> |
48 | <tbody> | 56 | <tbody> |
49 | <tr ng-show="currentPageEntidades.length == 0 && primerBusqueda"> | 57 | <tr ng-show="currentPageEntidades.length == 0 && primerBusqueda"> |
50 | <td colspan="3"> | 58 | <td colspan="3"> |
51 | No se encontraron resultados. | 59 | No se encontraron resultados. |
52 | </td> | 60 | </td> |
53 | </tr> | 61 | </tr> |
54 | <tr class="selected" | 62 | <tr class="selected" |
55 | ng-repeat="(key, entidad) in currentPageEntidades" | 63 | ng-repeat="(key, entidad) in currentPageEntidades" |
56 | ng-click="!parametrosModal.soloMostrar ? select(entidad) : null" | 64 | ng-click="!parametrosModal.soloMostrar ? select(entidad) : null" |
57 | > | 65 | > |
58 | <td | 66 | <td |
59 | ng-repeat="columna in parametrosModal.columnas" | 67 | ng-repeat="columna in parametrosModal.columnas" |
60 | ng-bind="entidad[columna.propiedad]"></td> | 68 | ng-bind="entidad[columna.propiedad]"></td> |
61 | <td class="d-md-none text-primary" ng-if="!parametrosModal.soloMostrar"> | 69 | <td class="d-md-none text-primary" ng-if="!parametrosModal.soloMostrar"> |
62 | <i class="fa fa-circle-thin" aria-hidden="true"></i> | 70 | <i class="fa fa-circle-thin" aria-hidden="true"></i> |
63 | </td> | 71 | </td> |
64 | <td class="d-none d-md-table-cell" ng-if="!parametrosModal.soloMostrar"> | 72 | <td class="d-none d-md-table-cell" ng-if="!parametrosModal.soloMostrar"> |
65 | <button | 73 | <button |
66 | type="button" | 74 | type="button" |
67 | class="btn btn-xs p-1 float-right" | 75 | class="btn btn-xs p-1 float-right" |
68 | ng-class="{ | 76 | ng-class="{ |
69 | 'btn-secondary': selectedEntidad != key, | 77 | 'btn-secondary': selectedEntidad != key, |
70 | 'btn-primary': selectedEntidad == key | 78 | 'btn-primary': selectedEntidad == key |
71 | }" | 79 | }" |
72 | foca-focus="selectedEntidad == {{key}}" | 80 | foca-focus="selectedEntidad == {{key}}" |
73 | ng-keydown="itemEntidad($event.keyCode)"> | 81 | ng-keydown="itemEntidad($event.keyCode)"> |
74 | <i class="fa fa-circle-thin" aria-hidden="true"></i> | 82 | <i class="fa fa-circle-thin" aria-hidden="true"></i> |
75 | </button> | 83 | </button> |
76 | </td> | 84 | </td> |
77 | </tr> | 85 | </tr> |
78 | </tbody> | 86 | </tbody> |
79 | </table> | 87 | </table> |
80 | </div> | 88 | </div> |
81 | <div class="modal-footer py-1"> | 89 | <div class="modal-footer py-1"> |
82 | <nav ng-show="currentPageEntidades.length > 0 && primerBusqueda" class="mr-auto"> | 90 | <nav ng-show="currentPageEntidades.length > 0 && primerBusqueda" class="mr-auto"> |
83 | <ul class="pagination pagination-sm justify-content mb-0"> | 91 | <ul class="pagination pagination-sm justify-content mb-0"> |
84 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 92 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
85 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | 93 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> |
86 | <span aria-hidden="true">«</span> | 94 | <span aria-hidden="true">«</span> |
87 | <span class="sr-only">Anterior</span> | 95 | <span class="sr-only">Anterior</span> |
88 | </a> | 96 | </a> |
89 | </li> | 97 | </li> |
90 | <li | 98 | <li |
91 | class="page-item" | 99 | class="page-item" |
92 | ng-repeat="pagina in paginas" | 100 | ng-repeat="pagina in paginas" |
93 | ng-class="{'active': pagina == currentPage}" | 101 | ng-class="{'active': pagina == currentPage}" |
94 | > | 102 | > |
95 | <a | 103 | <a |
96 | class="page-link" | 104 | class="page-link" |
97 | href="javascript:void();" | 105 | href="javascript:void();" |
98 | ng-click="selectPage(pagina)" | 106 | ng-click="selectPage(pagina)" |
99 | ng-bind="pagina" | 107 | ng-bind="pagina" |
100 | ></a> | 108 | ></a> |
101 | </li> | 109 | </li> |
102 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 110 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
103 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | 111 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> |
104 | <span aria-hidden="true">»</span> | 112 | <span aria-hidden="true">»</span> |
105 | <span class="sr-only">Siguiente</span> | 113 | <span class="sr-only">Siguiente</span> |
106 | </a> | 114 | </a> |
107 | </li> | 115 | </li> |
108 | </ul> | 116 | </ul> |
109 | </nav> | 117 | </nav> |
110 | <button class="btn btn-sm btn-secondary my-1" type="button" ng-click="cancel()">Cancelar</button> | 118 | <button class="btn btn-sm btn-secondary my-1" type="button" ng-click="cancel()">Cancelar</button> |
111 | </div> | 119 | </div> |
112 | 120 |
src/views/modal-mail.html
File was created | 1 | <div class="modal-header"> | |
2 | <h5 ng-bind="titulo"></h5> | ||
3 | </div> | ||
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 | class="form-control col-9" | ||
16 | ng-model="mailCliente" | ||
17 | ng-keypress="enviarCorreo($event.keyCode)" | ||
18 | teclado-virtual/> | ||
19 | <button | ||
20 | type="button" | ||
21 | class="btn btn-primary ml-auto" | ||
22 | ng-click="enviarCorreo(13)" | ||
23 | ladda="esperando" | ||
24 | >Enviar</button> | ||
25 | </div> | ||
26 | </div> | ||
27 | <hr> | ||
28 | <div> | ||
29 | <label>Descargar comprobante en este dispositivo</label> | ||
30 | <button | ||
31 | class="btn btn-primary float-right" | ||
32 | ng-click="imprimir()" | ||
33 | ladda="esperando" | ||
34 | >Descargar</button> | ||
35 | </div> | ||
36 | </div> | ||
37 | <div class="modal-footer"> | ||
38 | <button | ||
39 | type="button" | ||
40 | class="btn btn-secondary" | ||
41 | ng-click="salir()" | ||
42 | ladda="esperando" | ||
43 | >Salir</button> | ||
44 | <button | ||
45 | type="button" | ||
46 | class="btn btn-primary" | ||
47 | ng-click="aceptar()" | ||
48 | ladda="esperando" | ||
49 | ng-disabled="!descargado" | ||
50 | >Aceptar</button> | ||
51 | </div> | ||
52 |