modified impresions to role = 5

This commit is contained in:
2026-02-19 18:59:21 -06:00
parent 3e85cb862d
commit 65fcf5eaff
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 ShowError from "@/app/Components/Global/ShowError";
import { GetStudent } from "@/app/lib/getStudent"; import { GetStudent } from "@/app/lib/getStudent";
import { cookies } from "next/headers";
import "@/app/globals.css"; import "@/app/globals.css";
@@ -19,6 +20,10 @@ export default async function Page(props: {
const key = params?.key && params.key; const key = params?.key && params.key;
const numAcount = params?.numAcount ? params.numAcount : null; 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 student: any = null;
let errorMessage = ""; 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 ( return (
<section className="containerSection"> <section className="containerSection">
{errorMessage && <ShowError key={Date.now()} message={errorMessage} />} {errorMessage && <ShowError key={Date.now()} message={errorMessage} />}
@@ -47,92 +115,13 @@ export default async function Page(props: {
Carrera={student.carrera.carrera} Carrera={student.carrera.carrera}
Credito={student.credito} Credito={student.credito}
/> />
<div style={{height:"10px"}}> </div> <div style={{ height: "10px" }}> </div>
<Toggle <Toggle
defaultView={key} defaultView={key}
options={[ options={optionsToUse}
{
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}
/>
),
},
]}
/> />
</> </>
)} )}
</section> </section>
+4 -2
View File
@@ -3,6 +3,8 @@ import { envConfig } from "@/app/lib/config";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import axios from "axios"; import axios from "axios";
import "./inscripciones.css"
interface Periodo { interface Periodo {
id_periodo: number; id_periodo: number;
semestre: string; semestre: string;
@@ -114,7 +116,7 @@ export default function Inscripciones() {
</div> </div>
</form> </form>
<div style={{overflowY:"auto",scrollbarWidth:"none", background:""}}> <div className="containerTable">
<table> <table>
<thead> <thead>
<tr> <tr>
@@ -131,7 +133,7 @@ export default function Inscripciones() {
<tbody> <tbody>
{tablaData.map((row, index) => ( {tablaData.map((row, index) => (
<tr key={index}> <tr key={index}>
<td>{row.carrera}</td> <td className="textLeft">{row.carrera}</td>
<td>{row.genero ?? "-"}</td> <td>{row.genero ?? "-"}</td>
<td>{row.WINDOWS}</td> <td>{row.WINDOWS}</td>
<td>{row.MACINTOSH}</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> <label className="label">Fecha</label>
<div className="groupInput"> <div className="groupInput">
<input <input
type="date" type="date"
value={date} value={date}
onChange={(e) => setDate(e.target.value)} onChange={(e) => setDate(e.target.value)}
/> />
</div>
<button className="button buttonSearch" type="submit"> <button className="button buttonSearch" type="submit">
Buscar Buscar
</button> </button>
</div>
</form> </form>
); );
} }
+6 -6
View File
@@ -2,8 +2,8 @@ import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import BarNavigation from "../BarNavigation/BarNavigation"; import BarNavigation from "../BarNavigation/BarNavigation";
import header from "./Header.module.css"; import header from "./Header.module.css";
import { cookies } from "next/headers";
import BarNavigationServicio from "../BarNavigation/BarNavigationServicio"; import BarNavigationServicio from "../BarNavigation/BarNavigationServicio";
import { cookies } from "next/headers";
export default async function Header() { export default async function Header() {
const cookieStore = await cookies(); const cookieStore = await cookies();
@@ -29,11 +29,11 @@ export default async function Header() {
</Link> </Link>
<div className={header.yellowPart}></div> <div className={header.yellowPart}></div>
<div className={header.containerBarNav}> <div className={header.containerBarNav}>
{role === "ADMINIS.TRADOR" && <BarNavigation />} {role === "1" && <BarNavigation />}
{role === "SUPER ADMINISTRADOR (quita sanciones)" && <BarNavigation />} {role === "4" && <BarNavigation />}
{role === "ADMINISTRADOR" && <BarNavigation/>}
{role === "ATENCION A USUARIO" && <BarNavigation/>} {role === "2" && <BarNavigationServicio/>}
{role === "SERVICIO SOCIAL" && <BarNavigationServicio/>} {role === "3" && <BarNavigationServicio/>}
</div> </div>
</header> </header>
); );