app.controllers.js
4.66 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
'use strict';
angular.module('gestaoRiscosApp').controller('MenuController', function($cookies, $mdSidenav, comumService, $rootScope, $state){
var self = this;
init();
function init(){
/**
* Essa classe é adicionada automaticamente pela diretiva md-position-mode
* essa diretiva é necessária em cada md-menu para nao printar erro do angular material no console
* a remoção dessa classe é necessária para não alterar o tamanho do menu
*/
angular.element(".md-menu-bar-menu").removeClass("md-dense");
$rootScope.usuarioLogado = {permissoes: [], jurisdicoes: []};
//comumService.buscarUrlsMenusPorAmbiente().then(function(response){
// self.url = response.data;
//});
}
self.logout = function () {
window.location.href = '/gestaoriscos/api/logout';
};
self.openLink = function (link) {
window.open(link);
};
self.toggleMenu = function(){
$mdSidenav('left').toggle();
};
self.closeMenu = function(){
$mdSidenav('left').close();
};
var sections = [];
sections.push({
name: 'Imóvel',
type: 'heading',
children: [
{
name: 'Dados Gerais',
type: 'toggle',
pages: [{
name: 'Manter Dados do Imóvel',
state: 'inserirCadastro',
type: 'link'
}, {
name: 'Homologar Imóvel',
state: 'homologarImovel',
type: 'link'
}, {
name: 'Vetorizar terreno',
state: 'vetorizarTerreno',
type: 'link'
}, {
name: 'Consultar Imóvel',
state: 'imovelConsultar',
type: 'link'
}]
}, {
name: 'Dados Contábeis',
type: 'toggle',
pages: [
{
name: 'Manter Laudo de Avaliação',
state: 'manterLaudo',
type: 'link'
},
{
name: 'Atualizar valor do imóvel',
state: 'atualizarValor',
type: 'link'
},
{
name: 'Depreciar imóvel',
state: 'depreciarImovel',
type: 'link'
},
{
name: 'Manter valor da PVG',
state: 'manterValorPVG',
type: 'link'
},
{
name: 'Enviar dados contábeis ao SIAFI',
state: 'enviarDadosSiafi',
type: 'link'
}
]
}
]
});
sections.push({
name: 'License',
url: 'license',
type: 'link',
// Add a hidden section so that the title in the toolbar is properly set
hidden: true
});
self.menu = {
sections: sections,
selectSection: function(section){
self.openedSection = section;
},
toggleSelectSection: function(section){
self.openedSection = (self.openedSection === section ? null : section);
},
isSectionSelected: function(section){
return self.openedSection === section;
},
selectPage: function(section, page){
self.currentSection = section;
self.currentPage = page;
},
isPageSelected: function(page){
return self.currentPage === page;
}
};
// Methods used by menuLink and menuToggle directives
self.isOpen = isOpen;
self.isSelected = isSelected;
self.toggleOpen = toggleOpen;
self.autoFocusContent = false;
function isSelected(page){
return menu.isPageSelected(page);
}
function isSectionSelected(section){
var selected = false;
var openedSection = menu.openedSection;
if(openedSection === section){
selected = true;
}
else if(section.children){
section.children.forEach(function(childSection){
if(childSection === openedSection){
selected = true;
}
});
}
return selected;
}
function isOpen(section){
return menu.isSectionSelected(section);
}
function toggleOpen(section){
menu.toggleSelectSection(section);
}
});