From 4cd710458ceb922c92c4b5175a2c15d1f8f6987c Mon Sep 17 00:00:00 2001 From: Emanuel Palestino Date: Fri, 19 Jan 2024 20:55:40 -0600 Subject: [PATCH 1/5] [Makeup Exam] Added tool info. --- public/tools.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/tools.json b/public/tools.json index 42044be..3165a5c 100644 --- a/public/tools.json +++ b/public/tools.json @@ -31,5 +31,17 @@ ], "date": "2023-11-10", "link": "/social_service" + }, + { + "id": "application_makeup_exam", + "type": "Solicitud", + "name": "Examen Extraordinario", + "description": "El examen extraordinario lo tienes que realizar si no has aprobado una materia de tu semestre. Tienes dos oportunidades para presentar exámenes extraordinarios y aprobar la materia. Si ambos intentos no son exitosos, podrás optar por un examen especial.", + "subtitle": "Lo que se generará es:", + "documentation": [ + "Formato con datos rellenados para estudiante y servicios escolares." + ], + "date": "2024-01-16", + "link": "/extraordinario" } ] \ No newline at end of file From 705e56ba3e4092a7f2765955c59d4041705994b2 Mon Sep 17 00:00:00 2001 From: Emanuel Palestino Date: Fri, 19 Jan 2024 21:11:20 -0600 Subject: [PATCH 2/5] [Makeup Exam] Created page and model. --- app/extraordinario/page.tsx | 13 +++ app/ui/Navigation.tsx | 3 +- app/ui/makeup_exam/Form.tsx | 162 ++++++++++++++++++++++++++++++++++++ src/models/MakeUpExam.ts | 11 +++ 4 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 app/extraordinario/page.tsx create mode 100644 app/ui/makeup_exam/Form.tsx create mode 100644 src/models/MakeUpExam.ts diff --git a/app/extraordinario/page.tsx b/app/extraordinario/page.tsx new file mode 100644 index 0000000..4925543 --- /dev/null +++ b/app/extraordinario/page.tsx @@ -0,0 +1,13 @@ +import { Form } from "../ui/makeup_exam/Form" + +const Extraordinario = () => { + + return ( +
+
+
+ ) + +} + +export default Extraordinario \ No newline at end of file diff --git a/app/ui/Navigation.tsx b/app/ui/Navigation.tsx index 160cb01..1c0f619 100644 --- a/app/ui/Navigation.tsx +++ b/app/ui/Navigation.tsx @@ -12,7 +12,8 @@ import { GitHubIcon, EmailIcon } from "@/app/icons" const routerTitles: { [key: string]: string } = { '/internship': 'Prácticas Profesionales', - '/social_service': 'Servicio Social' + '/social_service': 'Servicio Social', + '/extraordinario': 'Extraordinario' } diff --git a/app/ui/makeup_exam/Form.tsx b/app/ui/makeup_exam/Form.tsx new file mode 100644 index 0000000..75119ef --- /dev/null +++ b/app/ui/makeup_exam/Form.tsx @@ -0,0 +1,162 @@ +'use client' + +import { MakeUpExam } from "@/src/models/MakeUpExam" +import { Card, CardBody } from "@nextui-org/card" +import { Input } from "@nextui-org/input" +import { Radio, RadioGroup } from "@nextui-org/radio" +import { Button } from "@nextui-org/react" +import { Controller, useForm } from "react-hook-form" + + +export const Form = () => { + + const { + handleSubmit, + control, + } = useForm({ + defaultValues: { + name: '', + paternalSurname: '', + maternalSurname: '', + enrollment: '', + group: '', + percentageOfScholarship: 100, + courses: '', + makeUpExamNumber: 1, + retakenCourses: 0, + + } + }) + + const onSubmit = handleSubmit(data => { + data.makeUpExamNumber = Number(data.makeUpExamNumber) + data.retakenCourses = Number(data.retakenCourses) + + console.log(data) + }) + + return ( + + + +

Datos Escolares

+ + ( + + )} + /> + + ( + + )} + /> + + + ( + + )} + /> + + ( + + )} + /> + + ( + + )} + /> + + ( + + )} + /> + + +

Solicitud

+ ( + + )} + /> + + ( + + Primer Extraordinario + Segundo Extraordinario + + )} + /> + + ( + + )} + /> + +
+ +
+ +
+
+ ) + +} \ No newline at end of file diff --git a/src/models/MakeUpExam.ts b/src/models/MakeUpExam.ts new file mode 100644 index 0000000..1c07626 --- /dev/null +++ b/src/models/MakeUpExam.ts @@ -0,0 +1,11 @@ +export interface MakeUpExam { + name: string + paternalSurname: string + maternalSurname: string + enrollment: string + group: string + percentageOfScholarship: number + courses: string + makeUpExamNumber: number + retakenCourses: number +} \ No newline at end of file From 40477710f9e68199e6d08dee86c6b5f8990cbdd1 Mon Sep 17 00:00:00 2001 From: Emanuel Palestino Date: Fri, 19 Jan 2024 22:23:01 -0600 Subject: [PATCH 3/5] [Makeup Exam] Created printing format. --- app/printingFormats/makeup_exam/Format.tsx | 86 +++++++ app/ui/makeup_exam/Form.tsx | 256 +++++++++++---------- 2 files changed, 220 insertions(+), 122 deletions(-) create mode 100644 app/printingFormats/makeup_exam/Format.tsx diff --git a/app/printingFormats/makeup_exam/Format.tsx b/app/printingFormats/makeup_exam/Format.tsx new file mode 100644 index 0000000..e491cce --- /dev/null +++ b/app/printingFormats/makeup_exam/Format.tsx @@ -0,0 +1,86 @@ +import logo from '@/public/UTMEscudo.png' +import Image from 'next/image' +import { FC } from 'react' + + +export const Format = () => { + + return ( +
+
+
+
+ ) + +} + +const Section: FC<{ to: string }> = ({ to }) => { + + return ( +
+
+ logo +
+

UNIVERSIDAD TECNOLÓGICA DE LA MIXTECA

+

DEPTO. DE SERVICIOS ESCOLARES

+

SOLICITUD DE EXAMEN EXTRAORDINARIO

+
+
+ +
+
+

NOMBRE DEL ALUMNO:

+

Palestino Hernández Emanuel

+
+ +
+
+

MATRÍCULA:

+

2019020337

+
+
+

GRUPO ACTUAL:

+

902-A

+
+
+

PORCENTAJE DE BECA:

+

100%

+
+
+ +
+

MATERIA(S):

+

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

+
+ +
+

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

+

Noveno

+
+ +
+

1° Extraordinario (✔)

+

2° Extraordinario (✔)

+
+

Número de materias cursadas y/o recursadas:

+

5

+
+
+
+ +
+

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

+
+ +

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.

+ +
+

FIRMA DEL ALUMNO

+

DEPTO. DE SERVICIOS ESCOLARES

+
+ + Comprobante para {to}. +
+ ) + +} \ No newline at end of file diff --git a/app/ui/makeup_exam/Form.tsx b/app/ui/makeup_exam/Form.tsx index 75119ef..482878c 100644 --- a/app/ui/makeup_exam/Form.tsx +++ b/app/ui/makeup_exam/Form.tsx @@ -6,10 +6,15 @@ import { Input } from "@nextui-org/input" import { Radio, RadioGroup } from "@nextui-org/radio" import { Button } from "@nextui-org/react" 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" export const Form = () => { + const { target, createPDF } = usePDF('Solicitud de Examen Extraordinario') + const { handleSubmit, control, @@ -32,131 +37,138 @@ export const Form = () => { data.makeUpExamNumber = Number(data.makeUpExamNumber) data.retakenCourses = Number(data.retakenCourses) - console.log(data) + createPDF() }) return ( - - -
-

Datos Escolares

- - ( - - )} - /> - - ( - - )} - /> - - - ( - - )} - /> - - ( - - )} - /> - - ( - - )} - /> - - ( - - )} - /> - - -

Solicitud

- ( - - )} - /> - - ( - - Primer Extraordinario - Segundo Extraordinario - - )} - /> - - ( - - )} - /> - -
- -
- -
-
+ <> + + +
+

Datos Escolares

+ + ( + + )} + /> + + ( + + )} + /> + + + ( + + )} + /> + + ( + + )} + /> + + ( + + )} + /> + + ( + + )} + /> + + +

Solicitud

+ ( + + )} + /> + + ( + + Primer Extraordinario + Segundo Extraordinario + + )} + /> + + ( + + )} + /> + +
+ +
+ +
+
+ + + + + + ) } \ No newline at end of file From 819f84a419a7aa134c31c04d811bccb3e88b6500 Mon Sep 17 00:00:00 2001 From: Emanuel Palestino Date: Fri, 19 Jan 2024 22:28:45 -0600 Subject: [PATCH 4/5] [makeup Exam] Added semester select to form. --- app/ui/makeup_exam/Form.tsx | 28 +++++++++++++++++++++++++++- src/models/MakeUpExam.ts | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/ui/makeup_exam/Form.tsx b/app/ui/makeup_exam/Form.tsx index 482878c..e3d61d5 100644 --- a/app/ui/makeup_exam/Form.tsx +++ b/app/ui/makeup_exam/Form.tsx @@ -4,7 +4,8 @@ import { MakeUpExam } from "@/src/models/MakeUpExam" import { Card, CardBody } from "@nextui-org/card" import { Input } from "@nextui-org/input" import { Radio, RadioGroup } from "@nextui-org/radio" -import { Button } from "@nextui-org/react" +import { Button } from "@nextui-org/button" +import { Select, SelectItem } from "@nextui-org/select" import { Controller, useForm } from "react-hook-form" import { PDFWrapper } from "../PDFWrapper" import { Format } from "@/app/printingFormats/makeup_exam/Format" @@ -27,6 +28,7 @@ export const Form = () => { group: '', percentageOfScholarship: 100, courses: '', + semester: 'Primero', makeUpExamNumber: 1, retakenCourses: 0, @@ -127,6 +129,30 @@ export const Form = () => { )} /> + ( + + )} + /> + Date: Sat, 20 Jan 2024 18:46:12 -0600 Subject: [PATCH 5/5] [Makeup Exam] Filled format with form data. --- app/printingFormats/makeup_exam/Format.tsx | 30 ++++++++++++---------- app/ui/makeup_exam/Form.tsx | 29 +++++++++++++-------- src/models/MakeUpExam.ts | 4 +-- 3 files changed, 36 insertions(+), 27 deletions(-) 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