diff --git a/app/(private)/Impresiones/page.tsx b/app/(private)/Impresiones/page.tsx index 17840ab..637c177 100644 --- a/app/(private)/Impresiones/page.tsx +++ b/app/(private)/Impresiones/page.tsx @@ -8,6 +8,8 @@ import ShowError from "@/app/Components/Global/ShowError"; import { cookies } from "next/headers"; import { GetStudentWhitoutSancion } from "@/app/lib/getStudentWhitoutSancion"; +import axios from "axios"; + import "@/app/globals.css"; export default async function Page(props: { @@ -26,6 +28,7 @@ export default async function Page(props: { let student: any = null; let errorMessage = ""; + let costos: any[] = []; if (numAcount) { const result = await GetStudentWhitoutSancion(parseInt(numAcount)); @@ -37,6 +40,24 @@ export default async function Page(props: { } } + try { + const response = await axios.get("http://localhost:5000/costo"); + costos = response.data; + } catch (error) { + console.error("Error obteniendo costos:", error); + } + + + const getCostsByService = (id_servicio: number) => { + return costos + .filter((c) => c.id_servicio === id_servicio) + .map((c) => ({ + value: Number(c.costo), + id_costo: c.id_costo, + fecha_registro: c.fecha_registro, + })); + }; + let options: any[] = []; if (student) { @@ -51,7 +72,7 @@ export default async function Page(props: { label: "Impresiones B/N", content: ( @@ -62,7 +83,7 @@ export default async function Page(props: { label: "Impresiones color", content: ( @@ -73,7 +94,7 @@ export default async function Page(props: { label: "Plotter", content: ( @@ -84,7 +105,7 @@ export default async function Page(props: { label: "Escaner", content: ( @@ -96,8 +117,8 @@ export default async function Page(props: { const optionsToUse = roleNumber === 5 ? options.filter( - (option) => option.key === "Recibo" || option.key === "B/N" - ) + (option) => option.key === "Recibo" || option.key === "B/N" + ) : options; return ( @@ -115,13 +136,9 @@ export default async function Page(props: { Carrera={student.carrera.carrera} Credito={student.credito} /> -
- - +
+ )}