Implementação do CRUD de modelos de relatório e menu de emissão de relatórios compilados com filtros e exportação DOCX/PDF
This commit is contained in:
+488
@@ -2481,6 +2481,494 @@ const initApp = () => {
|
||||
if (e.target === modal) modal.remove();
|
||||
});
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// CRUD DE MODELOS DE RELATÓRIO
|
||||
// ============================================================
|
||||
const modelosRelatorioModal = document.getElementById('modelosRelatorioModal');
|
||||
const btnModelosRelatorio = document.getElementById('btnModelosRelatorio');
|
||||
const btnCloseModelosModal = document.getElementById('btnCloseModelosModal');
|
||||
const templatesList = document.getElementById('templatesList');
|
||||
const btnCreateTemplate = document.getElementById('btnCreateTemplate');
|
||||
const btnCancelTemplate = document.getElementById('btnCancelTemplate');
|
||||
const btnSaveTemplate = document.getElementById('btnSaveTemplate');
|
||||
|
||||
const templateFormId = document.getElementById('templateFormId');
|
||||
const templateFormNome = document.getElementById('templateFormNome');
|
||||
const templateFormFinalidade = document.getElementById('templateFormFinalidade');
|
||||
const templateFormPeriodicidade = document.getElementById('templateFormPeriodicidade');
|
||||
const templateFormEstrutura = document.getElementById('templateFormEstrutura');
|
||||
const templateFormTitle = document.getElementById('templateFormTitle');
|
||||
|
||||
let allTemplates = [];
|
||||
|
||||
// Abrir modal de modelos
|
||||
if (btnModelosRelatorio) {
|
||||
btnModelosRelatorio.addEventListener('click', async () => {
|
||||
modelosRelatorioModal.style.display = 'flex';
|
||||
clearTemplateForm();
|
||||
await fetchTemplates();
|
||||
});
|
||||
}
|
||||
|
||||
// Fechar modal de modelos
|
||||
if (btnCloseModelosModal) {
|
||||
btnCloseModelosModal.addEventListener('click', () => {
|
||||
modelosRelatorioModal.style.display = 'none';
|
||||
});
|
||||
}
|
||||
if (modelosRelatorioModal) {
|
||||
modelosRelatorioModal.addEventListener('click', (e) => {
|
||||
if (e.target === modelosRelatorioModal) modelosRelatorioModal.style.display = 'none';
|
||||
});
|
||||
}
|
||||
|
||||
// Buscar modelos do backend
|
||||
async function fetchTemplates() {
|
||||
templatesList.innerHTML = '<div style="color: var(--text-secondary); text-align: center; padding: 20px;">Carregando...</div>';
|
||||
try {
|
||||
const res = await fetch('/api/modelos');
|
||||
allTemplates = await res.json();
|
||||
renderTemplatesList();
|
||||
} catch (err) {
|
||||
console.error('Erro ao buscar modelos:', err);
|
||||
templatesList.innerHTML = '<div style="color: #ff6b6b; text-align: center; padding: 20px;">Erro ao carregar modelos.</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Renderizar a lista de modelos na esquerda
|
||||
function renderTemplatesList() {
|
||||
if (allTemplates.length === 0) {
|
||||
templatesList.innerHTML = '<div style="color: var(--text-secondary); text-align: center; padding: 20px;">Nenhum modelo cadastrado.</div>';
|
||||
return;
|
||||
}
|
||||
templatesList.innerHTML = allTemplates.map(t => `
|
||||
<div class="obs-item" style="padding: 10px; margin: 0 0 8px 0; cursor: pointer; border-left: 3px solid var(--brand-green); display: flex; flex-direction: column; gap: 4px; background: var(--bg-secondary); border-radius: 8px;" data-id="${t.id}">
|
||||
<div style="font-weight: 600; color: var(--text-primary); font-size: 0.9rem;">${t.nome}</div>
|
||||
<div style="font-size: 0.75rem; color: var(--text-secondary);">${t.periodicidade} • ${t.finalidade || 'Sem finalidade'}</div>
|
||||
<div style="display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px;">
|
||||
<button class="template-edit-btn" data-id="${t.id}" style="background: none; border: 1px solid var(--border-light); color: var(--brand-green); padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; cursor: pointer;">Editar</button>
|
||||
<button class="template-delete-btn" data-id="${t.id}" style="background: none; border: 1px solid var(--border-light); color: #ff6b6b; padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; cursor: pointer;">Excluir</button>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
// Eventos de clique na lista para editar/deletar
|
||||
templatesList.querySelectorAll('.obs-item').forEach(item => {
|
||||
item.addEventListener('click', (e) => {
|
||||
if (e.target.tagName === 'BUTTON') return;
|
||||
const id = item.dataset.id;
|
||||
const template = allTemplates.find(t => t.id == id);
|
||||
if (template) fillTemplateForm(template);
|
||||
});
|
||||
});
|
||||
|
||||
templatesList.querySelectorAll('.template-edit-btn').forEach(btn => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
const id = btn.dataset.id;
|
||||
const template = allTemplates.find(t => t.id == id);
|
||||
if (template) fillTemplateForm(template);
|
||||
});
|
||||
});
|
||||
|
||||
templatesList.querySelectorAll('.template-delete-btn').forEach(btn => {
|
||||
btn.addEventListener('click', async (e) => {
|
||||
e.stopPropagation();
|
||||
const id = btn.dataset.id;
|
||||
const template = allTemplates.find(t => t.id == id);
|
||||
if (!template) return;
|
||||
if (confirm(`Tem certeza que deseja excluir o modelo "${template.nome}"?`)) {
|
||||
try {
|
||||
const res = await fetch(`/api/modelos/${id}`, { method: 'DELETE' });
|
||||
if (res.ok) {
|
||||
alert('Modelo excluído com sucesso!');
|
||||
clearTemplateForm();
|
||||
await fetchTemplates();
|
||||
} else {
|
||||
const err = await res.json();
|
||||
alert('Erro ao excluir: ' + err.error);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Erro ao excluir modelo:', err);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Preencher formulário de edição
|
||||
function fillTemplateForm(template) {
|
||||
templateFormId.value = template.id;
|
||||
templateFormNome.value = template.nome;
|
||||
templateFormFinalidade.value = template.finalidade || '';
|
||||
templateFormPeriodicidade.value = template.periodicidade || 'Semanal';
|
||||
templateFormEstrutura.value = template.estrutura || '';
|
||||
templateFormTitle.textContent = 'Editar Modelo';
|
||||
}
|
||||
|
||||
// Limpar formulário
|
||||
function clearTemplateForm() {
|
||||
templateFormId.value = '';
|
||||
templateFormNome.value = '';
|
||||
templateFormFinalidade.value = '';
|
||||
templateFormPeriodicidade.value = 'Semanal';
|
||||
templateFormEstrutura.value = '';
|
||||
templateFormTitle.textContent = 'Novo Modelo';
|
||||
}
|
||||
|
||||
// Botão "Novo Modelo"
|
||||
if (btnCreateTemplate) {
|
||||
btnCreateTemplate.addEventListener('click', clearTemplateForm);
|
||||
}
|
||||
|
||||
// Botão "Cancelar"
|
||||
if (btnCancelTemplate) {
|
||||
btnCancelTemplate.addEventListener('click', clearTemplateForm);
|
||||
}
|
||||
|
||||
// Botão "Salvar Modelo"
|
||||
if (btnSaveTemplate) {
|
||||
btnSaveTemplate.addEventListener('click', async () => {
|
||||
const id = templateFormId.value;
|
||||
const nome = templateFormNome.value.trim();
|
||||
const finalidade = templateFormFinalidade.value.trim();
|
||||
const periodicidade = templateFormPeriodicidade.value;
|
||||
const estrutura = templateFormEstrutura.value.trim();
|
||||
|
||||
if (!nome || !estrutura) {
|
||||
alert('Nome e estrutura do modelo são obrigatórios.');
|
||||
return;
|
||||
}
|
||||
|
||||
const body = { nome, finalidade, periodicidade, estrutura };
|
||||
const url = id ? `/api/modelos/${id}` : '/api/modelos';
|
||||
const method = id ? 'PUT' : 'POST';
|
||||
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
method,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body)
|
||||
});
|
||||
if (res.ok) {
|
||||
alert('Modelo salvo com sucesso!');
|
||||
clearTemplateForm();
|
||||
await fetchTemplates();
|
||||
} else {
|
||||
const err = await res.json();
|
||||
alert('Erro ao salvar modelo: ' + err.error);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Erro ao salvar modelo:', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// GERAÇÃO / EMISSÃO DE RELATÓRIO PEDAGÓGICO
|
||||
// ============================================================
|
||||
const emitirRelatorioModal = document.getElementById('emitirRelatorioModal');
|
||||
const btnEmitirRelatorio = document.getElementById('btnEmitirRelatorio');
|
||||
const btnCloseEmitirModal = document.getElementById('btnCloseEmitirModal');
|
||||
|
||||
const emitirFilterCrianca = document.getElementById('emitirFilterCrianca');
|
||||
const emitirFilterDataInicio = document.getElementById('emitirFilterDataInicio');
|
||||
const emitirFilterDataFim = document.getElementById('emitirFilterDataFim');
|
||||
const emitirFilterTag = document.getElementById('emitirFilterTag');
|
||||
const emitirFilterTemplate = document.getElementById('emitirFilterTemplate');
|
||||
|
||||
const emitirObsCountInfo = document.getElementById('emitirObsCountInfo');
|
||||
const btnGenerateCompiledReport = document.getElementById('btnGenerateCompiledReport');
|
||||
const emitirReportPreviewArea = document.getElementById('emitirReportPreviewArea');
|
||||
|
||||
const btnExportDocx = document.getElementById('btnExportDocx');
|
||||
const btnExportPdf = document.getElementById('btnExportPdf');
|
||||
|
||||
let activeCompiledReport = null; // Guarda o texto do relatório compilado ativo
|
||||
|
||||
// Abrir modal de emissão
|
||||
if (btnEmitirRelatorio) {
|
||||
btnEmitirRelatorio.addEventListener('click', async () => {
|
||||
emitirRelatorioModal.style.display = 'flex';
|
||||
activeCompiledReport = null;
|
||||
emitirReportPreviewArea.innerHTML = `
|
||||
<div style="color: var(--text-secondary); text-align: center; margin-top: 50px;">
|
||||
Escolha uma criança e um modelo de relatório para começar.
|
||||
</div>
|
||||
`;
|
||||
btnExportDocx.disabled = true;
|
||||
btnExportDocx.style.cursor = 'not-allowed';
|
||||
btnExportDocx.style.borderColor = 'var(--border-light)';
|
||||
btnExportDocx.style.color = 'var(--text-secondary)';
|
||||
|
||||
btnExportPdf.disabled = true;
|
||||
btnExportPdf.style.cursor = 'not-allowed';
|
||||
btnExportPdf.style.borderColor = 'var(--border-light)';
|
||||
btnExportPdf.style.color = 'var(--text-secondary)';
|
||||
|
||||
emitirFilterDataInicio.value = '';
|
||||
emitirFilterDataFim.value = '';
|
||||
emitirFilterTag.value = '';
|
||||
|
||||
await loadFiltersData();
|
||||
});
|
||||
}
|
||||
|
||||
// Fechar modal de emissão
|
||||
if (btnCloseEmitirModal) {
|
||||
btnCloseEmitirModal.addEventListener('click', () => {
|
||||
emitirRelatorioModal.style.display = 'none';
|
||||
});
|
||||
}
|
||||
if (emitirRelatorioModal) {
|
||||
emitirRelatorioModal.addEventListener('click', (e) => {
|
||||
if (e.target === emitirRelatorioModal) emitirRelatorioModal.style.display = 'none';
|
||||
});
|
||||
}
|
||||
|
||||
// Carregar dados de filtros (crianças e templates)
|
||||
async function loadFiltersData() {
|
||||
try {
|
||||
const res = await fetch('/api/observacoes/criancas');
|
||||
const criancas = await res.json();
|
||||
emitirFilterCrianca.innerHTML = '<option value="">Selecione a criança</option>' +
|
||||
criancas.map(c => `<option value="${c}">${c}</option>`).join('');
|
||||
} catch (err) {
|
||||
console.error('Erro ao buscar crianças para filtros:', err);
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/modelos');
|
||||
const modelos = await res.json();
|
||||
emitirFilterTemplate.innerHTML = '<option value="">Selecione o modelo</option>' +
|
||||
modelos.map(m => `<option value="${m.id}">${m.nome}</option>`).join('');
|
||||
} catch (err) {
|
||||
console.error('Erro ao buscar modelos para filtros:', err);
|
||||
}
|
||||
|
||||
updateObservationsCount();
|
||||
}
|
||||
|
||||
// Ouvintes para atualizar contagem
|
||||
[emitirFilterCrianca, emitirFilterDataInicio, emitirFilterDataFim, emitirFilterTag, emitirFilterTemplate].forEach(el => {
|
||||
if (el) el.addEventListener('change', updateObservationsCount);
|
||||
});
|
||||
if (emitirFilterCrianca) {
|
||||
emitirFilterCrianca.addEventListener('input', updateObservationsCount);
|
||||
}
|
||||
|
||||
// Recalcular quantidade de observações elegíveis
|
||||
async function updateObservationsCount() {
|
||||
const crianca = emitirFilterCrianca ? emitirFilterCrianca.value : '';
|
||||
const dataInicio = emitirFilterDataInicio ? emitirFilterDataInicio.value : '';
|
||||
const dataFim = emitirFilterDataFim ? emitirFilterDataFim.value : '';
|
||||
const tag = emitirFilterTag ? emitirFilterTag.value : '';
|
||||
const modeloId = emitirFilterTemplate ? emitirFilterTemplate.value : '';
|
||||
|
||||
if (!crianca || !modeloId) {
|
||||
emitirObsCountInfo.textContent = 'Escolha uma criança e um modelo para prosseguir.';
|
||||
btnGenerateCompiledReport.disabled = true;
|
||||
btnGenerateCompiledReport.style.opacity = '0.6';
|
||||
btnGenerateCompiledReport.style.cursor = 'not-allowed';
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
let url = `/api/observacoes/contar?crianca=${encodeURIComponent(crianca)}`;
|
||||
if (dataInicio) url += `&dataInicio=${dataInicio}`;
|
||||
if (dataFim) url += `&dataFim=${dataFim}`;
|
||||
if (tag) url += `&tags=${encodeURIComponent(tag)}`;
|
||||
|
||||
const res = await fetch(url);
|
||||
const data = await res.json();
|
||||
const count = data.count || 0;
|
||||
|
||||
if (count === 0) {
|
||||
emitirObsCountInfo.innerHTML = `⚠️ <span style="color: #ff6b6b; font-weight: 600;">Nenhuma observação</span> encontrada para esses filtros.`;
|
||||
btnGenerateCompiledReport.disabled = true;
|
||||
btnGenerateCompiledReport.style.opacity = '0.6';
|
||||
btnGenerateCompiledReport.style.cursor = 'not-allowed';
|
||||
} else {
|
||||
emitirObsCountInfo.innerHTML = `✨ <strong>${count}</strong> observações selecionadas para compilação.`;
|
||||
btnGenerateCompiledReport.disabled = false;
|
||||
btnGenerateCompiledReport.style.opacity = '1';
|
||||
btnGenerateCompiledReport.style.cursor = 'pointer';
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Erro ao contar observações:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Gerar relatório consolidado com IA
|
||||
if (btnGenerateCompiledReport) {
|
||||
btnGenerateCompiledReport.addEventListener('click', async () => {
|
||||
const crianca = emitirFilterCrianca.value;
|
||||
const dataInicio = emitirFilterDataInicio.value;
|
||||
const dataFim = emitirFilterDataFim.value;
|
||||
const tag = emitirFilterTag.value;
|
||||
const modeloId = emitirFilterTemplate.value;
|
||||
|
||||
if (!crianca || !modeloId) return;
|
||||
|
||||
emitirReportPreviewArea.innerHTML = `
|
||||
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 12px; margin-top: 50px;">
|
||||
<div style="width: 32px; height: 32px; border: 3px solid var(--border-light); border-top-color: var(--brand-green); border-radius: 50%; animation: spin 1s linear infinite;"></div>
|
||||
<div style="color: var(--text-secondary); font-size: 0.9rem; font-weight: 500;">Analisando observações e gerando relatório pedagógico...</div>
|
||||
</div>
|
||||
`;
|
||||
btnGenerateCompiledReport.disabled = true;
|
||||
btnGenerateCompiledReport.style.opacity = '0.6';
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/modelos/gerar-relatorio', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
crianca,
|
||||
dataInicio,
|
||||
dataFim,
|
||||
tags: tag || undefined,
|
||||
modeloId
|
||||
})
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const errData = await res.json();
|
||||
throw new Error(errData.error || 'Erro desconhecido');
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
activeCompiledReport = data;
|
||||
|
||||
// Renderizar prévia do relatório em markdown
|
||||
emitirReportPreviewArea.innerHTML = `
|
||||
<div style="background: var(--bg-primary); padding: 12px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--border-light); font-size: 0.85rem;">
|
||||
<div><strong>Estudante:</strong> ${data.crianca}</div>
|
||||
<div><strong>Período:</strong> ${data.periodo}</div>
|
||||
<div><strong>Modelo Aplicado:</strong> ${data.templateNome}</div>
|
||||
<div><strong>Quantidade de Observações Consolidadas:</strong> ${data.totalObservacoes}</div>
|
||||
</div>
|
||||
<div class="report-content-body" style="color: var(--text-primary);">
|
||||
${marked.parse(data.report)}
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Ativar botões de exportação
|
||||
btnExportDocx.disabled = false;
|
||||
btnExportDocx.style.cursor = 'pointer';
|
||||
btnExportDocx.style.borderColor = 'var(--brand-green)';
|
||||
btnExportDocx.style.color = 'var(--brand-green)';
|
||||
|
||||
btnExportPdf.disabled = false;
|
||||
btnExportPdf.style.cursor = 'pointer';
|
||||
btnExportPdf.style.borderColor = 'var(--brand-green)';
|
||||
btnExportPdf.style.color = 'var(--brand-green)';
|
||||
|
||||
} catch (err) {
|
||||
console.error('Erro ao gerar relatório compilado:', err);
|
||||
emitirReportPreviewArea.innerHTML = `
|
||||
<div style="color: #ff6b6b; text-align: center; margin-top: 50px; font-weight: 500;">
|
||||
Erro ao gerar relatório: ${err.message}
|
||||
</div>
|
||||
`;
|
||||
} finally {
|
||||
btnGenerateCompiledReport.disabled = false;
|
||||
btnGenerateCompiledReport.style.opacity = '1';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Exportar para DOCX (Formato HTML-DOCX)
|
||||
if (btnExportDocx) {
|
||||
btnExportDocx.addEventListener('click', () => {
|
||||
if (!activeCompiledReport) return;
|
||||
|
||||
const htmlContent = `
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:office:word" xmlns="http://www.w3.org/TR/REC-html40">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Relatório Pedagógico - ${activeCompiledReport.crianca}</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; line-height: 1.5; color: #333; }
|
||||
h1, h2, h3 { color: #1f2937; }
|
||||
.header-info { background-color: #f3f4f6; padding: 12px; border-radius: 6px; margin-bottom: 20px; border: 1px solid #e5e7eb; }
|
||||
.header-info div { margin-bottom: 4px; font-size: 11pt; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header-info">
|
||||
<div><b>Estudante:</b> ${activeCompiledReport.crianca}</div>
|
||||
<div><b>Período:</b> ${activeCompiledReport.periodo}</div>
|
||||
<div><b>Modelo:</b> ${activeCompiledReport.templateNome}</div>
|
||||
<div><b>Quantidade de observações consolidadas:</b> ${activeCompiledReport.totalObservacoes}</div>
|
||||
</div>
|
||||
<hr/>
|
||||
${marked.parse(activeCompiledReport.report)}
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
const blob = new Blob(['\ufeff' + htmlContent], { type: 'application/msword' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `relatorio_${activeCompiledReport.crianca.replace(/\s+/g, '_')}_${Date.now()}.doc`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
});
|
||||
}
|
||||
|
||||
// Exportar para PDF (Abre janela de impressão do navegador)
|
||||
if (btnExportPdf) {
|
||||
btnExportPdf.addEventListener('click', () => {
|
||||
if (!activeCompiledReport) return;
|
||||
|
||||
const printWindow = window.open('', '_blank');
|
||||
printWindow.document.write(`
|
||||
<html>
|
||||
<head>
|
||||
<title>Relatório Pedagógico - ${activeCompiledReport.crianca}</title>
|
||||
<style>
|
||||
body { font-family: 'Outfit', 'Inter', -apple-system, sans-serif; padding: 40px; color: #333; line-height: 1.6; }
|
||||
h1, h2, h3 { color: #1e293b; margin-top: 24px; margin-bottom: 12px; }
|
||||
h1 { border-bottom: 2px solid #e2e8f0; padding-bottom: 10px; font-size: 22px; }
|
||||
h2 { font-size: 18px; border-bottom: 1px solid #f1f5f9; padding-bottom: 6px; }
|
||||
.meta-box { background: #f8fafc; padding: 16px; border-radius: 8px; margin-bottom: 24px; font-size: 14px; border: 1px solid #e2e8f0; }
|
||||
.meta-item { margin-bottom: 6px; display: flex; }
|
||||
.meta-label { font-weight: bold; color: #475569; width: 220px; }
|
||||
p { margin-bottom: 14px; text-align: justify; }
|
||||
ul, ol { margin-bottom: 14px; padding-left: 20px; }
|
||||
li { margin-bottom: 6px; }
|
||||
@media print {
|
||||
body { padding: 0; }
|
||||
button { display: none; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Relatório Pedagógico de Desenvolvimento</h1>
|
||||
<div class="meta-box">
|
||||
<div class="meta-item"><span class="meta-label">Estudante:</span> <span>${activeCompiledReport.crianca}</span></div>
|
||||
<div class="meta-item"><span class="meta-label">Período:</span> <span>${activeCompiledReport.periodo}</span></div>
|
||||
<div class="meta-item"><span class="meta-label">Modelo Aplicado:</span> <span>${activeCompiledReport.templateNome}</span></div>
|
||||
<div class="meta-item"><span class="meta-label">Quantidade de Observações:</span> <span>${activeCompiledReport.totalObservacoes}</span></div>
|
||||
</div>
|
||||
<div>${marked.parse(activeCompiledReport.report)}</div>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
window.print();
|
||||
setTimeout(() => { window.close(); }, 500);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
printWindow.document.close();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Player de áudio personalizado global para as mídias geradas
|
||||
|
||||
Reference in New Issue
Block a user