/**
* @ngdoc managers
* @name AvisoOperacionalManager
* @module s4c.managers.AvisoOperacionalManager
*
* @description
* `AvisoOperacionalManager` Componente para comunicação entre uma página html qualquer e o controller da diretiva
*
*
*/
(function () {
'use strict';
function BaseConhecimentoManager(MainState, MapaService) {
return {
'ativo': false,
'zindex': 30,
'data': {},
/**
* @method abrirDetalhamento
* @param {*} base
*/
'abrirDetalhamento': function (base) {
this.ativo = true;
var baseConhecimento = MainState.getDirective('baseConhecimento');
baseConhecimento.abrirDetalhamento(base);
},
/**
* @method carregar
* @param {*} id
*/
'carregar': function (id) {
this.ativo = true;
var baseConhecimento = MainState.getDirective('baseConhecimento');
baseConhecimento.loadBase(id);
},
/**
* @method abrir
*/
'abrir': function () {
var baseConhecimento = MainState.getDirective('baseConhecimento');
var self = this;
MapaService.colocarIcon(function (obj) {
self.ativo = true;
self.marker = obj;
baseConhecimento.ativo = true;
baseConhecimento.abrirBaseConhecimento(obj);
});
MainState.detalhamentosAtivos.baseConhecimento = this;
},
/**
* @method removeMarker
*/
'removeMarker': function () {
if (this.marker) {
this.marker.destroy();
}
},
/**
* @method teste
* @param {*} id
* @param {*} obj
*/
'teste': function (id, obj) {
this.ativo = true;
var baseConhecimento = MainState.getDirective('baseConhecimento');
baseConhecimento.testeCarregar(id, obj);
if (this.marker) {
this.marker.destroy();
}
MainState.detalhamentosAtivos.baseConhecimento = this;
},
'reload': function () {
// TODO: Remover
},
/**
* @method fechar
*/
'fechar': function () {
var baseConhecimento = MainState.getDirective('baseConhecimento');
this.ativo = false;
if (baseConhecimento) {
baseConhecimento.fecharBaseConhecimento();
}
delete MainState.detalhamentosAtivos.baseConhecimento;
}
};
}
BaseConhecimentoManager.$inject = ['MainState', 'MapaService'];
angular.module('s4c.managers')
.service('BaseConhecimentoManager', BaseConhecimentoManager);
})();