PageSourceSearch

https://sis.glemt.org.br/Tema/Vendor/Potencia/2.0/assets/javascript/exaltacao.js

js glemt.org.br collected 2026-09-27 08:15:38 UTC 4,947 bytes, 172 lines download raw bytes

1(function ($) {
2  function showModal(irmaoIds) {
3    var modal = $("#processModal");
4
5    var submitBtn = $("#send-process");
6    submitBtn.off("click");
7    submitBtn.on("click", function (e) {
8      e.preventDefault();
9      var args = {
10        irmaoIds: irmaoIds,
11        data: $("#data").val(),
12        local: $("#local").val(),
13        observacao: $("#observacao").val()
14      };      
15
16      exaltar(args).
17        done(function (response) {          
18          sisSetAlert("true", response.message);
19          modal.modal("hide");
20          window.location.reload();
21        }).
22        fail(function (err) {          
23          sisSetAlert("false", err.responseJSON.message);
24        });
25    })
26    modal.modal();
27  }
28
29  function exaltar(data) {
30    var data = data || {};
31    return $.post("", data, "json");
32  }
33
34  $("[data-role=exaltacao]").on("click", function (e) {
35    e.preventDefault();
36
37    var checked = checkedControls(checks());
38
39    function brotherNames(brothers) {
40      var nameList = brothers.map(function (brother) {
41        return brother.getAttribute('data-name');
42      });
43
44      return nameList.join(', ');
45    }
46
47    var dontMeetInterstice = checked.filter(function (brother) {
48      var interstice = brother.getAttribute('data-interstice');
49
50      return interstice === "false";
51    });
52
53    var strictMode = this.getAttribute('data-strict-mode') == "true";
54
55    var superManager = this.getAttribute('data-super-manager') == "true";
56
57    if (!superManager) {
58      if (dontMeetInterstice.length > 0) {
59        if (strictMode) {
60          alert("Os irmãos: " + brotherNames(dontMeetInterstice) + " não cumprem o período de interstício para exaltação");
61        } else {
62         alert("Os irmãos: " + brotherNames(dontMeetInterstice) + " não cumprem o período de interstício para exaltação, o pedido pode ser enviado mas poderá ser recusado por esse motivo."); 
63        }
64      }            
65    }
66
67    if (checked.length > 0) {
68      showModal(checkedValues(checked));
69    } else {
70      sisSetAlert("false", "Selecione pelo menos um registro");
71    }
72  });
73  
74  $("[data-role=exaltacao-gleg]").on("click", function (e) {
75    e.preventDefault();
76
77    var checked = checkedControls(checks());
78
79    function brotherNames(brothers) {
80      var nameList = brothers.map(function (brother) {
81        return brother.getAttribute('data-name');
82      });
83
84      return nameList.join(', ');
85    }
86
87    var dontMeetInterstice = checked.filter(function (brother) {
88      var interstice = brother.getAttribute('data-interstice');
89
90      return interstice === "false";
91    });
92
93    var strictMode = this.getAttribute('data-strict-mode') == "true";
94
95    var superManager = this.getAttribute('data-super-manager') == "true";
96
97    if (!superManager) {
98      if (dontMeetInterstice.length > 0) {
99        if (strictMode) {
100          alert("Os irmãos: " + brotherNames(dontMeetInterstice) + " não cumprem o período de interstício para exaltação");
101        } else {
102         alert("Os irmãos: " + brotherNames(dontMeetInterstice) + " não cumprem o período de interstício para exaltação, o pedido pode ser enviado mas poderá ser recusado por esse motivo."); 
103        }
104      }            
105    }
106
107    if (checked.length == 1) {
108      showModalGleg(checkedValues(checked));
109    } else {
110      sisSetAlert("false", "Selecione apenas um registro");
111    }
112  });
113
114  function showModalGleg(irmaoIds) {
115    var modal = $("#processModal");
116
117    var submitBtn = $("#send-process");
118    submitBtn.off("click");
119    submitBtn.on("click", function (e) {
120      e.preventDefault();
121
122      var args = {
123        irmaoIds: irmaoIds,
124        data: $("#data").val(),
125        local: $("#local").val(),
126        observacao: $("#observacao").val()
127      };
128
129      var formData = new FormData();
130
131      var files = $('input[type=file]');
132
133      if (files.val() != "") {
134        files.each(function (index, file) {
135            var contentFile = file.files[0];
136            var id = $(this).attr('id');
137            console.log(contentFile, id);
138            if (contentFile) {
139                formData.append(id, contentFile, contentFile.name);
140            }
141        });
142
143        formData.append('irmaoId', irmaoIds);
144
145        var config = {
146            type: "post", 
147            url: "/salvar-documentos-exaltacao",
148            dataType: "json", 
149            data: formData,
150            processData: false,
151            contentType: false,
152        };
153
154        $.ajax(config).fail(function () {
155          sisSetAlert("false", "Erro ao fazer upload do pedido de aumento de salário");
156        });        
157      }
158
159      exaltar(args).done(function (response) {
160        sisSetAlert("true", response.message);
161        modal.modal("hide");
162        window.location.reload();
163      }).fail(function (err) {
164        var error = err.responseJSON;
165        sisSetAlert("false", error.message);
166      });
167    })
168
169    modal.modal();
170  }
171
172}(jQuery));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.