Commit b56907ac131ca7c2afe06935aca28b359d6618ff

Authored by Benjamin Rodriguez
1 parent 0a2eccb4d7
Exists in master

logita para botonera de pausa

Showing 1 changed file with 77 additions and 77 deletions   Show diff stats
1 angular.module('focaBotoneraLateral') 1 angular.module('focaBotoneraLateral')
2 .service('focaBotoneraLateralService', ['$localStorage', 2 .service('focaBotoneraLateralService', ['$localStorage',
3 function($localStorage) { 3 function ($localStorage) {
4 4
5 this.botones = { 5 this.botones = {
6 teclado: true, 6 teclado: true,
7 salir: false, 7 salir: false,
8 cancelar: false, 8 cancelar: false,
9 pausar: false, 9 pausar: false,
10 guardar: false, 10 guardar: false,
11 guardando: false, 11 guardando: false,
12 funcionGuardar: undefined, 12 funcionGuardar: undefined,
13 pathCancelar: undefined, 13 pathCancelar: undefined,
14 custom: [] 14 custom: []
15 }; 15 };
16 16
17 this.pausarData = { 17 this.pausarData = {
18 label: '', 18 label: '',
19 val: '' 19 val: ''
20 }; 20 };
21 21
22 this.rutasPausadas = { 22 this.rutasPausadas = {
23 label: 'rutas', 23 label: 'rutas',
24 val: [] 24 val: []
25 }; 25 };
26 26
27 this.showTeclado = function(value) { 27 this.showTeclado = function (value) {
28 this.botones.teclado = value; 28 this.botones.teclado = value;
29 }; 29 };
30 this.showSalir = function(value) { 30 this.showSalir = function (value) {
31 this.botones.custom = []; 31 this.botones.custom = [];
32 this.botones.salir = value; 32 this.botones.salir = value;
33 }; 33 };
34 this.showPausar = function(value) { 34 this.showPausar = function (value) {
35 this.botones.custom = []; 35 this.botones.custom = [];
36 this.botones.pausar = value; 36 this.botones.pausar = value;
37 }; 37 };
38 this.setPausarData = function(obj) { 38 this.setPausarData = function (obj) {
39 this.pausarData = obj; 39 this.pausarData = obj;
40 }; 40 };
41 this.setRutasPausadas = function(obj) { 41 this.setRutasPausadas = function (obj) {
42 var auxArray = []; 42 var auxArray = [];
43 this.rutasPausadas.val.push(obj.val); 43 this.rutasPausadas.val.push(obj.val);
44 angular.forEach(this.rutasPausadas.val, function(ruta) { 44 angular.forEach(this.rutasPausadas.val, function (ruta) {
45 var exists = false; 45 var exists = false;
46 angular.forEach(auxArray, function(val2) { 46 angular.forEach(auxArray, function (val2) {
47 if(angular.equals(ruta, val2)){ exists = true }; 47 if (angular.equals(ruta, val2)) { exists = true };
48 });
49 if (exists == false && ruta !== "") { auxArray.push(ruta); }
48 }); 50 });
49 if(exists == false && ruta !== "") { auxArray.push(ruta); }
50 });
51
52 this.rutasPausadas.val = auxArray;
53 };
54 this.showCancelar = function(value, path) {
55 this.botones.custom = [];
56 this.botones.cancelar = value;
57 this.botones.pathCancelar = (path) ? path : undefined;
58 };
59 this.showGuardar = function(value, funcion) {
60 angular.element('#guardar').removeClass('guardado');
61 this.botones.custom = [];
62 this.botones.guardar = value;
63 if (value) this.botones.funcionGuardar = funcion;
64 };
65 this.addCustomButton = function(title, funcion) {
66 this.botones.custom.push({
67 title: title,
68 funcion: funcion
69 });
70 };
71 this.startGuardar = function() {
72 this.botones.guardando = true;
73 };
74 this.endGuardar = function(guardado) {
75 this.botones.guardando = false;
76 if (guardado) angular.element('#guardar').addClass('guardado');
77 };
78 51
79 this.setLSItem = function() { 52 this.rutasPausadas.val = auxArray;
80 $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val); 53 };
81 }; 54 this.showCancelar = function (value, path) {
55 this.botones.custom = [];
56 this.botones.cancelar = value;
57 this.botones.pathCancelar = (path) ? path : undefined;
58 };