151
| <![CDATA[<script>
let pathname = window.location.pathname;
pathname = pathname.replace(/^\/|\/$/g, '');
let basename = env.BASE_DIR + 'portal-da-transparencia/';
basename = basename.replace(/^\/|\/$/g, '');
let path = pathname.replace(basename, '');
path = path.replace(/^\/|\/$/g, '');
let url = '';
if(path == '')
url = 'files/?id=1&tree=1&node=1';
const transp = document.getElementById('transparencia');
const boxLinks = transp.querySelector('.list-links');
const title = transp.querySelector('.title');
const getLinks = (url) => {
fetchData(url).then(response => {
let link = '';
let a = 0;
response.data.forEach(obj => {
let {ID, name, file_id, file, slug, description, external} = obj;
if(a == 0){
title.innerHTML = path == '' ? name : 'Balanços ' + name;
strTitle = path == '' ? name : 'Balanços ' + name;
a = 1;
}else{
if(file != ''){
link += `<article>
<a href="https://files.barretos.sp.gov.br/pdf/${file}" class="action" target="_blank">
<span class="category">${strTitle}</span>
<span class="title">${name}</span>
</a>
<a href="https://files.barretos.sp.gov.br/pdf/${file}" class="btn online" target="_blank">ACESSAR</a>
</article>`;
}else if(external != ''){
link += `<article>
<a href="${external}" class="action" target="_blank">
<span class="category">${strTitle}</span>
<span class="title">${name}</span>
</a>
<a href="${external}" class="btn online" target="_blank">ACESSAR</a>
</article>`;
}else{
link += `<article>
<a href="${env.URL + slug}" class="action">
<span class="category">${strTitle}</span>
<span class="title">${name}</span>
</a>
<a href="${env.URL + slug}" class="btn">+ VEJA MAIS</a>
</article>`;
}
}
});
boxLinks.innerHTML = link;
});
}
getLinks(url);
</script>]]>
|