analise.js
1.84 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
/**
* Created by dario on 23/10/17.
*/
AnaliseProtocolo = {
atualizarProtocolo : function (codigo) {
$.ajax({
type: "PUT",
url: 'retirarAnalise/',
dataType: 'json',
charset: 'utf-8',
data : {
codigo : codigo
},
success: function (data) {
window.location.reload();
},
error: function (data) {
window.location.reload();
},
});
},
atualizarProtocoloReprovado : function (codigo) {
$.ajax({
type: "PUT",
url: 'retirarAnaliseReprovado/',
dataType: 'json',
charset: 'utf-8',
data : {
codigo : codigo
},
success: function (data) {
window.location.reload();
},
error: function (data) {
window.location.reload();
},
});
},
buscarFlagProtocolo : function (id) {
$.ajax({
type: "GET",
url: 'buscarFlag/'+id,
dataType: 'json',
charset: 'utf-8',
success: function (data) {
//console.log(data.data.observacao.present);
if(data.data.observacao.present == true){
AnaliseProtocolo.atualizarProtocoloReprovado(id);
}else{
AnaliseProtocolo.atualizarProtocolo(id);
}
},
error: function (data) {
console.log("Erro inesperado");
},
});
},
}
$( document ).ready(function() {
$( ".js-btn-open-analise" ).click(function() {
//AnaliseProtocolo.atualizarProtocolo($(this).attr('id'))
AnaliseProtocolo.buscarFlagProtocolo($(this).attr('id'))
});
});