diff --git a/app/printingFormats/makeup_exam/Format.tsx b/app/printingFormats/makeup_exam/Format.tsx index e491cce..b015c71 100644 --- a/app/printingFormats/makeup_exam/Format.tsx +++ b/app/printingFormats/makeup_exam/Format.tsx @@ -1,20 +1,22 @@ +import { formatedDate } from '@/app/utils/format' import logo from '@/public/UTMEscudo.png' +import { MakeUpExam } from '@/src/models/MakeUpExam' import Image from 'next/image' import { FC } from 'react' -export const Format = () => { +export const Format: FC<{ data: MakeUpExam, date: Date }> = ({ data, date }) => { return (
-
-
+
+
) } -const Section: FC<{ to: string }> = ({ to }) => { +const Section: FC<{ to: string, data: MakeUpExam, date: Date }> = ({ to, data, date }) => { return (
@@ -30,46 +32,46 @@ const Section: FC<{ to: string }> = ({ to }) => {

NOMBRE DEL ALUMNO:

-

Palestino Hernández Emanuel

+

{data.paternalSurname} {data.maternalSurname} {data.name}

MATRÍCULA:

-

2019020337

+

{data.enrollment}

GRUPO ACTUAL:

-

902-A

+

{data.group}

PORCENTAJE DE BECA:

-

100%

+

{data.percentageOfScholarship}%

MATERIA(S):

-

Ingenieria de requerimientos, pruebas de software, matematicas aplicadas, otra materia de relleno

+

{data.makeupExamCourses}

SEMESTRE AL QUE CORRESPONDE(N) LAS MATERIA(S):

-

Noveno

+

{data.semester}

-

1° Extraordinario (✔)

-

2° Extraordinario (✔)

+

1° Extraordinario ({data.makeUpExamNumber == 1 ? '✔' : null})

+

2° Extraordinario ({data.makeUpExamNumber == 2 ? '✔' : null})

Número de materias cursadas y/o recursadas:

-

5

+

{data.courses}

-

HUAJUAPAN DE LEÓN, OAX, A 19 de Enero de 2023

+

HUAJUAPAN DE LEÓN, OAX, A {formatedDate(date)}

En caso de que el alumno no tenga derecho a presentar el examen de acuerdo al Reglamento de alumnos de Licenciatura vigente, la calificación obtenida en el examen no tendrá validez.

diff --git a/app/ui/makeup_exam/Form.tsx b/app/ui/makeup_exam/Form.tsx index e3d61d5..b1e68b0 100644 --- a/app/ui/makeup_exam/Form.tsx +++ b/app/ui/makeup_exam/Form.tsx @@ -10,15 +10,19 @@ import { Controller, useForm } from "react-hook-form" import { PDFWrapper } from "../PDFWrapper" import { Format } from "@/app/printingFormats/makeup_exam/Format" import { usePDF } from "@/src/hooks/usePDF" +import { useState } from "react" export const Form = () => { const { target, createPDF } = usePDF('Solicitud de Examen Extraordinario') + const [data, setData] = useState() + + const updateData = async (data: MakeUpExam) => setData(data) const { handleSubmit, - control, + control } = useForm({ defaultValues: { name: '', @@ -27,17 +31,18 @@ export const Form = () => { enrollment: '', group: '', percentageOfScholarship: 100, - courses: '', + makeupExamCourses: '', semester: 'Primero', makeUpExamNumber: 1, - retakenCourses: 0, + courses: 0, } }) - const onSubmit = handleSubmit(data => { + const onSubmit = handleSubmit(async data => { data.makeUpExamNumber = Number(data.makeUpExamNumber) - data.retakenCourses = Number(data.retakenCourses) + data.courses = Number(data.courses) + await updateData(data) createPDF() }) @@ -117,7 +122,7 @@ export const Form = () => {

Solicitud

( { control={control} render={({ field }) => ( { - - - + {data ? ( + + + + ) : null} ) diff --git a/src/models/MakeUpExam.ts b/src/models/MakeUpExam.ts index 05f14b2..c7086ac 100644 --- a/src/models/MakeUpExam.ts +++ b/src/models/MakeUpExam.ts @@ -5,8 +5,8 @@ export interface MakeUpExam { enrollment: string group: string percentageOfScholarship: number - courses: string + makeupExamCourses: string semester: string makeUpExamNumber: number - retakenCourses: number + courses: number } \ No newline at end of file