From 9fcffa06dc99bc54c0cf36653bf45a011c808ae1 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 29 Oct 2025 16:36:48 +0000 Subject: [PATCH] versao 14 --- macro_areas.php | 29 +++++++++-- print_macro_areas.php | 113 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 print_macro_areas.php diff --git a/macro_areas.php b/macro_areas.php index 87a3c7a..08e7e9b 100644 --- a/macro_areas.php +++ b/macro_areas.php @@ -24,7 +24,7 @@ $macro_areas = $stmt->fetchAll(PDO::FETCH_ASSOC);

Macro Áreas

- @@ -123,6 +123,29 @@ document.addEventListener('DOMContentLoaded', function () { } } }); + + // Print functionality + const printButton = document.getElementById('printButton'); + printButton.addEventListener('click', function() { + fetch('print_macro_areas.php') + .then(response => response.text()) + .then(html => { + const printWindow = window.open('', '_blank'); + printWindow.document.write(html); + printWindow.document.close(); + printWindow.focus(); // Required for some browsers + + // Use a small timeout to ensure content is loaded before printing + setTimeout(() => { + printWindow.print(); + }, 250); + + printWindow.addEventListener('afterprint', () => { + printWindow.close(); + }); + }) + .catch(error => console.error('Error fetching print content:', error)); + }); }); @@ -135,8 +158,8 @@ document.addEventListener('DOMContentLoaded', function () { border-left: 0; } .btn-sm i[data-lucide] { - width: 11px; - height: 11px; + width: 18px; + height: 18px; } /* Custom styles for status badges */ .badge-status-ativo { diff --git a/print_macro_areas.php b/print_macro_areas.php new file mode 100644 index 0000000..877743d --- /dev/null +++ b/print_macro_areas.php @@ -0,0 +1,113 @@ +query('SELECT * FROM macro_areas ORDER BY nome ASC'); +$macro_areas = $stmt->fetchAll(PDO::FETCH_ASSOC); + +$total = count($macro_areas); +$active = 0; +$archived = 0; + +foreach ($macro_areas as $area) { + if ($area['ativo']) { + $active++; + } else { + $archived++; + } +} +?> + + + + + Lista de Macro Áreas + + + +
+ Logotipo Galilei +
+

Lista de Macro Áreas

+
+ Gerado em: +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
#NomeDescriçãoStatus
Nenhuma macro área encontrada.
+ +
+

+ Total de Macro Áreas: | + Ativas: | + Arquivadas: +

+
+ + +