modified impresions to role = 5

This commit is contained in:
2026-02-19 18:59:21 -06:00
committed by frcarlos
parent b7bee2d1fd
commit 57714ff36c
5 changed files with 101 additions and 95 deletions
+72 -83
View File
@@ -6,6 +6,7 @@ import Impressions from "@/app/Components/Impressions/impressions";
import ShowError from "@/app/Components/Global/ShowError";
import { GetStudent } from "@/app/lib/getStudent";
import { cookies } from "next/headers";
import "@/app/globals.css";
@@ -19,6 +20,10 @@ export default async function Page(props: {
const key = params?.key && params.key;
const numAcount = params?.numAcount ? params.numAcount : null;
const cookieStore = await cookies();
const role = cookieStore.get("role")?.value || "";
const roleNumber = parseInt(role);
let student: any = null;
let errorMessage = "";
@@ -32,6 +37,69 @@ export default async function Page(props: {
}
}
let options: any[] = [];
if (student) {
options = [
{
key: "Recibo",
label: "Recibo",
content: <Receipt numAcount={student.id_cuenta} />,
},
{
key: "B/N",
label: "Impresiones B/N",
content: (
<Impressions
costs={[{ value: 1 }, { value: 2 }]}
numAcount={student.id_cuenta}
id_servicio={1}
/>
),
},
{
key: "color",
label: "Impresiones color",
content: (
<Impressions
costs={[{ value: 4 }, { value: 5 }]}
numAcount={student.id_cuenta}
id_servicio={2}
/>
),
},
{
key: "Plotter",
label: "Plotter",
content: (
<Impressions
costs={[{ value: 15 }]}
numAcount={student.id_cuenta}
id_servicio={3}
/>
),
},
{
key: "Escaner",
label: "Escaner",
content: (
<Impressions
costs={[{ value: 1 }]}
numAcount={student.id_cuenta}
id_servicio={6}
/>
),
},
];
}
const optionsToUse =
roleNumber === 5
? options.filter(
(option) => option.key === "Recibo" || option.key === "B/N"
)
: options;
return (
<section className="containerSection">
{errorMessage && <ShowError key={Date.now()} message={errorMessage} />}
@@ -47,92 +115,13 @@ export default async function Page(props: {
Carrera={student.carrera.carrera}
Credito={student.credito}
/>
<div style={{height:"10px"}}> </div>
<div style={{ height: "10px" }}> </div>
<Toggle
defaultView={key}
options={[
{
key: "Recibo",
label: "Recibo",
content: <Receipt numAcount={student.id_cuenta} />,
},
{
key: "B/N",
label: "Impresiones B/N",
content: (
<Impressions
key={1}
costs={[{ value: 1 }, { value: 2 }]}
numAcount={student.id_cuenta}
id_servicio={1}
/>
),
},
{
key: "color",
label: "Impresiones color",
content: (
<Impressions
key={2}
costs={[
{ value: 4 },
{ value: 5 },
{ value: 6 },
{ value: 7 },
{ value: 8 },
{ value: 10 },
{ value: 12 },
{ value: 14 },
]}
numAcount={student.id_cuenta}
id_servicio={2}
/>
),
},
{
key: "Plotter",
label: "Plotter",
content: (
<Impressions
key={3}
costs={[
{ value: 15 },
{ value: 18 },
{ value: 20 },
{ value: 25 },
{ value: 30 },
{ value: 40 },
{ value: 45 },
{ value: 50 },
{ value: 60 },
{ value: 70 },
{ value: 80 },
{ value: 90 },
{ value: 100 },
{ value: 110 },
{ value: 120 },
{ value: 150 },
{ value: 200 },
]}
numAcount={student.id_cuenta}
id_servicio={3}
/>
),
},
{
key: "Escaner",
label: "Escaner",
content: (
<Impressions
key={4}
costs={[{ value: 1 }, { value: 2 }, { value: 5 }]}
numAcount={student.id_cuenta}
id_servicio={6}
/>
),
},
]}
options={optionsToUse}
/>
</>
)}
</section>
+4 -2
View File
@@ -3,6 +3,8 @@ import { envConfig } from "@/app/lib/config";
import { useEffect, useState } from "react";
import axios from "axios";
import "./inscripciones.css"
interface Periodo {
id_periodo: number;
semestre: string;
@@ -114,7 +116,7 @@ export default function Inscripciones() {
</div>
</form>
<div style={{overflowY:"auto",scrollbarWidth:"none", background:""}}>
<div className="containerTable">
<table>
<thead>
<tr>
@@ -131,7 +133,7 @@ export default function Inscripciones() {
<tbody>
{tablaData.map((row, index) => (
<tr key={index}>
<td>{row.carrera}</td>
<td className="textLeft">{row.carrera}</td>
<td>{row.genero ?? "-"}</td>
<td>{row.WINDOWS}</td>
<td>{row.MACINTOSH}</td>
+14
View File
@@ -0,0 +1,14 @@
.containerTable{
overflow: auto;
scrollbar-width: none;
background-color:rgba(84, 84, 84, 0.2) ;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-radius: 5px;
}
.textLeft{
padding-left: 20px;
text-align: start;
font-weight: bold;
}
@@ -60,16 +60,17 @@ function SearchUserWithDate(props: urlProp) {
<label className="label">Fecha</label>
<div className="groupInput">
<input
type="date"
value={date}
onChange={(e) => setDate(e.target.value)}
/>
</div>
<button className="button buttonSearch" type="submit">
Buscar
</button>
<button className="button buttonSearch" type="submit">
Buscar
</button>
</div>
</form>
);
}
+6 -6
View File
@@ -2,8 +2,8 @@ import Image from "next/image";
import Link from "next/link";
import BarNavigation from "../BarNavigation/BarNavigation";
import header from "./Header.module.css";
import { cookies } from "next/headers";
import BarNavigationServicio from "../BarNavigation/BarNavigationServicio";
import { cookies } from "next/headers";
export default async function Header() {
const cookieStore = await cookies();
@@ -29,11 +29,11 @@ export default async function Header() {
</Link>
<div className={header.yellowPart}></div>
<div className={header.containerBarNav}>
{role === "ADMINIS.TRADOR" && <BarNavigation />}
{role === "SUPER ADMINISTRADOR (quita sanciones)" && <BarNavigation />}
{role === "ADMINISTRADOR" && <BarNavigation/>}
{role === "ATENCION A USUARIO" && <BarNavigation/>}
{role === "SERVICIO SOCIAL" && <BarNavigationServicio/>}
{role === "1" && <BarNavigation />}
{role === "4" && <BarNavigation />}
{role === "2" && <BarNavigationServicio/>}
{role === "3" && <BarNavigationServicio/>}
</div>
</header>
);