tring to fix sanciones
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import BitacoraAlumno from "@/app/Components/Reportes/BitacoraSanciones/BitacoraAlumno";
|
import BitacoraAlumno from "@/app/Components/Reportes/BitacoraSanciones/BitacoraAlumno";
|
||||||
import BitacoraEquipo from "@/app/Components/Reportes/BitacoraSanciones/BitacoraEquipo";
|
import BitacoraEquipo from "@/app/Components/Reportes/BitacoraSanciones/BitacoraEquipo";
|
||||||
import BitacoraMesas from "@/app/Components/Reportes/BitacoraSanciones/BitacoraMesas";
|
import BitacoraMesas from "@/app/Components/Reportes/BitacoraSanciones/BitacoraMesas";
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import Receipt from "../../Components/Receipt/Receipt";
|
|||||||
import Toggle from "../../Components/Global/Toggle/Toggle";
|
import Toggle from "../../Components/Global/Toggle/Toggle";
|
||||||
import Information from "../../Components/Global/Information/information";
|
import Information from "../../Components/Global/Information/information";
|
||||||
import AlertBox from "@/app/Components/Global/AlertBox/AlertBox";
|
import AlertBox from "@/app/Components/Global/AlertBox/AlertBox";
|
||||||
|
import Impressions from "@/app/Components/Servicios/Impressions/impressions";
|
||||||
import { GetStudent } from "@/app/lib/getStudent";
|
import { GetStudent } from "@/app/lib/getStudent";
|
||||||
|
|
||||||
import "@/app/globals.css";
|
import "@/app/globals.css";
|
||||||
import Impressions from "@/app/Components/Servicios/Impressions/impressions";
|
|
||||||
|
|
||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
searchParams?: Promise<{
|
searchParams?: Promise<{
|
||||||
@@ -46,7 +46,7 @@ export default async function Page(props: {
|
|||||||
<h2 className="title">IMPRESIONES Y PLOTEO</h2>
|
<h2 className="title">IMPRESIONES Y PLOTEO</h2>
|
||||||
<SearchUser urlBase="Impresiones" value={numAcount} />
|
<SearchUser urlBase="Impresiones" value={numAcount} />
|
||||||
|
|
||||||
{student ? (
|
{student && (
|
||||||
<>
|
<>
|
||||||
<Information
|
<Information
|
||||||
NoCuenta={student.id_cuenta}
|
NoCuenta={student.id_cuenta}
|
||||||
@@ -138,8 +138,6 @@ export default async function Page(props: {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,97 +1,49 @@
|
|||||||
"use client";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import styles from "./Page.module.css";
|
|
||||||
import SearchUser from "../../Global/SearchUser/searchUser";
|
import SearchUser from "../../Global/SearchUser/searchUser";
|
||||||
import Information from "../../Global/Information/information";
|
import Information from "../../Global/Information/information";
|
||||||
|
import AlertBox from "../../Global/AlertBox/AlertBox";
|
||||||
import { GetStudent } from "@/app/lib/getStudent";
|
import { GetStudent } from "@/app/lib/getStudent";
|
||||||
import { envConfig } from "@/app/lib/config";
|
|
||||||
|
|
||||||
interface sancion {
|
export default async function Sanciones(props: {
|
||||||
no_cuenta: number;
|
searchParams?: Promise<{
|
||||||
nombre: string;
|
numAcount: string;
|
||||||
motivo: string;
|
success?: string;
|
||||||
duracion: number;
|
error?: string;
|
||||||
fecha_sancion: string;
|
}>;
|
||||||
utilizar_hasta: number;
|
}) {
|
||||||
}
|
const params = await props.searchParams;
|
||||||
|
const numAcount = params?.numAcount ? params.numAcount : null;
|
||||||
|
const showSuccess = params?.success ? params.success : null;
|
||||||
|
let showError = params?.error ? params.error : null;
|
||||||
|
|
||||||
export default function Sanciones() {
|
let student: any = null;
|
||||||
const [sanciones, setSanciones] = useState<sancion[]>([]);
|
|
||||||
const [ubicacion_equipo, setUbicacionEquipo] = useState("");
|
|
||||||
const [no_cuenta, setNo_cuenta] = useState("");
|
|
||||||
|
|
||||||
useEffect(() => {
|
if (numAcount) {
|
||||||
fetch(`${envConfig.apiUrl}/student/${no_cuenta}`).then(
|
const result = await GetStudent(parseInt(numAcount));
|
||||||
(
|
|
||||||
response // Revisar
|
if (result.error) {
|
||||||
) => response.json().then((data) => setNo_cuenta(data[0].sancion))
|
showError = "alumno no encontrado";
|
||||||
);
|
} else {
|
||||||
}, [no_cuenta]);
|
student = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SearchUser urlBase="BitacoraSanciones" value="3" />
|
{showError && (
|
||||||
|
<>
|
||||||
|
<AlertBox key={Date.now()} message={showError} type="error" />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* <Information NoCuenta={sancion.id_cuenta} Nombre={student.nombre} /> */}
|
{showSuccess && (
|
||||||
|
<AlertBox key={Date.now()} message={showSuccess} type="success" />
|
||||||
|
)}
|
||||||
|
|
||||||
<form className="containerForm">
|
<SearchUser urlBase="BitacoraSanciones" value={numAcount} />
|
||||||
<label className="label">Ubicacion de equipo</label>
|
|
||||||
|
|
||||||
<div
|
{student && (
|
||||||
className="groupInput"
|
<Information NoCuenta={student.id_cuenta} Nombre={student.nombre} />
|
||||||
style={{ display: "flex", gap: "1rem", flexDirection: "row" }}
|
)}
|
||||||
>
|
|
||||||
<select
|
|
||||||
value={ubicacion_equipo}
|
|
||||||
onChange={(e) => setUbicacionEquipo(e.target.value)}
|
|
||||||
>
|
|
||||||
<option value="">-- Selecciona un equipo --</option>
|
|
||||||
<option value="255">Equipo 255</option>
|
|
||||||
</select>
|
|
||||||
<button className="button buttonSearch" type="submit">
|
|
||||||
Asignar
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div className={styles.tableContainer}>
|
|
||||||
<table className={styles.machineTable}>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Cuenta</th>
|
|
||||||
<th>Motivo de la sancion</th>
|
|
||||||
<th>Duracion (Semanas) </th>
|
|
||||||
<th>Fecha Sancion</th>
|
|
||||||
<th>Podra utilizar el servicio hasta</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{sanciones.map((sancion, index) => (
|
|
||||||
<tr key={index}>
|
|
||||||
<td>{sancion.no_cuenta}</td>
|
|
||||||
<td>{sancion.motivo}</td>
|
|
||||||
<td>{sancion.fecha_sancion}</td>
|
|
||||||
<td>{sancion.duracion}</td>
|
|
||||||
<td>{sancion.utilizar_hasta}</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<form className="containerForm">
|
|
||||||
<div className="groupInput">
|
|
||||||
<select
|
|
||||||
value={ubicacion_equipo}
|
|
||||||
onChange={(e) => setUbicacionEquipo(e.target.value)}
|
|
||||||
>
|
|
||||||
<option value="">-- Selecciona una sancion --</option>
|
|
||||||
<option value="sancion 1">No cerrar sesion (Una semana)</option>
|
|
||||||
</select>
|
|
||||||
<button className="button buttonSearch" type="submit">
|
|
||||||
Aplicar sancion
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import styles from "./Page.module.css";
|
||||||
|
|
||||||
|
interface alumno_sancion {
|
||||||
|
id_alumno_sancion: number;
|
||||||
|
fecha_inicio: string;
|
||||||
|
alumno: alumno;
|
||||||
|
sancion: sancion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface alumno {
|
||||||
|
id_cuenta: number;
|
||||||
|
nombre: string;
|
||||||
|
credito: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface sancion {
|
||||||
|
id_sancion: number;
|
||||||
|
sancion: string;
|
||||||
|
duracion: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function UbicacionEquipo() {
|
||||||
|
const [ubicacionEquipo, setUbicacionEquipo] = useState("");
|
||||||
|
const [sanciones, setSanciones] = useState<>([]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<form className="containerForm">
|
||||||
|
<label className="label">Ubicacion de equipo</label>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="groupInput"
|
||||||
|
style={{ display: "flex", gap: "1rem", flexDirection: "row" }}
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
value={ubicacionEquipo}
|
||||||
|
onChange={(e) => setUbicacionEquipo(e.target.value)}
|
||||||
|
>
|
||||||
|
<option value="">-- Selecciona un equipo --</option>
|
||||||
|
<option value="255">Equipo 255</option>
|
||||||
|
</select>
|
||||||
|
<button className="button buttonSearch" type="submit">
|
||||||
|
Asignar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div className={styles.tableContainer}>
|
||||||
|
<table className={styles.machineTable}>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Cuenta</th>
|
||||||
|
<th>Motivo de la sancion</th>
|
||||||
|
<th>Duracion (Semanas) </th>
|
||||||
|
<th>Fecha Sancion</th>
|
||||||
|
<th>Podra utilizar el servicio hasta</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{sanciones &&
|
||||||
|
sanciones.map((sancion, index) => (
|
||||||
|
<tr key={index}>
|
||||||
|
<td>{sancion.id_sancion}</td>
|
||||||
|
<td>{sancion.sancion}</td>
|
||||||
|
<td>{sancion.fecha_sancion}</td>
|
||||||
|
<td>{sancion.duracion}</td>
|
||||||
|
<td>{sancion.utilizar_hasta}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form className="containerForm">
|
||||||
|
<div className="groupInput">
|
||||||
|
<select
|
||||||
|
value={ubicacionEquipo}
|
||||||
|
onChange={(e) => setUbicacionEquipo(e.target.value)}
|
||||||
|
>
|
||||||
|
<option value="">-- Selecciona una sancion --</option>
|
||||||
|
<option value="sancion 1">No cerrar sesion (Una semana)</option>
|
||||||
|
</select>
|
||||||
|
<button className="button buttonSearch" type="submit">
|
||||||
|
Aplicar sancion
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//IO
|
||||||
Reference in New Issue
Block a user