PageSourceSearch

https://sis.glemt.org.br/Tema/Vendor/Potencia/2.0/assets/javascript/process.js?v=05

js glemt.org.br collected 2026-09-27 08:15:41 UTC 8,292 bytes, 290 lines download raw bytes

1(function ($) {
2  function clearForm(form) {
3    return function () {
4      var fields = form.find("[type=text], textarea");
5      fields.each(function (i, input) {
6        input.value = "";
7      });
8    };
9  }
10
11  $('[data-role=check-cpf]').on('blur', function () {
12    var cpf = this.value;
13    $.get('/check-cpf', { cpf: cpf }, function (response) {
14      if (response.retorno == 'livronegro') {
15        sisSetAlert('false', 'Este CPF está no livro negro')
16      } else if (response.retorno == 'existe') {
17        sisSetAlert('false', response.mensagem);
18      }
19    });
20  });
21
22  $('[data-role=check-cpf-site]').on('blur', function () {
23    var cpf = this.value;
24      $.get('?acao=validaCpf', { cpf: cpf }, function (response) {
25          if (response.retorno == 'existe') {
26              sisSetAlert('false', response.mensagem);
27          } else if (response.retorno == 'naoExiste') {
28            sisSetAlert('true', response.mensagem);
29          } else if (response.sucesso == 'false') {
30            sisSetAlert('false', response.retorno);
31          }
32      });
33    });
34
35  function registrarQuite(data) {
36    var data = data || {};
37    return $.post("", data);
38  }
39
40  function showModalQuite(brotherId, processId) {
41    var modal = $("#processModal");    
42    $.get('/quite/' + brotherId + '/get-form-motivo', function (data) { 
43      console.log('data', data);
44      var body = modal.find('.modal-body');
45      body.html(data);      
46      body.find("input[name=processId]").val(processId);
47      body.find("input[name=irmao_cod]").val(brotherId);
48      modal.on("hidden.bs.modal", clearForm(modal.find("form")));
49      modal.modal();      
50    });
51  }
52
53  function showModalIrregular(brotherId)
54  {
55    var modal = $("#processModal");
56
57    var submitBtn = $("#send-process");
58
59    submitBtn.off("click");
60    submitBtn.on("click", function (e) {
61      e.preventDefault();
62
63      var args = {
64        irmaoId: brotherId,
65        data: $("#data").val(),
66        motivo: $("#motivo").val(),
67        observacao: $("#observacao").val(),
68        grau_sessao: $("#grau_sessao").val(),
69      };
70
71      registrarQuite(args).
72        done(function (response) {
73          sisSetAlert("true", response.message);
74          modal.modal("hide");
75          location.reload();
76        }).
77        fail(function (err) {
78          sisSetAlert("false", err.responseJSON.message);
79          modal.modal("hide");
80        });
81    });    
82
83    modal.on("hidden.bs.modal", clearForm(modal.find("form")));
84    modal.modal();      
85  }
86
87  $("[data-role=quite-handler]").on("click", function (e) {
88    
89    e.preventDefault();
90
91    var brotherId = $(this).attr('data-id');
92    var processId = $(this).attr('data-process');    
93
94    showModalQuite(brotherId, processId);
95  });
96
97
98  $("[data-role=ex-oficio-handler]").on("click", function (e) {
99    
100    e.preventDefault();
101    
102    var brotherId = $(this).attr('data-id');
103    
104    $('input[name=irmao_cod]').val(brotherId);
105    
106    var modal = $('#processModal');
107    modal.on("hidden.bs.modal", clearForm(modal.find("form")));
108    modal.modal();
109  });
110
111  $("[data-role=irreg-handler]").on("click", function (e) {
112    
113    e.preventDefault();
114
115    var brotherId = $(this).attr('data-id');
116
117    $('input[name=irmao_cod]').val(brotherId);
118
119    showModalIrregular(brotherId);
120  });
121
122  $('[data-role=add-instalacao]').on('click', function () {
123    $btnAdd = $(this);
124    var $group = $btnAdd.parent().siblings('.irmao-mi-group').clone(); 
125    var btnRemove = "<div class='pull-right'>"
126    btnRemove += "<button type='button' data-role='remover-instalacao' ";
127    btnRemove += "class='btn btn-danger'>Remover</button></div>";    
128    $group.append(btnRemove);
129    $group.find('input').each(function (index, element) {
130      element.value = "";
131    });
132    $group.appendTo('.irmao-mi-append');
133    $(document).trigger('date-trigger');
134    $(document).trigger('uppercase-words');
135  });
136
137  $(document).on('click', '[data-role=remover-instalacao]', function () {
138    $btnRemove = $(this);
139    console.log($btnRemove, 'ola remove');
140    $btnRemove.parent().parent().remove();
141  });
142
143  $(document).on('change', '[data-role=trocar-loja]', function () {
144    $element = $(this);
145    $loja = $element.data('target-loja');
146    $potencia = $element.data('target-potencia');
147    $element.parent().parent().siblings($loja).toggle();
148    $element.parent().parent().siblings($potencia).toggle();
149  });  
150
151  $(document).on('change', '[data-role=trocar-loja-mi]', function () {
152    $element = $(this);
153    if ($element.val() !== '') {      
154      $element.parent().parent().parent().siblings('#sisFormIdirmao_mi_loja').hide();
155      $element.parent().parent().parent().siblings('#sisFormIdirmao_mi_potencia').hide();
156    } else {
157      $element.parent().parent().parent().siblings('#sisFormIdirmao_mi_loja').show();
158      $element.parent().parent().parent().siblings('#sisFormIdirmao_mi_potencia').show();
159    }
160  });  
161
162  $(document).on('date-trigger', function () {
163    $('[data-role=date]').mask('99/99/9999');
164  });
165
166  $(document).ready(function () {
167    $(document).trigger('date-trigger');
168  });
169
170  $('[data-role=confirm-reject]').on('click', function (e) {
171    var irmaoCod = $(this).data('irmaocod');
172    var lojaCod = $(this).data('lojacod');
173    var url = $(this).data('url');
174    var modal = $("#rejectModal");
175    
176    function getBoletimId() {
177      return new Promise(function (resolve, reject) {
178        var submitBtn = $("#pub-reject");
179        submitBtn.off("click");
180        submitBtn.on("click", function (e) {
181          e.preventDefault();
182          resolve($('#boletim_reg').val());
183        });        
184        modal.modal();        
185      });
186    }
187
188    function rejeitarProcesso(boletimCod) {
189      var xhr = $.post(url, {
190        boletimCod: boletimCod,
191        irmaoCod: irmaoCod,
192        lojaCod: lojaCod
193      }, null, 'json');
194      return Promise.resolve(xhr);
195    }
196
197    getBoletimId(irmaoCod, lojaCod)
198    .then(rejeitarProcesso)
199    .then(function (response) {
200      console.log(response);
201      if (response.sucesso == 'true') {
202        modal.modal("hide");
203        window.location.reload();
204        sisSetAlert('true', 'Rejeição publicada com sucesso');          
205      } else {
206        sisSetAlert('false', response.retorno);  
207      }
208    });
209  });
210
211  function showModal(id,brotherId) {
212    var modal = $(id);
213    modal.find('input[name=irmao_cod]').val(brotherId);
214    modal.modal();
215  }
216
217  $("[data-role=default-process]").on("click", function (e) {
218    e.preventDefault();
219    var brotherId = $(this).attr('data-id');
220    var id = $(this).attr('data-modal-id')
221    if (brotherId.length > 0) {      
222      showModal(id,brotherId);
223    } else {
224      sisSetAlert("false", "Selecione pelo menos um registro");
225    }
226  });  
227
228  $('[data-role=get-message]').on('click', function (e) {
229    e.preventDefault();
230    var messageId = $(this).data('id');
231    var modalId = $(this).data('modal-id');
232    var modal = $(modalId);
233    modal.modal();
234
235    $.ajax({
236      method: 'get',
237      url: '/get-content-message',
238      data: {
239        messageId: messageId
240      },
241      success: function (response) {
242        if (response.sucesso == 'true') {
243          modal.find('.modal-body').html(response.retorno);
244        } else {
245          sisSetAlert(response.sucesso, response.retorno);
246        }
247      }
248    });
249  });
250}(jQuery));
251
252function imprimirHistorico(processoCod, acao)
253{  
254    if (acao === undefined) {
255         var acao = "?acao=historico";
256    }
257
258    $.ajax({
259        type: "post", 
260        url: acao, 
261        data: {
262            processoCod: processoCod,
263            dados: true
264        }, 
265        dataType: "json",
266        beforeSend: addLoading()
267    }).done(function(ret) {
268        removeLoading();
269        var $target = $("#modal-historico");
270        $target.show();
271        $target.html(ret.retorno);
272        var extraCss = commaSeparated(currentStylesheets());
273        var cabecalho = $("#cabecalho-impressao").html();
274        
275        if (!$target.html().includes(cabecalho)) {                
276            $target.prepend(cabecalho);    
277        }
278
279        $target.printArea({
280          extraCss: extraCss
281        });
282
283        $target.hide();
284    })
285    .fail(function() {
286        removeLoading();
287        sisMsgFailPadrao();
288    });
289}
290

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.