Commit 3bbfc92f71d5c3ca10891dc1e70b51f681785520
1 parent
9a2f135b9b
Exists in
master
reemplazo proyectos modales por modal service
Showing
1 changed file
with
80 additions
and
104 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -198,134 +198,110 @@ angular.module('focaBusquedaCliente') |
198 | 198 | }; |
199 | 199 | $scope.seleccionarIva = function(key) { |
200 | 200 | if(key === 13) { |
201 | - var modalInstance = $uibModal.open( | |
202 | - { | |
203 | - ariaLabelledBy: 'Búsqueda de responsabilidad ante el IVA', | |
204 | - templateUrl: 'modal-iva.html', | |
205 | - controller: 'focaModalIvaController', | |
206 | - size: 'md', | |
207 | - resolve: {filters: function() { | |
208 | - return $scope.cliente.iva.NOMBRE; | |
209 | - }} | |
210 | - } | |
211 | - ); | |
212 | - modalInstance.result.then(function(iva) { | |
213 | - $scope.cliente.iva = iva; | |
214 | - $timeout(function() { | |
215 | - $scope.focused = 9; | |
201 | + var query = '/iva'; | |
202 | + var columnas = { | |
203 | + nombre: ['Código', 'Nombre'], | |
204 | + propiedad: ['ID', 'NOM',] | |
205 | + }; | |
206 | + var titulo = 'Búsqueda de responsabilidad ante el IVA'; | |
207 | + focaModalService.modal(columnas, query, titulo, 'md').then( | |
208 | + function(iva) { | |
209 | + $scope.cliente.iva = iva; | |
210 | + $timeout(function() { | |
211 | + $scope.focused = 9; | |
212 | + }); | |
213 | + }, function() { | |
214 | + // funcion ejecutada cuando se cancela el modal | |
216 | 215 | }); |
217 | - }, function() { | |
218 | - //TODO: función llamada cuando cancela el modal | |
219 | - }); | |
220 | 216 | } |
221 | 217 | }; |
222 | 218 | $scope.seleccionarActividad = function(key) { |
223 | 219 | if(key === 13) { |
224 | - var modalInstance = $uibModal.open( | |
225 | - { | |
226 | - ariaLabelledBy: 'Búsqueda de actividades', | |
227 | - templateUrl: 'modal-actividad.html', | |
228 | - controller: 'focaModalActividadController', | |
229 | - size: 'md', | |
230 | - resolve: {filters: function() { | |
231 | - return $scope.cliente.actividad.NOM; | |
232 | - }} | |
233 | - } | |
234 | - ); | |
235 | - modalInstance.result.then(function(actividad) { | |
236 | - $scope.cliente.actividad = actividad; | |
237 | - }, function() { | |
238 | - //TODO: función llamada cuando cancela el modal | |
239 | - }); | |
220 | + var query = '/actividad'; | |
221 | + var columnas = { | |
222 | + nombre: ['Código', 'Nombre'], | |
223 | + propiedad: ['ID', 'NOM',] | |
224 | + }; | |
225 | + var titulo = 'Búsqueda de actividades'; | |
226 | + focaModalService.modal(columnas, query, titulo, 'md').then( | |
227 | + function(actividad) { | |
228 | + $scope.cliente.actividad = actividad; | |
229 | + }, function() { | |
230 | + // funcion ejecutada cuando se cancela el modal | |
231 | + }); | |
240 | 232 | } |
241 | 233 | }; |
242 | 234 | $scope.seleccionarZona = function(key) { |
243 | 235 | if(key === 13) { |
244 | - var modalInstance = $uibModal.open( | |
245 | - { | |
246 | - ariaLabelledBy: 'Búsqueda de zonas', | |
247 | - templateUrl: 'modal-zona.html', | |
248 | - controller: 'focaModalZonaController', | |
249 | - size: 'md', | |
250 | - resolve: {filters: function() { | |
251 | - return $scope.cliente.zona.NOM; | |
252 | - }} | |
253 | - } | |
254 | - ); | |
255 | - modalInstance.result.then(function(zona) { | |
256 | - $scope.cliente.zona = zona; | |
257 | - $timeout(function() { | |
258 | - $scope.focused = 7; | |
236 | + var query = '/zona'; | |
237 | + var columnas = { | |
238 | + nombre: ['Código', 'Nombre'], | |
239 | + propiedad: ['ID', 'NOM',] | |
240 | + }; | |
241 | + var titulo = 'Búsqueda de zonas'; | |
242 | + focaModalService.modal(columnas, query, titulo, 'md').then( | |
243 | + function(zona) { | |
244 | + $scope.cliente.zona = zona; | |
245 | + $timeout(function() { | |
246 | + $scope.focused = 7; | |
247 | + }); | |
248 | + }, function() { | |
249 | + // funcion ejecutada cuando se cancela el modal | |
259 | 250 | }); |
260 | - }, function() { | |
261 | - //TODO: función llamada cuando cancela el modal | |
262 | - }); | |
263 | 251 | } |
264 | 252 | }; |
265 | 253 | $scope.seleccionarTipoFactura = function(key) { |
266 | 254 | if(key === 13) { |
267 | - var modalInstance = $uibModal.open( | |
268 | - { | |
269 | - ariaLabelledBy: 'Búsqueda de tipos de factura', | |
270 | - templateUrl: 'modal-tipo-factura.html', | |
271 | - controller: 'focaModalTipoFacturaController', | |
272 | - size: 'md', | |
273 | - resolve: {filters: function() { | |
274 | - return $scope.cliente.tipoFactura.NOMBRE; | |
275 | - }} | |
276 | - } | |
277 | - ); | |
278 | - modalInstance.result.then(function(tipoFactura) { | |
279 | - $scope.cliente.tipoFactura = tipoFactura; | |
280 | - $timeout(function() { | |
281 | - $scope.focused = 10; | |
255 | + var query = '/tipo-factura'; | |
256 | + var columnas = { | |
257 | + nombre: ['Código', 'Nombre'], | |
258 | + propiedad: ['ID', 'NOMBRE',] | |
259 | + }; | |
260 | + var titulo = 'Búsqueda de tipos de factura'; | |
261 | + focaModalService.modal(columnas, query, titulo, 'md').then( | |
262 | + function(tipoFactura) { | |
263 | + $scope.cliente.tipoFactura = tipoFactura; | |
264 | + $timeout(function() { | |
265 | + $scope.focused = 10; | |
266 | + }); | |
267 | + }, function() { | |
268 | + // funcion ejecutada cuando se cancela el modal | |
282 | 269 | }); |
283 | - }, function() { | |
284 | - //TODO: función llamada cuando cancela el modal | |
285 | - }); | |
286 | 270 | } |
287 | 271 | }; |
288 | 272 | $scope.seleccionarTipoComprobante = function(key) { |
289 | 273 | if(key === 13) { |
290 | - var modalInstance = $uibModal.open( | |
291 | - { | |
292 | - ariaLabelledBy: 'Búsqueda de tipos de comprobante', | |
293 | - templateUrl: 'modal-tipo-comprobante.html', | |
294 | - controller: 'focaModalTipoComprobanteController', | |
295 | - size: 'md', | |
296 | - resolve: {filters: function() { | |
297 | - return $scope.cliente.tipoComprobante.NOMBRE; | |
298 | - }} | |
299 | - } | |
300 | - ); | |
301 | - modalInstance.result.then(function(tipoComprobante) { | |
302 | - $scope.cliente.tipoComprobante = tipoComprobante; | |
303 | - $timeout(function() { | |
304 | - $scope.focused = 12; | |
274 | + var query = '/tipo-comprobante'; | |
275 | + var columnas = { | |
276 | + nombre: ['Código', 'Nombre'], | |
277 | + propiedad: ['ID', 'NOMBRE',] | |
278 | + }; | |
279 | + var titulo = 'Búsqueda de tipos de comprobante'; | |
280 | + focaModalService.modal(columnas, query, titulo, 'md').then( | |
281 | + function(tipoComprobante) { | |
282 | + $scope.cliente.tipoComprobante = tipoComprobante; | |
283 | + $timeout(function() { | |
284 | + $scope.focused = 12; | |
285 | + }); | |
286 | + }, function() { | |
287 | + // funcion ejecutada cuando se cancela el modal | |
305 | 288 | }); |
306 | - }, function() { | |
307 | - //TODO: función llamada cuando cancela el modal | |
308 | - }); | |
309 | 289 | } |
310 | 290 | }; |
311 | 291 | $scope.seleccionarFormaPago = function(key) { |
312 | 292 | if(key === 13) { |
313 | - var modalInstance = $uibModal.open( | |
314 | - { | |
315 | - ariaLabelledBy: 'Búsqueda de formas de pago', | |
316 | - templateUrl: 'modal-forma-pago.html', | |
317 | - controller: 'focaModalFormaPagoController', | |
318 | - size: 'md', | |
319 | - resolve: {filters: function() { | |
320 | - return $scope.cliente.formaPago.NOMBRE; | |
321 | - }} | |
322 | - } | |
323 | - ); | |
324 | - modalInstance.result.then(function(formaPago) { | |
325 | - $scope.cliente.formaPago = formaPago; | |
326 | - }, function() { | |
327 | - //TODO: función llamada cuando cancela el modal | |
328 | - }); | |
293 | + var query = '/forma-pago'; | |
294 | + var columnas = { | |
295 | + nombre: ['Código', 'Nombre'], | |
296 | + propiedad: ['ID', 'NOMBRE',] | |
297 | + }; | |
298 | + var titulo = 'Búsqueda de formas de pago'; | |
299 | + focaModalService.modal(columnas, query, titulo, 'md').then( | |
300 | + function(formaPago) { | |
301 | + $scope.cliente.formaPago = formaPago; | |
302 | + }, function() { | |
303 | + // funcion ejecutada cuando se cancela el modal | |
304 | + }); | |
329 | 305 | } |
330 | 306 | }; |
331 | 307 |