PageSourceSearch

https://somoscooperativismo-ba.coop.br/assets/js/transparencia_sescoop_antiga.js

js somoscooperativismo-ba.coop.br collected 2026-10-08 11:00:33 UTC 13,408 bytes, 413 lines download raw bytes

1$ = jQuery.noConflict();
2$(document).ready(function () {
3    var protocolo = window.location.protocol;
4    var host = window.location.host;
5    var linkCss = protocolo+ '//' + host + '/assets/css/transparencia_sescoop_antigas.css';
6    $('head').append('<link rel="stylesheet" type="text/css" href="'+linkCss+'">');
7
8    var url = $(location).attr("href");
9    var splitUrl = url.split("/");
10    var splitedDomain = splitUrl[2].split(".");
11    var arrDomninio = (splitUrl[2].indexOf('-') > -1) ? splitUrl[2].split("-")[1].split('.') : '';
12
13    if(url.indexOf('paranacooperativo') > -1){
14        ufDominio = '-pr';
15        arrDomninio = {0:'ba'};
16    }
17
18    var arrSutipos = {
19        'na' : {
20            652: [73, 72, 71, 70, 69, 81],
21            669: [75, 74, 82],
22            653: [41, 20, 19, 83],
23            670: [76, 49, 5, 3, 58],
24            666: [38, 57, 39],
25            659: [77, 11, 63, 55],
26            654: [43, 42, 60],
27            665: [34, 33],
28            671: [78, 79]
29        },
30        'ba' : {
31            3:  [10, 11, 12],
32            2:  [36, 29, 9, 8, 7, 6],
33            9:  [35, 28, 27],
34            1:  [5, 4, 3, 2, 4],
35            5:  [14, 13],
36            12: [33],
37            6:  [18, 17, 16, 15],
38            7:  [21, 20, 19],
39            4:  [],
40            8:  [34, 30, 26, 25, 23, 22]
41        },
42        'ce' : {
43            3:  [10, 11, 12],
44            2:  [36, 29, 9, 8, 7, 6],
45            9:  [35, 28, 27],
46            1:  [5, 4, 3, 2, 4],
47            5:  [14, 13],
48            12: [33],
49            6:  [18, 17, 16, 15],
50            7:  [21, 20, 19],
51            4:  [],
52            8:  [34, 30, 26, 25, 23, 22]
53        },
54        'df' : {
55            1:  [30, 27],
56            2:  [26, 25, 24, 23],
57            3:  [31, 22, 21, 20],
58            4:  [19, 18, 17, 16],
59            5:  [14, 15],
60            6:  [],
61            7:  [11,12,13],
62            8:  [6, 8, 9, 10],
63            9:  [1, 2, 3, 4, 5],
64            10: [29]
65        }
66    };
67
68    $ufIndice = {
69        "AC": 1,
70        "AL": 2,
71        "AP": 3,
72        "AM": 4,
73        "BA": 5,
74        "CE": 6,
75        "DF": 7,
76        "ES": 8,
77        "GO": 9,
78        "MA": 10,
79        "MT": 11,
80        "MS": 12,
81        "MG": 13,
82        "PA": 14,
83        "PB": 15,
84        "PR": 16,
85        "PE": 17,
86        "PI": 18,
87        "RJ": 19,
88        "RN": 20,
89        "RS": 21,
90        "RO": 22,
91        "RR": 23,
92        "SC": 24,
93        "SP": 25,
94        "SE": 26,
95        "TO": 27
96      };
97
98    arrSutipos = (typeof arrDomninio[0] !== 'undefined' && typeof arrSutipos[arrDomninio[0]] !== 'undefined')
99        ? arrSutipos[arrDomninio[0]]
100        : arrSutipos['na'];
101
102    $('#tiposDocumento').on('change', function(){
103        $('#subtiposDocumento').children('option').hide();
104        
105        if($(this).val() != ''){
106            $.each(arrSutipos[$(this).val()], function(k,id){
107                $('#subtiposDocumento').children('option[value="'+id+'"]').show();
108            })
109        }else{
110            $('#subtiposDocumento').children('option').show();
111        }
112
113    });
114
115    var ufUrl = (url.indexOf('uf=') > -1) ? 
116        (   
117            url.indexOf('&')> -1 ? 
118            url.split('uf=')[1].split('&')[0] : 
119            url.split('uf=')[1] 
120        ) :  '';
121    
122    var anoUrl = (url.indexOf('ano=') > -1) ? 
123        (   
124            url.indexOf('&')> -1 ? 
125            url.split('ano=')[1].split('&')[0] : 
126            url.split('ano=')[1] 
127        ) :  '';
128    
129    if(ufUrl != '' || anoUrl != ''){
130        if(ufUrl != ''){
131            $('#estados').val($ufIndice[ufUrl]);
132        }
133
134        if(anoUrl != ''){
135            $('#ano-transparencia').val(anoUrl);
136        }
137
138        encontrar();
139    }
140
141});
142
143function encontrar(){    
144    var url = $(location).attr("href");
145    var splitUrl = url.split("/");
146    var splitedDomain = splitUrl[2].split(".");
147    var arrDomninio = (splitUrl[2].indexOf('-') > -1) ? splitUrl[2].split("-")[1].split('.') : '';
148    var ufDominio = (typeof arrDomninio[0] != 'undefined') ? '-'+arrDomninio[0] : '';
149
150    if(url.indexOf('paranacooperativo') > -1){
151        ufDominio = '-pr';
152        arrDomninio = {0:'ba'};
153    }
154
155    var urlTransparencia = 'https://api.somoscooperativismo'+ufDominio+'.coop.br/portal/transparencias-arquivo';
156    var urlTransparenciaSemSubtipo = 'https://api.somoscooperativismo'+ufDominio+'.coop.br/portal/transparencias-arquivo-semsubtipo';
157    var urlTransparenciaSubtipo = 'https://api.somoscooperativismo'+ufDominio+'.coop.br/portal/arquivotranspsubtipo';
158    var urlTiposDocumentos = 'https://api.somoscooperativismo'+ufDominio+'.coop.br/portal/subtiposdocumento/tiposdocumento';
159    
160    var objBusca = {
161        'buscaTransparencia' : true,
162        'estado' : $('#estados').val(),
163        'ano' : $('#ano-transparencia').val(),
164        'tipodocumento' : $('#tiposDocumento').val(),
165        'subtipodocumento' : $('#subtiposDocumento').val(),
166        'searchFields': 'name:like',
167        'search':'',
168        'sortedBy':'-id',
169        'orderBy':'name',
170        'per_page':'6',
171        'page':'1',
172        'empresa':'1',
173    };
174
175    var objBuscaSubtipo = {
176        'buscaTransparencia' : true,
177        'estado' : $('#estados').val(),
178        'ano' : $('#ano-transparencia').val(),
179        'idSubtype' : $('#subtiposDocumento').val(),
180        'idType' : $('#tiposDocumento').val(),
181        'searchFields': 'name:like',
182        'search':'',
183        'sortedBy':'-id',
184        'orderBy':'name',
185        'per_page':'9999',
186        'page':'1',
187        'empresa':'1',
188    };
189
190    var arrSutipos = {
191        'na' : {
192            652: [73, 72, 71, 70, 69, 81],
193            669: [75, 74, 82],
194            653: [41, 20, 19, 83],
195            670: [76, 49, 5, 3, 58],
196            666: [38, 57, 39],
197            659: [77, 11, 63, 55],
198            654: [43, 42, 60],
199            665: [34, 33],
200            671: [78, 79]
201        },
202        'ba' : {
203            3:  [10, 11, 12],
204            2:  [36, 29, 9, 8, 7, 6],
205            9:  [35, 28, 27],
206            1:  [5, 4, 3, 2, 4],
207            5:  [14, 13],
208            12: [33],
209            6:  [18, 17, 16, 15],
210            7:  [21, 20, 19],
211            4:  [],
212            8:  [34, 30, 26, 25, 23, 22]
213        },
214        'ce' : {
215            3:  [10, 11, 12],
216            2:  [36, 29, 9, 8, 7, 6],
217            9:  [35, 28, 27],
218            1:  [5, 4, 3, 2, 4],
219            5:  [14, 13],
220            12: [33],
221            6:  [18, 17, 16, 15],
222            7:  [21, 20, 19],
223            4:  [],
224            8:  [34, 30, 26, 25, 23, 22]
225        },
226        'df' : {
227            1:  [30, 27],
228            2:  [26, 25, 24, 23],
229            3:  [31, 22, 21, 20],
230            4:  [19, 18, 17, 16],
231            5:  [14, 15],
232            6:  [],
233            7:  [11,12,13],
234            8:  [6, 8, 9, 10],
235            9:  [1, 2, 3, 4, 5],
236            10: [29]
237        }
238    };
239
240    arrSutipos = (typeof arrDomninio[0] !== 'undefined' && typeof arrSutipos[arrDomninio[0]] !== 'undefined')
241        ? arrSutipos[arrDomninio[0]]
242        : arrSutipos['na'];
243  
244    $('.box-listagem-anteriores').html('<ul class="listaTipoDocumento"></ul>');
245    var tipoId = '';
246    var retorno = '';
247    if(
248        $('#tiposDocumento').val() == ''
249        && $('#subtiposDocumento').val() == ''
250    ){
251        tipoId = '';
252        retorno = 'semTipo';
253        $.get(urlTransparencia,
254            objBusca,
255            function (data) {
256                $.each(data.data, function(k,obj){      
257                    adicionarLinha(obj.subtiposdocumento.id);       
258                    
259                    if(obj.arquivos.length > 0){
260                        $.each(obj.arquivos, function(k,objA){
261                            adicionarArquivos(objA, obj.subtiposdocumento.id);                    
262                        })
263                    }else{
264                        $('.suTipo'+obj.subtiposdocumento.id).html("Nenhum arquivo encontrado!")
265                    }                            
266                })
267                
268            }
269        ).then(function(){                
270            inicializarLista();  
271        });
272    }else if(
273        $('#tiposDocumento').val() != ''
274        && $('#subtiposDocumento').val() == ''
275    ){
276        tipoId = $('#tiposDocumento').val();
277        retorno = 'comTipo';
278        $.each(arrSutipos[$('#tiposDocumento').val()], function(l,id){
279            var objBuscaSubtipo = {
280                'buscaTransparencia' : true,
281                'estado' : $('#estados').val(),
282                'ano' : $('#ano-transparencia').val(),
283                'idType' : $('#tiposDocumento').val(),
284                'idSubtype' : id,
285                'searchFields': 'name:like',
286                'search':'',
287                'sortedBy':'-id',
288                'orderBy':'name',
289                'per_page':'9999',
290                'page':'1',
291                'empresa':'1',
292            };
293            
294            adicionarLinha(id);
295
296            $.get(urlTransparenciaSubtipo,
297                objBuscaSubtipo,
298                function (data) {
299                    if(data.data.length > 0){
300                        $.each(data.data, function(l,obj){
301                            adicionarArquivos(obj, id)  
302                        })
303                    }else{
304                        $('.suTipo'+id).html("Nenhum arquivo encontrado!");
305                        $('.suTipo'+id).hide();
306                    }
307                }
308            ).then(function(){
309                inicializarLista();  
310            });
311            inicializarLista();
312        });
313    }else if(
314        $('#tiposDocumento').val() != ''
315        && $('#subtiposDocumento').val() != ''
316    ){
317        var id = $('#subtiposDocumento').val();
318        tipoId = $('#tiposDocumento').val();
319        retorno = 'comTipo';
320        adicionarLinha(id);
321        $.get(urlTransparenciaSubtipo,
322            objBuscaSubtipo,
323            function (data) {
324                if(data.data.length > 0){
325                    $.each(data.data, function(l,obj){
326                        adicionarArquivos(obj, id)  
327                    })
328                }else{
329                    $('.suTipo'+id).html("Nenhum arquivo encontrado!")
330                }
331            }
332        ).then(function(){
333            inicializarLista();                
334        });
335        inicializarLista();
336    }
337
338}
339
340function ucwords(str, force) {
341    str = force ? str.toLowerCase() : str;
342    return str.replace(/(\b)([a-zA-Z])/g,
343        function (firstLetter) {
344            return firstLetter.toUpperCase();
345        });
346}
347
348function adicionarLinha(id){
349    var html = '';
350    html = html + '<li class="linha suTipo'+id+'" onclick="ativarSafona(this)">'+$('#subtiposDocumento').children('option[value="'+id+'"]').text()+
351        '<ul class="listaDocumentos"></ul></li>';                    
352    $('.listaTipoDocumento').append(html);
353}
354
355function adicionarArquivos(objA, id) {
356    var url = $(location).attr("href");
357    var splitUrl = url.split("/");
358    var splitedDomain = splitUrl[2].split(".");
359    var arrDomninio = (splitUrl[2].indexOf('-') > -1) ? splitUrl[2].split("-")[1].split('.') : '';
360    var ufDominio = (typeof arrDomninio[0] != 'undefined') ? '-'+arrDomninio[0] : '';
361
362    if(url.indexOf('paranacooperativo') > -1){
363        ufDominio = '-pr';
364        arrDomninio = {0:'ba'};
365    }
366
367    if(typeof objA == 'object' && objA != null){
368        var lista = '';            
369        lista = lista + '<li class="linhaArquivo">'+
370        '<a href="https://api.somoscooperativismo'+ufDominio+'.coop.br/portal/arquivotransparencia/arquivo/get/'+objA.id+'" target="_blank" >'+
371            objA.descricao+
372            '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">'+
373                '<g id="icon" transform="translate(0 -0.351)">'+
374                    '<circle id="Elipse_183" data-name="Elipse 183" cx="12" cy="12" r="12" transform="translate(0 0.351)" fill="#fff"/>'+
375                    '<g id="Grupo_465" data-name="Grupo 465" transform="translate(4 4)">'+
376                        '<path id="Frames-24px" d="M0,0H16V16H0Z" transform="translate(0)" fill="none"/>'+
377                        '<path id="Icon_open-data-transfer-download" data-name="Icon open-data-transfer-download" d="M5.137,0V5.137H1.712L6.85,10.275l5.137-5.137H8.562V0ZM0,11.987V13.7H13.7V11.987Z" transform="translate(1.3 1.15)" fill="#171c66"/>'+
378                    '</g>'+
379                '</g>'+
380            '</svg>'+
381        '</a></li>'; 
382        $('li.suTipo'+id+' .listaDocumentos').append(lista); 
383    } else {              
384        $('li.suTipo'+id).remove();
385    }
386}
387
388function ativarSafona(elem){
389    $('.linhaArquivo').hide();
390    if(!$(elem).children('.listaDocumentos').is(':visible')){
391        $(elem).children('.listaDocumentos').show();
392        $(elem).children('.listaDocumentos').children('.linhaArquivo').show();
393    }else{
394        $(elem).children('.listaDocumentos').hide();  
395    }  
396}
397
398function inicializarLista(){
399    $('.listaDocumentos').hide();
400    $('.linhaArquivo').show();
401}
402
403/*function ativarSafona(){    
404    $('.listaDocumentos').hide();
405    $('.linhaArquivo').show();
406    $('.linha').click(function(){
407        $('.listaDocumentos').hide();
408        if(!$(this).children('.listaDocumentos').is(':visible'))
409            $(this).children('.listaDocumentos').show();
410        else
411            $(this).children('.listaDocumentos').hide();
412    })
413}*/

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.