PageSourceSearch

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

js somoscooperativismo-ba.coop.br collected 2026-10-08 11:00:47 UTC 6,559 bytes, 184 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
9function encontrar() {
10    var ano = $('#ano').val();
11    var tipo = $('#tipo-contrato').val();
12    var tipoEscolha = '';
13
14    switch (parseInt(tipo)) {
15        case 1:
16            tipoEscolha = 'Atas de Pregão Presencial';
17            break;
18        case 2:
19            tipoEscolha = 'Cadastramento de Pessoas Jurídicas';
20            break;
21        case 3:
22            tipoEscolha = 'Concorência';
23            break;
24        case 4:
25            tipoEscolha = 'Contratação de empresa';
26            break;
27        case 5:
28            tipoEscolha = 'Licitações';
29            break;
30        case 6:
31            tipoEscolha = 'Leilão Presencial';
32            break;
33        case 7:
34            tipoEscolha = 'Pregão Eletrônico';
35            break;
36        case 8:
37            tipoEscolha = 'Pregão Presencial';
38            break;
39        default:
40            tipoEscolha = '';
41            break;
42    }
43
44    var arrSutipos = {
45        1: ['Atas de Pregão Presencial'],
46        2: ['Cadastramento de Pessoas Jurídicas'],
47        3: ['Concorência'],
48        4: ['Contratação de empresa'],
49        5: ['Licitações'],
50        6: ['Leilão Presencial'],
51        7: ['Pregão Eletrônico'],
52        8: ['Pregão Presencial']
53    };
54
55    console.log(tipoEscolha);
56    console.log(ano);
57
58    $('.box-listagem-anteriores').html('<ul class="listaTipoDocumento"></ul>');
59
60    if (tipoEscolha != '' && ano != '') {
61        montarTabela(tipoEscolha, ano);
62        console.log('tipo escolha e ano selecionados');
63    } else if (tipoEscolha != '' && ano == '') {
64            console.log('tipo escolha selecionado e ano vazio');
65            montarTabela(tipoEscolha, '');
66    } else if (tipoEscolha == '' && ano != '') {
67        console.log('tipo escolha vazio e ano selecionado');
68            montarTabela('', ano);
69    } else {
70        $.each(arrSutipos, function (k, id) {
71            console.log('tipo escolha e ano vazios', k, id);
72
73            montarTabela(id, null);
74        });
75    }
76}
77
78function montarTabela(tipo, ano) {
79    console.log('montarTabela', tipo, ano);
80    $.post('/index.php?option=com_licitacoes_sescoop_antiga&view=licitaessescoopantigas&start=5', {
81        'filter[tipodocumento]': tipo,
82        'filter[data]': ano,
83        'list[fullordering]' : 'id DESC',
84        'list[limit]': 0
85    }, function (data) {
86        console.log(data);
87        recuperaDadosLicitacoes(data, tipo, ano);
88    });
89}
90
91function adicionarLinhaSofona(tipo) {
92    var tipoId = normalizeString(tipo);
93    var html = '<li class="suTipo' + tipoId + '" onclick="ativarSafona(\'suTipo' + tipoId + '\')">' + tipo +
94        '<ul class="listaDocumentos"></ul></li>';
95    $('.listaTipoDocumento').append(html);
96}
97
98function ativarSafona(tipoId) {
99    if (!$('.' + tipoId).children('ul').children('li').is(':visible')) {
100        $('.active').removeClass('active');
101        $('.' + tipoId).children('ul').children('li').addClass('active');
102    } else {
103        $('.active').removeClass('active');
104    }
105}
106
107function adicionarArquivos(tipo, arquivo, nomeOriginal) {
108    var tipoId = normalizeString(tipo);
109    var url = $(location).attr("href");
110    var lista = '';
111    lista += '<li>' +
112        '<a href="' + url + '/' + arquivo + '" target="_blank">' +
113        nomeOriginal +
114        '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">' +
115        '<g id="icon" transform="translate(0 -0.351)">' +
116        '<circle id="Elipse_183" data-name="Elipse 183" cx="12" cy="12" r="12" transform="translate(0 0.351)" fill="#fff"/>' +
117        '<g id="Grupo_465" data-name="Grupo 465" transform="translate(4 4)">' +
118        '<path id="Frames-24px" d="M0,0H16V16H0Z" transform="translate(0)" fill="none"/>' +
119        '<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"/>' +
120        '</g>' +
121        '</g>' +
122        '</svg>' +
123        '</a></li>';
124    $('.suTipo' + tipoId + ' .listaDocumentos').append(lista);
125}
126
127function recuperaDadosLicitacoes(data, tipoSelecionado, ano) {
128    var tabela = data.split('<tbody>')[1].split('</tbody>')[0];
129    var agrupadosPorTipo = {};
130
131    // Se nenhum tipo específico for selecionado, adicionar opção "Todos"
132    if (!tipoSelecionado) {
133        tipoSelecionado = 'Todos';
134        adicionarLinhaSofona(tipoSelecionado);
135    }
136
137    $.each(tabela.split('<tr class="row'), function (k, tr) {
138        if (tr.indexOf('<td>') >= 0) {
139            var arrTd = tr.split('<td>');
140
141            var idPregao = arrTd[1].split('</td>')[0].trim();
142            var uf = arrTd[2].split('</td>')[0].trim();
143            var dataPregao = arrTd[3].split('</td>')[0].trim();
144            var descricao = arrTd[4].split('</td>')[0].trim();
145            var arquivo = arrTd[5].split('</td>')[0].trim();
146            var nomeOriginal = arrTd[6].split('</td>')[0].trim();
147            var linkPregao = arrTd[7].split('</td>')[0].trim();
148
149            var tipoDocumento = tipoSelecionado || descricao;
150
151            // Agrupar por título do documento
152            if (!agrupadosPorTipo[tipoDocumento]) {
153                agrupadosPorTipo[tipoDocumento] = [];
154                adicionarLinhaSofona(tipoDocumento); // Adiciona o tipo na lista apenas uma vez
155            }
156
157            agrupadosPorTipo[tipoDocumento].push({
158                idPregao: idPregao,
159                uf: uf,
160                dataPregao: dataPregao,
161                descricao: descricao,
162                arquivo: arquivo,
163                nomeOriginal: nomeOriginal,
164                linkPregao: linkPregao
165            });
166        }
167    });
168
169    // Gerar HTML para cada tipo
170    $.each(agrupadosPorTipo, function (tipoDocumento, itens) {
171        $.each(itens, function (index, item) {
172            adicionarArquivos(tipoDocumento, item.arquivo, item.nomeOriginal);
173        });
174    });
175}
176
177
178
179function normalizeString(str) {
180    return str.normalize('NFD') // Normaliza para decomposição
181        .replace(/[\u0300-\u036f]/g, '') // Remove marcas de acentuação
182        .replace(/[^a-zA-Z0-9]/g, '') // Remove caracteres especiais
183        .toLowerCase(); // Converte para minúsculas
184}

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.