atualizacoes

This commit is contained in:
2026-05-21 10:55:58 +01:00
parent ae639422f5
commit 5f719f033b
4 changed files with 1547 additions and 501 deletions

View File

@@ -33,7 +33,7 @@ export default function GestaoRelatorios() {
const [loading, setLoading] = useState(true);
const [refreshing, setRefreshing] = useState(false);
const [gerandoPDF, setGerandoPDF] = useState<string | null>(null);
const [gerandoDocumento, setGerandoDocumento] = useState<string | null>(null);
const cores = useMemo(() => ({
fundo: isDarkMode ? '#0A0A0A' : '#F4F7FA',
@@ -46,6 +46,7 @@ export default function GestaoRelatorios() {
laranja: '#F18721',
}), [isDarkMode]);
// 🟢 LÊ AS IMAGENS DIRETAMENTE DA TUA APP (OFFLINE)
const getBase64Image = async (imageModule: any) => {
try {
const asset = Asset.fromModule(imageModule);
@@ -53,7 +54,7 @@ export default function GestaoRelatorios() {
const fileUri = asset.localUri || asset.uri;
if (!fileUri) return "";
const base64 = await FileSystem.readAsStringAsync(fileUri, { encoding: 'base64' });
return base64.replace(/(\r\n|\n|\r)/gm, "");
return `data:image/png;base64,${base64.replace(/(\r\n|\n|\r)/gm, "")}`;
} catch (e) {
console.error("Erro no Base64:", e);
return "";
@@ -139,8 +140,10 @@ export default function GestaoRelatorios() {
return relatorios.filter(r => r.turma === turmaAtiva);
}, [relatorios, turmaAtiva]);
// 🟢 FUNÇÃO AUXILIAR PARA GERAR O HTML DA MATRIZ (PARTILHADO ENTRE EXCEL E PDF)
const construirHtmlMatriz = async (logoEPVC_b64: string, logoEstagios_b64: string, isPdf = false) => {
// =====================================================================
// GERAÇÃO DO MOTOR HTML DA MATRIZ (USADO NO EXCEL E NO PDF)
// =====================================================================
const construirHtmlMatriz = async (logoEPVC_b64: string, logoEstagios_b64: string) => {
const alunosIds = relatoriosFiltrados.map(r => r.aluno_id);
const { data: presencas } = await supabase
.from('presencas')
@@ -168,7 +171,7 @@ export default function GestaoRelatorios() {
const dia = current.getDate();
const dw = current.getDay();
if (dw !== 0 && dw !== 6) {
if (dw !== 0 && dw !== 6) { // Ignorar Sábados e Domingos
const dataStr = `${ano}-${String(mes+1).padStart(2,'0')}-${String(dia).padStart(2,'0')}`;
let mesObj = meses.find(m => m.nome === `${nomeMes} ${ano}`);
if (!mesObj) { mesObj = { nome: `${nomeMes} ${ano}`, dias: [] }; meses.push(mesObj); }
@@ -177,31 +180,31 @@ export default function GestaoRelatorios() {
current.setDate(current.getDate() + 1);
}
let totalColsDias = meses.reduce((acc, m) => acc + m.dias.length + 1, 0);
let totalColsDias = meses.reduce((acc: number, m: any) => acc + m.dias.length + 1, 0);
if (totalColsDias === 0) totalColsDias = 1;
let mesesHtml = `<tr style="height: 35px;">
<td class="th-blue" style="width: 40px;">Nº</td>
<td class="th-blue" style="width: 220px;">Nome do Aluno</td>`;
<td class="th-blue" style="width: 250px;">Nome do Aluno</td>`;
let diasHtml = `<tr style="height: 25px;">
<td class="th-blue"></td><td class="th-blue"></td>`;
meses.forEach((m: any) => {
mesesHtml += `<td colspan="${m.dias.length + 1}" class="th-orange">${m.nome}</td>`;
m.dias.forEach((d: any) => {
diasHtml += `<td class="th-blue" style="width: 24px;">${d.dia}</td>`;
diasHtml += `<td class="th-blue" style="width: 28px;">${d.dia}</td>`;
});
diasHtml += `<td class="th-total" style="width: 35px;">Total</td>`;
diasHtml += `<td class="th-total" style="width: 40px;">Total</td>`;
});
mesesHtml += `<td class="th-orange" style="width: 100px;">Horas Feitas (1)</td>
<td class="th-orange" style="width: 100px;">Horas por Lecionar (2)</td>
<td class="th-orange" style="width: 100px;">Total Contrato (3)</td></tr>`;
mesesHtml += `<td class="th-orange" style="width: 120px;">Horas Lecionadas (1)</td>
<td class="th-orange" style="width: 120px;">Horas por Lecionar (2)</td>
<td class="th-orange" style="width: 120px;">Total Contrato (3)</td></tr>`;
diasHtml += `<td class="th-blue"></td><td class="th-blue"></td><td class="th-blue"></td></tr>`;
let alunosHtml = '';
relatoriosFiltrados.forEach((r, idx) => {
alunosHtml += `<tr class="${idx % 2 === 0 ? 'zebra' : ''}" style="height: 25px;">
alunosHtml += `<tr class="${idx % 2 === 0 ? 'zebra' : ''}" style="height: 28px;">
<td class="td-cell">${r.n_escola}</td>
<td class="td-name">${r.aluno_nome}</td>`;
@@ -236,126 +239,101 @@ export default function GestaoRelatorios() {
const faltam = Math.max(0, (r.horas_totais || 400) - totalFeitasGlobais);
alunosHtml += `
<td class="td-cell" style="font-weight:bold; color: #003049;">${totalFeitasGlobais}</td>
<td class="td-cell" style="font-weight:bold; color: #EF4444;">${faltam}</td>
<td class="td-cell" style="font-weight:bold;">${r.horas_totais || 400}</td>
<td class="td-cell" style="font-weight:bold; color: #003049; font-size: 11px;">${totalFeitasGlobais}</td>
<td class="td-cell" style="font-weight:bold; color: #EF4444; font-size: 11px;">${faltam}</td>
<td class="td-cell" style="font-weight:bold; font-size: 11px;">${r.horas_totais || 400}</td>
</tr>`;
});
const imgSrcEscola = isPdf ? `data:image/png;base64,${logoEPVC_b64}` : 'cid:logo_escola';
const imgSrcApp = isPdf ? `data:image/png;base64,${logoEstagios_b64}` : 'cid:logo_app';
return `
<table class="main-table">
<tr>
<td colspan="4" rowspan="2" style="text-align: center; vertical-align: middle; padding: 10px;">
<img src="${logoEPVC_b64}" width="140" style="object-fit: contain; background: transparent; mix-blend-mode: multiply;" />
</td>
<td colspan="${totalColsDias - 3}" rowspan="2" class="title-escola" style="text-align: center; vertical-align: middle;">
Escola Profissional de Vila do Conde<br/>
<span style="font-size: 16pt; color: #f18721;">Mapa Oficial de Assiduidade (FCT)</span>
</td>
<td colspan="4" rowspan="2" style="text-align: center; vertical-align: middle; padding: 10px;">
<img src="${logoEstagios_b64}" width="140" style="object-fit: contain; background: transparent; mix-blend-mode: multiply;" />
</td>
</tr>
<tr></tr>
<tr><td colspan="${totalColsDias + 5}"></td></tr>
<tr>
<td colspan="4" class="subtitle">Período: ${new Date(minDate).toLocaleDateString('pt-PT')} a ${new Date(maxDate).toLocaleDateString('pt-PT')}</td>
<td colspan="${totalColsDias - 3}" class="subtitle" style="text-align: center;">Curso / Turma: ${turmaAtiva || 'Todas as Turmas'}</td>
<td colspan="4" class="subtitle" style="text-align: right;">Ano Letivo: 2025/2026</td>
</tr>
<tr><td colspan="${totalColsDias + 5}"></td></tr>
return {
totalColsDias,
minDate,
maxDate,
htmlCorpo: `
<table class="main-table">
<tr>
<td colspan="3" rowspan="2" style="text-align: center; vertical-align: middle;">
<img src="${imgSrcEscola}" width="130" height="60" />
</td>
<td colspan="${totalColsDias - 1}" rowspan="2" class="title-escola" style="text-align: center; vertical-align: middle;">
Escola Profissional de Vila do Conde<br/>
<span style="font-size: 14pt; color: #f18721;">Mapa Oficial de Assiduidade (FCT)</span>
</td>
<td colspan="3" rowspan="2" style="text-align: center; vertical-align: middle;">
<img src="${imgSrcApp}" width="130" height="60" />
</td>
</tr>
<tr></tr>
<tr><td colspan="${totalColsDias + 5}"></td></tr>
<tr>
<td colspan="3" class="subtitle">Período: ${new Date(minDate).toLocaleDateString('pt-PT')} a ${new Date(maxDate).toLocaleDateString('pt-PT')}</td>
<td colspan="${totalColsDias - 1}" class="subtitle" style="text-align: center;">Curso / Turma: ${turmaAtiva || 'Todas as Turmas'}</td>
<td colspan="3" class="subtitle" style="text-align: right;">Ano Letivo: 2025/2026</td>
</tr>
<tr><td colspan="${totalColsDias + 5}"></td></tr>
${mesesHtml}
${diasHtml}
${alunosHtml}
<tr><td colspan="${totalColsDias + 5}"></td></tr>
<tr>
<td colspan="5" style="font-style: italic; color: #64748b;">(1) - Horas Lecionadas no período</td>
<td colspan="5" style="font-style: italic; color: #64748b;">(2) - Horas em falta para lecionar</td>
<td colspan="5" style="font-style: italic; color: #64748b;">(3) - Total de Horas do Contrato de Estágio</td>
</tr>
<tr>
<td colspan="15" style="font-style: italic; color: #ef4444; font-weight: bold;">
Legenda de Faltas: [ F ] - Falta Justificada | [ FI ] - Falta Injustificada
</td>
</tr>
</table>
`
};
${mesesHtml}
${diasHtml}
${alunosHtml}
<tr><td colspan="${totalColsDias + 5}"></td></tr>
<tr>
<td colspan="6" style="font-style: italic; color: #64748b; font-size: 11px;">(1) - Horas Lecionadas no período</td>
<td colspan="${Math.max(1, totalColsDias - 7)}" style="font-style: italic; color: #64748b; font-size: 11px;">(2) - Horas em falta para lecionar</td>
<td colspan="6" style="font-style: italic; color: #64748b; font-size: 11px;">(3) - Total de Horas do Contrato de Estágio</td>
</tr>
<tr>
<td colspan="15" style="font-style: italic; color: #ef4444; font-weight: bold; font-size: 11px; padding-top: 5px;">
Legenda de Faltas: [ F ] - Falta Justificada | [ FI ] - Falta Injustificada
</td>
</tr>
</table>
`;
};
// 1. EXPORTAR MATRIZ EM EXCEL (FORMATO MHTML COM IMAGENS FIXAS)
const getEstilosHTML = () => `
<style>
.main-table { border-collapse: collapse; font-family: 'Segoe UI', Arial, sans-serif; width: 100%; }
.th-blue { background-color: #003049; color: #ffffff; font-weight: bold; border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; font-size: 11px; padding: 4px; }
.th-orange { background-color: #f18721; color: #ffffff; font-weight: bold; border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; font-size: 11px; padding: 4px; }
.th-total { background-color: #0f172a; color: #ffffff; font-weight: bold; border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; font-size: 11px; padding: 4px; }
.td-cell { border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; mso-number-format: "0"; font-size: 10px; padding: 4px; }
.td-total-cell { border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; font-weight: bold; background-color: #e2e8f0; font-size: 10px; padding: 4px; }
.td-name { border: 1px solid #cbd5e1; text-align: left; vertical-align: middle; font-weight: bold; white-space: nowrap; padding: 4px 6px; font-size: 11px; }
.title-escola { font-size: 20pt; font-weight: bold; color: #003049; }
.subtitle { font-size: 12pt; color: #64748b; font-weight: bold; padding: 5px 0; }
.zebra { background-color: #F8FAFC; }
</style>
`;
// 1. EXPORTAR A MATRIZ EM FORMATO EXCEL NATIVO (.XLS)
const gerarExcelGeral = async () => {
if (relatoriosFiltrados.length === 0) return Alert.alert("Aviso", "Não há alunos para exportar nesta turma.");
setRefreshing(true);
setGerandoDocumento("excel");
try {
const b64Escola = await getBase64Image(require('../../../assets/images/logoepvc2.png'));
const b64App = await getBase64Image(require('../../../assets/images/logo.png'));
const b64Escola = await getBase64Image(require('../../../assets/images/logoepvc3.png'));
const b64App = await getBase64Image(require('../../../assets/images/logo_s/texto.png'));
const { totalColsDias, htmlCorpo } = await construirHtmlMatriz(b64Escola, b64App, false);
const htmlCorpo = await construirHtmlMatriz(b64Escola, b64App);
const mhtmlExcel = `MIME-Version: 1.0
Content-Type: multipart/related; boundary="----=_NextPart_01D1"
------=_NextPart_01D1
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta charset="utf-8" />
<style>
.main-table { border-collapse: collapse; font-family: 'Segoe UI', Calibri, sans-serif; }
.th-blue { background-color: #003049; color: #ffffff; font-weight: bold; border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; }
.th-orange { background-color: #f18721; color: #ffffff; font-weight: bold; border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; }
.th-total { background-color: #0f172a; color: #ffffff; font-weight: bold; border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; }
.td-cell { border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; mso-number-format: "0"; }
.td-total-cell { border: 1px solid #cbd5e1; text-align: center; vertical-align: middle; font-weight: bold; background-color: #e2e8f0; }
.td-name { border: 1px solid #cbd5e1; text-align: left; vertical-align: middle; font-weight: bold; white-space: nowrap; padding-left: 5px; }
.title-escola { font-size: 18pt; font-weight: bold; color: #003049; }
.subtitle { font-size: 11pt; color: #64748b; font-weight: bold; }
.zebra { background-color: #F8FAFC; }
</style>
</head>
<body>
${htmlCorpo}
</body>
</html>
------=_NextPart_01D1
Content-Type: image/png
Content-ID: <logo_escola>
Content-Transfer-Encoding: base64
${b64Escola}
------=_NextPart_01D1
Content-Type: image/png
Content-ID: <logo_app>
Content-Transfer-Encoding: base64
${b64App}
------=_NextPart_01D1--`;
const docExcel = `
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/html40">
<head>
<meta charset="utf-8" />
${getEstilosHTML()}
</head>
<body>
${htmlCorpo}
</body>
</html>
`;
const fileNameTurma = turmaAtiva ? turmaAtiva.replace(/[^a-zA-Z0-9]/g, '') : 'Geral';
const fileUri = FileSystem.documentDirectory + `Mapa_Assiduidade_${fileNameTurma}.xls`;
await FileSystem.writeAsStringAsync(fileUri, mhtmlExcel, { encoding: FileSystem.EncodingType.UTF8 });
await FileSystem.writeAsStringAsync(fileUri, docExcel, { encoding: FileSystem.EncodingType.UTF8 });
if (await Sharing.isAvailableAsync()) {
await Sharing.shareAsync(fileUri, {
mimeType: 'application/vnd.ms-excel',
dialogTitle: 'Exportar Pauta de Assiduidade',
dialogTitle: 'Exportar Matriz Excel',
UTI: 'com.microsoft.excel.xls'
});
}
@@ -363,39 +341,29 @@ ${b64App}
console.error(e);
Alert.alert('Erro', 'Falha ao exportar a Matriz Excel.');
} finally {
setRefreshing(false);
setGerandoDocumento(null);
}
};
// 2. 🟢 EXPORTAR A MESMA MATRIZ EM FORMATO PDF (COMPLETAMENTE CORRIGIDO!)
// 2. EXPORTAR A MESMA MATRIZ EM FORMATO PDF
const gerarPautaPDF = async () => {
if (relatoriosFiltrados.length === 0) return Alert.alert("Aviso", "Não há alunos para exportar nesta turma.");
setGerandoPDF("pauta_global");
setGerandoDocumento("pdf");
try {
const b64Escola = await getBase64Image(require('../../../assets/images/logoepvc2.png'));
const b64App = await getBase64Image(require('../../../assets/images/logo.png'));
const b64Escola = await getBase64Image(require('../../../assets/images/logoepvc3.png'));
const b64App = await getBase64Image(require('../../../assets/images/logo_s/texto.png'));
const { htmlCorpo } = await construirHtmlMatriz(b64Escola, b64App, true);
const htmlCorpo = await construirHtmlMatriz(b64Escola, b64App);
// Usamos uma folha horizontal (Landscape) e uma tabela responsiva para caber no PDF
const htmlCompletoPDF = `
<!DOCTYPE html>
<html lang="pt-PT">
<head>
<meta charset="UTF-8">
${getEstilosHTML()}
<style>
@page { size: A4 landscape; margin: 8mm; }
body { font-family: 'Segoe UI', Helvetica, sans-serif; margin: 0; padding: 0; color: #1E293B; background-color: #fff; font-size: 8px; }
.main-table { width: 100%; border-collapse: collapse; }
.th-blue { background-color: #003049; color: #ffffff; font-weight: bold; border: 0.5px solid #cbd5e1; text-align: center; vertical-align: middle; padding: 3px 1px; }
.th-orange { background-color: #f18721; color: #ffffff; font-weight: bold; border: 0.5px solid #cbd5e1; text-align: center; vertical-align: middle; padding: 3px 1px; }
.th-total { background-color: #0f172a; color: #ffffff; font-weight: bold; border: 0.5px solid #cbd5e1; text-align: center; vertical-align: middle; padding: 3px 1px; }
.td-cell { border: 0.5px solid #cbd5e1; text-align: center; vertical-align: middle; padding: 3px 1px; }
.td-total-cell { border: 0.5px solid #cbd5e1; text-align: center; vertical-align: middle; font-weight: bold; background-color: #e2e8f0; padding: 3px 1px; }
.td-name { border: 0.5px solid #cbd5e1; text-align: left; vertical-align: middle; font-weight: bold; padding: 3px 4px; white-space: nowrap; }
.title-escola { font-size: 14pt; font-weight: bold; color: #003049; line-height: 1.3; }
.subtitle { font-size: 9pt; color: #64748b; font-weight: bold; }
.zebra { background-color: #F8FAFC; }
@page { size: A4 landscape; margin: 10mm; }
body { font-family: 'Segoe UI', Helvetica, sans-serif; margin: 0; padding: 0; background-color: #fff; }
</style>
</head>
<body>
@@ -406,7 +374,7 @@ ${b64App}
const { uri } = await Print.printToFileAsync({ html: htmlCompletoPDF });
const fileNameTurma = turmaAtiva ? turmaAtiva.replace(/[^a-zA-Z0-9]/g, '') : 'Geral';
const newFileUri = `${FileSystem.documentDirectory}Pauta_Oficial_${fileNameTurma}.pdf`;
const newFileUri = `${FileSystem.documentDirectory}Mapa_Assiduidade_${fileNameTurma}.pdf`;
await FileSystem.moveAsync({ from: uri, to: newFileUri });
@@ -417,12 +385,12 @@ ${b64App}
console.error(e);
Alert.alert('Erro', 'Falha ao gerar o PDF Oficial.');
} finally {
setGerandoPDF(null);
setGerandoDocumento(null);
}
};
const gerarSumariosPDF = async (r: any) => {
setGerandoPDF(r.id_estagio);
setGerandoDocumento(r.id_estagio);
try {
let { data: sumarios, error } = await supabase.from('registos_diarios').select('data, tipo, sumario').eq('estagio_id', r.id_estagio).order('data', { ascending: true });
if (error) throw error;
@@ -436,7 +404,7 @@ ${b64App}
if (!sumarios || sumarios.length === 0) {
Alert.alert('Aviso', 'Não foram encontrados registos para este aluno.');
setGerandoPDF(null);
setGerandoDocumento(null);
return;
}
@@ -445,8 +413,8 @@ ${b64App}
linhasTabela += `<tr><td style="text-align: center;">${new Date(s.data).toLocaleDateString('pt-PT')}</td><td style="text-align: center;"><strong>${s.tipo}</strong></td><td>${s.sumario || '<em>Sem descrição.</em>'}</td></tr>`;
});
const logoEPVC_b64 = await getBase64Image(require('../../../assets/images/logoepvc2.png'));
const logoEstagios_b64 = await getBase64Image(require('../../../assets/images/logo.png'));
const b64Escola = await getBase64Image(require('../../../assets/images/logoepvc3.png'));
const b64App = await getBase64Image(require('../../../assets/images/logo_s/texto.png'));
const htmlContent = `
<!DOCTYPE html>
@@ -456,22 +424,20 @@ ${b64App}
@page { size: A4; margin: 0; } html, body { height: 99%; overflow: hidden; }
body { font-family: sans-serif; margin: 0; padding: 12mm 15mm; color: #1E293B; font-size: 10px; }
.header-table { width: 100%; border-bottom: 2px solid #003049; padding-bottom: 5px; margin-bottom: 8px; }
.logo-epvc { width: 110px; } .logo-estagios { width: 160px; float: right; margin-top: -5px; }
.header-center { text-align: center; } .header-center h1 { color: #003049; margin: 0; font-size: 15px; } .header-center h2 { color: #F18721; margin: 2px 0 0; font-size: 9px; }
.info-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; font-size: 9px; border: 1px solid #CBD5E1; }
.info-table td { padding: 4px 6px; border: 1px solid #CBD5E1; } .info-table td.label { background-color: #F8FAFC; font-weight: bold; width: 15%; }
.section-title { background-color: #003049; color: white; padding: 4px 8px; font-size: 9px; font-weight: bold; margin-bottom: 5px; }
.eval-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 9px; } .eval-table th { background-color: #F1F5F9; padding: 4px; border: 1px solid #CBD5E1; } .eval-table td { border: 1px solid #CBD5E1; padding: 3px 8px; }
.footer { text-align: center; padding-top: 5px; border-top: 1px solid #E2E8F0; position: absolute; bottom: 10mm; left: 0; right: 0; margin: 0 auto; width: calc(100% - 30mm); }
.banner-img { max-height: 30px; margin-bottom: 3px; } .footer-text { font-size: 8px; color: #94A3B8; }
</style>
</head>
<body>
<table class="header-table">
<tr>
<td style="width: 25%;"><img src="data:image/png;base64,${logoEPVC_b64}" class="logo-epvc" /></td>
<td style="width: 25%;"><img src="${b64Escola}" width="110" style="mix-blend-mode: multiply;" /></td>
<td style="width: 50%;" class="header-center"><h1>Diário de Bordo</h1><h2>Formação em Contexto de Trabalho</h2></td>
<td style="width: 25%; text-align: right;"><img src="data:image/png;base64,${logoEstagios_b64}" class="logo-estagios" /></td>
<td style="width: 25%; text-align: right;"><img src="${b64App}" width="110" style="mix-blend-mode: multiply;" /></td>
</tr>
</table>
<table class="info-table">
@@ -480,7 +446,7 @@ ${b64App}
</table>
<div class="section-title">Registo de Atividades Diárias</div>
<table class="eval-table"><tr><th style="width: 15%;">Data</th><th style="width: 20%;">Natureza</th><th style="width: 65%;">Sumário</th></tr>${linhasTabela}</table>
<div class="footer"><img src="data:image/png;base64,${logoEPVC_b64}" class="banner-img" /><div class="footer-text">Documento gerado digitalmente via plataforma Estágios+ EPVC. Data: ${new Date().toLocaleDateString('pt-PT')}</div></div>
<div class="footer"><div class="footer-text">Documento gerado digitalmente via plataforma Estágios+ EPVC. Data: ${new Date().toLocaleDateString('pt-PT')}</div></div>
</body>
</html>
`;
@@ -494,7 +460,7 @@ ${b64App}
console.error(e);
Alert.alert('Erro', 'Não foi possível ler os registos.');
} finally {
setGerandoPDF(null);
setGerandoDocumento(null);
}
};
@@ -574,22 +540,32 @@ ${b64App}
) : (
<View>
<View style={styles.botoesGlobaisContainer}>
<TouchableOpacity style={[styles.btnGlobal, { backgroundColor: cores.verdeAgua + '30', borderColor: cores.verdeAgua }]} onPress={gerarExcelGeral}>
<Ionicons name="grid-outline" size={26} color="#003049" />
<Text style={[styles.btnGlobalText, { color: '#003049' }]}>Matriz de Assiduidade</Text>
<TouchableOpacity
style={[styles.btnGlobal, { backgroundColor: cores.verdeAgua + '30', borderColor: cores.verdeAgua }]}
onPress={gerarExcelGeral}
disabled={gerandoDocumento === "excel"}
>
{gerandoDocumento === "excel" ? (
<ActivityIndicator size="small" color="#003049" />
) : (
<>
<Ionicons name="grid-outline" size={26} color="#003049" />
<Text style={[styles.btnGlobalText, { color: '#003049' }]}>Matriz em Excel</Text>
</>
)}
</TouchableOpacity>
<TouchableOpacity
style={[styles.btnGlobal, { backgroundColor: cores.laranja + '20', borderColor: cores.laranja }]}
onPress={gerarPautaPDF}
disabled={gerandoPDF === "pauta_global"}
disabled={gerandoDocumento === "pdf"}
>
{gerandoPDF === "pauta_global" ? (
{gerandoDocumento === "pdf" ? (
<ActivityIndicator size="small" color={cores.laranja} />
) : (
<>
<Ionicons name="document-text" size={26} color={cores.laranja} />
<Text style={[styles.btnGlobalText, { color: cores.laranja }]}>Pauta em PDF</Text>
<Text style={[styles.btnGlobalText, { color: cores.laranja }]}>Matriz em PDF</Text>
</>
)}
</TouchableOpacity>
@@ -653,9 +629,9 @@ ${b64App}
<TouchableOpacity
style={[styles.btnAcaoLigeiro, { borderColor: cores.laranja }]}
onPress={() => gerarSumariosPDF(r)}
disabled={gerandoPDF === r.id_estagio}
disabled={gerandoDocumento === r.id_estagio}
>
{gerandoPDF === r.id_estagio ? (
{gerandoDocumento === r.id_estagio ? (
<ActivityIndicator size="small" color={cores.laranja} />
) : (
<>