-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeetings.js
150 lines (148 loc) · 4.63 KB
/
meetings.js
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
class Meetings {
constructor(wsClient, people) {
this._table = 'reunioes';
this._columns = [{
column: 'data',
type: 'text'
},
{
column: 'indicador1',
type: 'text'
},
{
column: 'indicador2',
type: 'text'
},
{
column: 'volante1',
type: 'text'
},
{
column: 'volante2',
type: 'text'
},
{
column: 'leitorEB',
type: 'text'
},
{
column: 'leitorA',
type: 'text'
},
{
column: 'palco',
type: 'text'
},
{
column: 'som',
type: 'text'
},
{
column: 'leitorB',
type: 'text'
},
{
column: 'conversa1',
type: 'text'
},
{
column: 'conversa1A',
type: 'text'
},
{
column: 'conversa2',
type: 'text'
},
{
column: 'conversa2A',
type: 'text'
},
{
column: 'estudoB',
type: 'text'
},
{
column: 'estudoBA',
type: 'text'
},
{
column: 'discurso',
type: 'text'
},
];
this._wsClient = wsClient;
this._people = people;
this._busy = [];
// Create an observer instance linked to the callback function
var observer = new MutationObserver((mutationsList) => {
var attrClass = mutationsList[0].target.getAttribute("class");
if (attrClass == "menuLink active") {
this.init();
}
});
var config = {
attributes: true
}
// Start observing the target node for configured mutations
observer.observe(document.getElementsByName('addMeeting')[0], config);
}
init() {
this.fillCombo('Indicador', 'dtIndicador', 'riIndicador1');
this.fillCombo('Indicador', 'dtIndicador', 'riIndicador2');
this.fillCombo('Volante', 'dtVolante', 'riVolante1');
this.fillCombo('Volante', 'dtVolante', 'riVolante2');
this.fillCombo('Leitor_Estudo_Bíblico', 'dtLeitorE', 'riLeitorEB');
this.fillCombo('Leitor_A_Sentinela', 'dtLeitorA', 'riLeitorA');
this.fillCombo('Palco', 'dtPalco', 'riPalco');
this.fillCombo('Som', 'dtSom', 'riSom');
this.fillCombo('Leitor_Bíblia', 'dtLeitorB', 'riLeitorB');
this.fillCombo('Conversa', 'dtConversa', 'riConversa1');
this.fillCombo('Conversa_Ajudante', 'dtConversaA', 'riConversa1A');
this.fillCombo('Conversa', 'dtConversa', 'riConversa2');
this.fillCombo('Conversa_Ajudante', 'dtConversaA', 'riConversa2A');
this.fillCombo('Estudo_Bíblico', 'dtEstudoBiblico', 'riEstudoB');
this.fillCombo('Estudo_Bíblico_Ajudante', 'dtEstudoBiblicoA', 'riEstudoBA');
this.fillCombo('Discurso', 'dtDiscurso', 'riDiscurso');
}
fillCombo(column, sortColumn, comboId) {
var node = document.getElementById(comboId);
this.removeOptions(node);
var value = 0;
var sorted = this._people.getAllSorted(column, sortColumn);
var busy = this._busy;
var firstNotBusy = true;
sorted.forEach(el => {
var found = this._busy.find(b => {
return b == el['Nome'];
});
if (found)
return;
if(firstNotBusy)
{
this._busy.push(el['Nome']);
firstNotBusy = false;
}
this.addOption(node, el['Nome'], value++, false);
});
busy.forEach(el => {
this.addOption(node, el, value++, true);
})
this.addOption(node, 'N/A', value++, false);
}
addOption(selectNode, textOption, value, busy) {
var option = document.createElement("option");
option.text = textOption;
option.value = value;
if(busy)
option.style += 'color:red';
selectNode.appendChild(option);
}
removeOptions(selectNode) {
while (selectNode.firstChild) {
selectNode.removeChild(selectNode.firstChild);
}
}
save() {
this._busy = [];
}
}