service.js
1.55 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
angular.module('focaBotoneraLateral')
.service('focaBotoneraLateralService', function() {
this.botones = {
salir: false,
cancelar: false,
pausar: false,
guardar: false,
guardando: false,
funcionGuardar: undefined,
pathCancelar: undefined,
custom: []
};
this.showSalir = function(value) {
this.botones.custom = [];
this.botones.salir = value;
};
this.showPausar = function(value) {
this.botones.custom = [];
this.botones.pausar = value;
};
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');
};
});