Dados Classificados / Desclassificados
{source}<!DOCTYPE html>
<html lang=”pt-br”>
<head>
<style>
form {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
margin-bottom: 20px;
}
select, button {
padding: 10px;
font-size: 16px;
margin: 5px 0;
width: 33%; /* Ajuste para 1/3 do tamanho */
}
input[type=”text”] {
padding: 10px;
font-size: 16px;
margin: 5px 0;
width: 20%; /* Ajuste para 20% do tamanho */
}
table {
margin-top: 20px;
border-collapse: collapse;
width: 100%;
max-width: 1000px;
margin: 0 auto;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
th, td {
border: 1px solid #ddd;
padding: 12px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
tfoot {
background-color: #e9e9e9;
}
footer {
margin-top: 20px;
text-align: center;
}
.export-button {
display: flex;
justify-content: center;
margin-top: 20px;
}
</style>
<script src=”https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js”></script>
</head>
<body>
<header>
<h1>Pesquisa de Documentos</h1>
</header>
<form id=”searchForm”>
<label for=”year”>Ano:</label>
<select id=”year” name=”year” required>
<option value=””>Selecione o ano</option>
<!– Adicionar os últimos 10 anos –>
<script>
const currentYear = new Date().getFullYear();
for (let i = 0; i < 10; i++) {
const year = currentYear – i;
document.write(`<option value=”${year}”>${year}</option>`);
}
</script>
</select>
<label for=”searchText”>Buscar texto:</label>
<input type=”text” id=”searchText” name=”searchText” placeholder=”Digite o texto a ser buscado”>
<button type=”button” onclick=”searchDocuments()”>Buscar</button>
</form>
<table id=”resultsTable”>
<thead>
<tr>
<th>Assunto</th>
<th>Data da Produção</th>
<th>Data da Desclassificação</th>
<th>Motivo</th>
</tr>
</thead>
<tbody>
<!– Resultados serão inseridos aqui –>
</tbody>
<tfoot>
<tr>
<td colspan=”4″ style=”text-align:center;”>
A Prefeitura de Alexânia declara a inexistência de quaisquer informações que tenham sido classificadas como sigilosas em nenhum grau, bem como a inexistência de desclassificação de informações sigilosas.
</td>
</tr>
</tfoot>
</table>
<div class=”export-button”>
<button onclick=”exportToExcel()”>Exportar para Excel</button>
</div>
<footer>
<p>Última atualização: <span id=”lastUpdated”></span></p>
</footer>
<script>
function searchDocuments() {
// Simulação de resultados de busca
const documents = [
{ assunto: ‘Documento A’, dataProducao: ‘2022-01-10’, dataDesclassificacao: ‘2023-01-10’, motivo: ‘Motivo 1’ },
{ assunto: ‘Documento B’, dataProducao: ‘2022-05-15’, dataDesclassificacao: ‘2023-05-15’, motivo: ‘Motivo 2’ },
{ assunto: ‘Documento C’, dataProducao: ‘2022-09-20’, dataDesclassificacao: ‘2023-09-20’, motivo: ‘Motivo 3’ },
];
const year = document.getElementById(‘year’).value;
const searchText = document.getElementById(‘searchText’).value.toLowerCase();
const resultsTable = document.getElementById(‘resultsTable’).getElementsByTagName(‘tbody’)[0];
resultsTable.innerHTML = ”;
const filteredDocuments = documents.filter(doc => {
return new Date(doc.dataProducao).getFullYear() == year &&
doc.assunto.toLowerCase().includes(searchText);
});
filteredDocuments.forEach(doc => {
const row = resultsTable.insertRow();
row.insertCell(0).textContent = doc.assunto;
row.insertCell(1).textContent = doc.dataProducao;
row.insertCell(2).textContent = doc.dataDesclassificacao;
row.insertCell(3).textContent = doc.motivo;
});
if (filteredDocuments.length === 0) {
const row = resultsTable.insertRow();
const cell = row.insertCell(0);
cell.colSpan = 4;
cell.style.textAlign = ‘center’;
cell.textContent = ‘Nenhum documento encontrado.’;
}
}
function exportToExcel() {
const table = document.getElementById(‘resultsTable’);
const workbook = XLSX.utils.table_to_book(table);
XLSX.writeFile(workbook, ‘documentos.xlsx’);
}
// Configurar a data de última atualização
document.getElementById(‘lastUpdated’).textContent = new Date().toLocaleDateString(‘pt-BR’);
</script>
</body>
</html>{/source}
