diff --git a/frontend/src/pages/ViewPlan.tsx b/frontend/src/pages/ViewPlan.tsx index fe49bf9..d28b196 100644 --- a/frontend/src/pages/ViewPlan.tsx +++ b/frontend/src/pages/ViewPlan.tsx @@ -6,6 +6,7 @@ import DrillService from '../service/drillService'; import { toast, ToastContainer } from 'react-toastify'; import { Icon } from '@iconify/react/dist/iconify.js'; import DrillElementService from '../service/drillElementService'; +import html2pdf from 'html2pdf.js'; const ViewPlan = () => { const stringSelectedClassPlan = localStorage.getItem('selectedClassPlan'); @@ -233,6 +234,70 @@ const ViewPlan = () => { } catch (error) {} }; + const downloadPlan = async () => { + try { + // Carregar todos os drills relacionados ao plano de aula + const drillResponses = await Promise.all( + drills.map((drl) => drill.getById((drl as { id: string }).id)) + ); + + // Criar um elemento HTML para representar o plano de aula e os drills + const container = document.createElement('div'); + + // Adicionar os dados do plano de aula ao HTML + const planDiv = document.createElement('div'); + planDiv.style.margin = '50px' + planDiv.innerHTML = ` +
${planUpdated.goals}
+${planUpdated.observations}
+${drillData.description}
+${drillData.observations}
+