-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm-js.html.txt
268 lines (191 loc) · 7.79 KB
/
Form-js.html.txt
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<script>
function Mensagem(){
this.Executar = function (){
var Largura = window.innerWidth;
var Altura = window.innerHeigth;
var Objetos = document.getElementById("Componentes");
var Caixa = document.getElementById("CaixaMensagem");
Objetos.style.display = "block";
Objetos.style.heigth = Altura+ "px";
Caixa.style.left = (Largura/2) - (550 * .5)+"px";
Caixa.style.top = "70px";
Caixa.style.display = "block";
document.getElementById("TituloMsg").innerHTML = "AVISO";
document.getElementById("CorpoMsg").innerHTML = "DESEJA REALMENTE EXCLUIR?";
document.getElementById("RodapeMsg").innerHTML = '<button class = "green" onclick= "Confirm.Sim()"> <b> <font color= "black" size = "5">Sim</font></b></button><button class = "red" onclick= "Confirm.Nao()"> <b><font color= "black" size = "5">Não</font></b></button>';
}
this.Nao = function (){
Fechar();
}
this.Sim = function (){
document.getElementById("RodapeMsg").innerHTML = '<button onclick= "Fechar()"> <b> <font color= "black" size = "5">Fechar</font></b></button>';
var criteriopesquisa = document.getElementById("Campo1").value;
if (criteriopesquisa.trim().length ==0){
document.getElementById("CorpoMsg").innerHTML = "CANCELADO. ID NÃO PODE SER VAZIO!";
}else{
google.script.run.withSuccessHandler(Carregar).ExcluirDados(criteriopesquisa);
function Carregar(retorno){
if (retorno != "Não encontrado!"){
document.getElementById("CorpoMsg").innerHTML = "EXCLUÍDO COM SUCESSO!";
Limpar();
}else{
document.getElementById("CorpoMsg").innerHTML = "REGISTRO NÃO ENCONTRADO!";
}
}
}
}
}
var Confirm = new Mensagem();
function caixaMsgbox(m){
var Largura = window.innerWidth;
var Altura = window.innerHeigth;
var Objetos = document.getElementById("Componentes");
var Caixa = document.getElementById("CaixaMensagem");
Objetos.style.display = "block";
Objetos.style.heigth = Altura+ "px";
Caixa.style.left = (Largura/2) - (550 * .5)+"px";
Caixa.style.top = "70px";
Caixa.style.display = "block";
document.getElementById("TituloMsg").innerHTML = "AVISO";
document.getElementById("CorpoMsg").innerHTML = m;
document.getElementById("RodapeMsg").innerHTML = '<button class = "orange" onclick= " Fechar()"> <b> <font color= "black" size = "5">Fechar</font></b></button>';
}
function Fechar(){
document.getElementById("CaixaMensagem").style.display = "none";
document.getElementById("Componentes").style.display = "none";
}
document.getElementById("btnpesquisar").addEventListener("click", Pesquisar);
function Pesquisar(){
var criteriopesquisa = document.getElementById("Campo1").value;
if (criteriopesquisa.trim().length == 0){
var m = "CRITÉRIO NÃO PODE SER VAZIO";
caixaMsgbox(m);
return false;
};
google.script.run.withSuccessHandler(Carregar).PesquisarDados(criteriopesquisa);
function Carregar(retorno){
if (retorno != "Não encontrado!"){
document.getElementById("Campo1").value = retorno[0]
M.updateTextFields();
document.getElementById("Campo2").value = retorno[1]
M.updateTextFields();
document.getElementById("Campo3").value = retorno[2]
M.updateTextFields();
document.getElementById("Campo4").value = retorno[3]
M.updateTextFields();
document.getElementById("Campo5").value = retorno[4]
M.updateTextFields();
document.getElementById("Campo6").value = retorno[5]
M.updateTextFields();
document.getElementById("Campo7").value = retorno[6]
M.updateTextFields();
document.getElementById("Campo8").value = retorno[7]
M.updateTextFields();
document.getElementById("Campo9").value = retorno[8]
M.updateTextFields();
document.getElementById("Campo10").value = retorno[9]
M.updateTextFields();
}else{
var m = "REGISTRO NÃO ENCONTRADO!";
caixaMsgbox(m);
Limpar();
}
}
}
document.getElementById("btnlimpar").addEventListener("click", Limpar);
function Limpar(){
document.getElementById("Campo1").value = "";
document.getElementById("Campo2").value = "";
document.getElementById("Campo3").value = "";
document.getElementById("Campo4").value = "";
document.getElementById("Campo5").value = "";
document.getElementById("Campo6").value = "";
document.getElementById("Campo7").value = "";
document.getElementById("Campo8").value = "";
document.getElementById("Campo9").value = "";
document.getElementById("Campo10").value = "";
}
document.getElementById("btnsalvar").addEventListener("click", Salvar);
function Salvar(){
var Campo1 = document.getElementById("Campo1").value;
var Campo2 = document.getElementById("Campo2").value;
var Campo3 = document.getElementById("Campo3").value;
var Campo4 = document.getElementById("Campo4").value;
var Campo5 = document.getElementById("Campo5").value;
var Campo6 = document.getElementById("Campo6").value;
var Campo7 = document.getElementById("Campo7").value;
var Campo8 = document.getElementById("Campo8").value;
var Campo9 = document.getElementById("Campo9").value;
var Campo10 = document.getElementById("Campo10").value;
if (Campo1.trim().length != 0){
var m = "CAMPO1 PRECISA SER VAZIO PORQUE É GERADO AUTOMATICAMENTE!";
caixaMsgbox(m);
return false;
}
if (Campo2.trim().length == 0 || Campo3.trim().length == 0 || Campo4.trim().length == 0 ||
Campo5.trim().length == 0 || Campo6.trim().length == 0 || Campo7.trim().length == 0 || Campo8.trim().length == 0 || Campo9.trim().length == 0 || Campo10.trim().length == 0){
var m = "PRECISA PREENCHER TODOS OS CAMPOS, EXCETO CAMPO1";
caixaMsgbox(m);
return;
}else{
var Dados ={
Campo2: Campo2,
Campo3: Campo3,
Campo4: Campo4,
Campo5: Campo5,
Campo6: Campo6,
Campo7: Campo7,
Campo8: Campo8,
Campo9: Campo9,
Campo10: Campo10,
};
google.script.run.withSuccessHandler(Salvar).SalvarDados(Dados);
function Salvar(retorno) {
var m = "SALVO COM SUCESSO!";
caixaMsgbox(m);
Limpar();
}
}
}
document.getElementById("btneditar").addEventListener("click", Editar);
function Editar(){
var Campo1 = document.getElementById("Campo1").value;
var Campo2 = document.getElementById("Campo2").value;
var Campo3 = document.getElementById("Campo3").value;
var Campo4 = document.getElementById("Campo4").value;
var Campo5 = document.getElementById("Campo5").value;
var Campo6 = document.getElementById("Campo6").value;
var Campo7 = document.getElementById("Campo7").value;
var Campo8 = document.getElementById("Campo8").value;
var Campo9 = document.getElementById("Campo9").value;
var Campo10 = document.getElementById("Campo10").value;
if (Campo1.trim().length == 0 || Campo2.trim().length == 0 || Campo3.trim().length == 0 || Campo4.trim().length == 0 || Campo5.trim().length == 0 || Campo6.trim().length == 0 || Campo7.trim().length == 0 || Campo8.trim().length == 0 || Campo9.trim().length == 0 || Campo10.trim().length == 0){
var m = "PRECISA PREENCHER TODOS OS CAMPOS!";
caixaMsgbox(m);
}else{
var Dados ={
Campo1: Campo1,
Campo2: Campo2,
Campo3: Campo3,
Campo4: Campo4,
Campo5: Campo5,
Campo6: Campo6,
Campo7: Campo7,
Campo8: Campo8,
Campo9: Campo9,
Campo10: Campo10,
};
google.script.run.withSuccessHandler(Editar).EditarDados(Dados);
function Editar(retorno) {
if(retorno != "ID não encontrado!" ){
var m = "EDITADO COM SUCESSO!";
caixaMsgbox(m);
Limpar();
}else{
var m = "REGISTRO NÃO ENCONTRADO";
caixaMsgbox(m);
}
}
}
}
</script>