service.js
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
angular.module('focaBotoneraLateral')
.service('focaBotoneraLateralService', ['$localStorage',
function($localStorage) {
this.botones = {
teclado: true,
salir: false,
cancelar: false,
pausar: false,
guardar: false,
guardando: false,
funcionGuardar: undefined,
pathCancelar: undefined,
custom: []
};
this.pausarData = {
label: '',
val: ''
};
this.showTeclado = function(value) {
this.botones.teclado = value;
};
this.showSalir = function(value) {
this.botones.custom = [];
this.botones.salir = value;
};
this.showPausar = function(value) {
this.botones.custom = [];
this.botones.pausar = value;
};
this.setPausarData = function(obj) {
this.pausarData = obj;
};
this.showCancelar = function(value, path) {
this.botones.custom = [];
this.botones.cancelar = value;
this.botones.pathCancelar = (path) ? path : undefined;
};
this.showGuardar = function(value, funcion) {
angular.element('#guardar').removeClass('guardado');
this.botones.custom = [];
this.botones.guardar = value;
if (value) this.botones.funcionGuardar = funcion;
};
this.addCustomButton = function(title, funcion) {
this.botones.custom.push({
title: title,
funcion: funcion
});
};
this.startGuardar = function() {
this.botones.guardando = true;
};
this.endGuardar = function(guardado) {
this.botones.guardando = false;
if (guardado) angular.element('#guardar').addClass('guardado');
};
this.setLSItem = function() {
$localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val);
};
}]);