service.js 1.19 KB
angular.module('focaBotoneraLateral')
    .service('focaBotoneraLateralService', function() {

        this.botones = {
            salir: false,
            cancelar: false,
            pausar: false,
            guardar: 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) {
            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
            });
        };
    });