add value to searchUser
This commit is contained in:
@@ -3,7 +3,15 @@ import SearchUser from "@/app/Components/SearchUser/searchUser";
|
||||
import Toggle from "@/app/Components/Toggle/Toggle";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function Page() {
|
||||
export default function Page(props: {
|
||||
searchParams?: Promise<{
|
||||
numAcount: string;
|
||||
success?: string;
|
||||
error?: string;
|
||||
}>;
|
||||
}) {
|
||||
const params = props.searchParams;
|
||||
|
||||
const [tiempo, setTiempo] = useState("");
|
||||
const [selectedTable, setSelectedTable] = useState(null);
|
||||
|
||||
@@ -11,115 +19,113 @@ export default function Page() {
|
||||
<section className="containerSection">
|
||||
<h2 className="title">EQUIPOS ACTIVOS Y EN MANTENIMIENTO</h2>
|
||||
|
||||
<Toggle
|
||||
defaultView="Equipos"
|
||||
options={[
|
||||
{
|
||||
key: "Equipos",
|
||||
label: "Equipos",
|
||||
content: (
|
||||
<>
|
||||
<SearchUser urlBase="ActivosMantenimiento" />
|
||||
<Toggle
|
||||
defaultView="Equipos"
|
||||
options={[
|
||||
{
|
||||
key: "Equipos",
|
||||
label: "Equipos",
|
||||
content: (
|
||||
<>
|
||||
<SearchUser urlBase="ActivosMantenimiento" value={"2"} />
|
||||
|
||||
<form className="containerForm">
|
||||
<label className="label">Equipos disponibles</label>
|
||||
<div className="groupInput">
|
||||
<select
|
||||
value={tiempo}
|
||||
onChange={(e) => setTiempo(e.target.value)}
|
||||
>
|
||||
<option value="">-- Equipos disponibles --</option>
|
||||
<option value="15">1</option>
|
||||
<option value="30">2</option>
|
||||
<option value="45">3</option>
|
||||
<option value="60">4</option>
|
||||
<option value="90">5</option>
|
||||
<option value="120">6</option>
|
||||
</select>
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Asignar
|
||||
</button>
|
||||
<form className="containerForm">
|
||||
<label className="label">Equipos disponibles</label>
|
||||
<div className="groupInput">
|
||||
<select
|
||||
value={tiempo}
|
||||
onChange={(e) => setTiempo(e.target.value)}
|
||||
>
|
||||
<option value="">-- Equipos disponibles --</option>
|
||||
<option value="15">1</option>
|
||||
<option value="30">2</option>
|
||||
<option value="45">3</option>
|
||||
<option value="60">4</option>
|
||||
<option value="90">5</option>
|
||||
<option value="120">6</option>
|
||||
</select>
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Asignar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "Areas",
|
||||
label: "Areas",
|
||||
content: (
|
||||
<>
|
||||
<form className="containerForm">
|
||||
<label className="label">Áreas disponibles</label>
|
||||
<div className="groupInput">
|
||||
<select
|
||||
value={tiempo}
|
||||
onChange={(e) => setTiempo(e.target.value)}
|
||||
>
|
||||
<option value="">-- Áreas disponibles --</option>
|
||||
<option value="15">PECERA</option>
|
||||
<option value="30">JAULA</option>
|
||||
<option value="45">HUACAL</option>
|
||||
<option value="60">PCNET1</option>
|
||||
<option value="90">PCNET2</option>
|
||||
</select>
|
||||
|
||||
<div className="checkbox-grid">
|
||||
<label>
|
||||
<input type="checkbox" />
|
||||
Activo
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" />
|
||||
Mantenimiento
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "Areas",
|
||||
label: "Areas",
|
||||
content: (
|
||||
<>
|
||||
<form className="containerForm">
|
||||
<label className="label">Áreas disponibles</label>
|
||||
<div className="groupInput">
|
||||
<select
|
||||
value={tiempo}
|
||||
onChange={(e) => setTiempo(e.target.value)}
|
||||
>
|
||||
<option value="">-- Áreas disponibles --</option>
|
||||
<option value="15">PECERA</option>
|
||||
<option value="30">JAULA</option>
|
||||
<option value="45">HUACAL</option>
|
||||
<option value="60">PCNET1</option>
|
||||
<option value="90">PCNET2</option>
|
||||
</select>
|
||||
|
||||
<div className="checkbox-grid">
|
||||
<label>
|
||||
<input type="checkbox" />
|
||||
Activo
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" />
|
||||
Mantenimiento
|
||||
</label>
|
||||
</div>
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Actualizar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "Mesas",
|
||||
label: "Liberar mesa",
|
||||
content: (
|
||||
<>
|
||||
<form className="containerForm">
|
||||
<label className="label">Mesas disponibles</label>
|
||||
<div className="groupInput">
|
||||
<select
|
||||
value={tiempo}
|
||||
onChange={(e) => setTiempo(e.target.value)}
|
||||
>
|
||||
<option value="">-- Mesas disponibles --</option>
|
||||
<option value="15">1</option>
|
||||
<option value="30">4</option>
|
||||
<option value="45">7</option>
|
||||
<option value="60">10</option>
|
||||
<option value="90">15</option>
|
||||
</select>
|
||||
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Actualizar
|
||||
</button>
|
||||
<div className="checkbox">
|
||||
<input type="checkbox" />
|
||||
<label>Mantenimiento</label>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "Mesas",
|
||||
label: "Liberar mesa",
|
||||
content: (
|
||||
<>
|
||||
<form className="containerForm">
|
||||
<label className="label">Mesas disponibles</label>
|
||||
<div className="groupInput">
|
||||
<select
|
||||
value={tiempo}
|
||||
onChange={(e) => setTiempo(e.target.value)}
|
||||
>
|
||||
<option value="">-- Mesas disponibles --</option>
|
||||
<option value="15">1</option>
|
||||
<option value="30">4</option>
|
||||
<option value="45">7</option>
|
||||
<option value="60">10</option>
|
||||
<option value="90">15</option>
|
||||
</select>
|
||||
|
||||
<div className="checkbox">
|
||||
<input type="checkbox" />
|
||||
<label>
|
||||
Mantenimiento
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Confirmar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Confirmar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,32 +5,34 @@ import { GetStudent } from "@/app/lib/getStudent";
|
||||
|
||||
import "./addTime.css";
|
||||
|
||||
export default async function Page(props:{
|
||||
export default async function Page(props: {
|
||||
searchParams?: Promise<{
|
||||
numAcount:string;
|
||||
}>
|
||||
numAcount: string;
|
||||
}>;
|
||||
}) {
|
||||
|
||||
const params =await props.searchParams;
|
||||
const numAcount = params?.numAcount ? parseInt(params.numAcount) : null;
|
||||
const params = await props.searchParams;
|
||||
const numAcount = params?.numAcount ? params.numAcount : null;
|
||||
|
||||
let student: any = null;
|
||||
if (numAcount) {
|
||||
student = await GetStudent(numAcount);
|
||||
student = await GetStudent(parseInt(numAcount));
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="containerSection">
|
||||
<h2 className="title"> AGREGAR TIEMPO </h2>
|
||||
|
||||
<SearchUser urlBase="AgregarTiempo" />
|
||||
<SearchUser urlBase="AgregarTiempo" value={numAcount} />
|
||||
|
||||
{student ? (
|
||||
<>
|
||||
<Information NoCuenta={student.id_cuenta} Nombre={student.nombre} />
|
||||
|
||||
<div className="addTime">
|
||||
<Receipt numAcount={student.id_cuenta} />
|
||||
<Receipt
|
||||
urlBase={"/ActivosMantenimiento"}
|
||||
numAcount={student.id_cuenta}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -1,50 +1,45 @@
|
||||
"use client";
|
||||
import SearchUser from "@/app/Components/SearchUser/searchUser";
|
||||
import Toggle from "@/app/Components/Toggle/Toggle";
|
||||
import { useState } from "react";
|
||||
// Assuming you will create this new component
|
||||
|
||||
export default function Page() {
|
||||
const [tiempo, setTiempo] = useState("");
|
||||
const [selectedTable, setSelectedTable] = useState(null);
|
||||
|
||||
return (
|
||||
<section className="containerSection">
|
||||
<h2 className="title"> ASIGNACION DE EQUIPOS </h2>
|
||||
|
||||
<Toggle
|
||||
defaultView="Asignar"
|
||||
options={[
|
||||
{
|
||||
key: "Asignar",
|
||||
label: "Asignar tiempo",
|
||||
content: (
|
||||
<>
|
||||
<SearchUser urlBase="AsignacionEquipo"/>
|
||||
<Toggle
|
||||
defaultView="Asignar"
|
||||
options={[
|
||||
{
|
||||
key: "Asignar",
|
||||
label: "Asignar tiempo",
|
||||
content: (
|
||||
<>
|
||||
<SearchUser urlBase="AsignacionEquipo" value={"2"} />
|
||||
|
||||
<form className="containerForm"></form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "Liberar",
|
||||
label: "Cancelar tiempo",
|
||||
content: (
|
||||
<>
|
||||
<div className="checkbox-grid">
|
||||
<label>
|
||||
<input type="checkbox" /> Equipo
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" /> Cuenta
|
||||
</label>
|
||||
</div>
|
||||
<SearchUser urlBase="AsignacionEquipo"/>
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<form className="containerForm"></form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "Liberar",
|
||||
label: "Cancelar tiempo",
|
||||
content: (
|
||||
<>
|
||||
<div className="checkbox-grid">
|
||||
<label>
|
||||
<input type="checkbox" /> Equipo
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" /> Cuenta
|
||||
</label>
|
||||
</div>
|
||||
<SearchUser urlBase="AsignacionEquipo" value={"2"} />
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,68 +2,66 @@
|
||||
import SearchUser from "@/app/Components/SearchUser/searchUser";
|
||||
import Toggle from "@/app/Components/Toggle/Toggle";
|
||||
import { useState } from "react";
|
||||
// Assuming you will create this new component
|
||||
|
||||
export default function Page() {
|
||||
const [tiempo, setTiempo] = useState("");
|
||||
const [selectedTable, setSelectedTable] = useState(null);
|
||||
|
||||
return (
|
||||
<section className="containerSection">
|
||||
<h2 className="title"> ASIGNACION DE MESAS </h2>
|
||||
|
||||
<Toggle
|
||||
defaultView="Asignar"
|
||||
options={[
|
||||
{
|
||||
key: "Asignar",
|
||||
label: "Asignar mesa",
|
||||
content: (
|
||||
<>
|
||||
<SearchUser urlBase="AsignacionMesas"/>
|
||||
<Toggle
|
||||
defaultView="Asignar"
|
||||
options={[
|
||||
{
|
||||
key: "Asignar",
|
||||
label: "Asignar mesa",
|
||||
content: (
|
||||
<>
|
||||
<SearchUser urlBase="AsignacionMesas" value={"3"} />
|
||||
|
||||
<form className="containerForm">
|
||||
<label className="label">Mesas disponibles</label>
|
||||
<div className="groupInput">
|
||||
<select
|
||||
value={tiempo}
|
||||
onChange={(e) => setTiempo(e.target.value)}
|
||||
>
|
||||
<option value="">-- Mesas disponibles --</option>
|
||||
<option value="15">1 </option>
|
||||
<option value="30">3 </option>
|
||||
<option value="45">4 </option>
|
||||
<option value="60">22 </option>
|
||||
<option value="90">15 </option>
|
||||
<option value="120">20 </option>
|
||||
</select>
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Asignar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "Liberar",
|
||||
label: "Liberar mesa",
|
||||
content: (
|
||||
<>
|
||||
<div className="checkbox-grid">
|
||||
<label>
|
||||
<input type="checkbox" /> Mesa
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" /> Cuenta
|
||||
</label>
|
||||
<form className="containerForm">
|
||||
<label className="label">Mesas disponibles</label>
|
||||
<div className="groupInput">
|
||||
<select
|
||||
value={tiempo}
|
||||
onChange={(e) => setTiempo(e.target.value)}
|
||||
>
|
||||
<option value="">-- Mesas disponibles --</option>
|
||||
<option value="15">1 </option>
|
||||
<option value="30">3 </option>
|
||||
<option value="45">4 </option>
|
||||
<option value="60">22 </option>
|
||||
<option value="90">15 </option>
|
||||
<option value="120">20 </option>
|
||||
</select>
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Asignar
|
||||
</button>
|
||||
</div>
|
||||
<SearchUser urlBase="AsignacionMesas"/>
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</form>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "Liberar",
|
||||
label: "Liberar mesa",
|
||||
content: (
|
||||
<>
|
||||
<div className="checkbox-grid">
|
||||
<label>
|
||||
<input type="checkbox" /> Mesa
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" /> Cuenta
|
||||
</label>
|
||||
</div>
|
||||
<SearchUser urlBase="AsignacionMesas" value={"3"} />
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,16 +8,16 @@ import Information from "@/app/Components/Information/information";
|
||||
import SearchUser from "@/app/Components/SearchUser/searchUser";
|
||||
import { GetStudent } from "@/app/lib/getStudent";
|
||||
|
||||
export default async function Page(props:{
|
||||
export default async function Page(props: {
|
||||
searchParams?: Promise<{
|
||||
numAcount:string;
|
||||
}>
|
||||
numAcount: string;
|
||||
}>;
|
||||
}) {
|
||||
const params =await props.searchParams;
|
||||
const numAcount = params?.numAcount ? parseInt(params.numAcount) : null;
|
||||
const params = await props.searchParams;
|
||||
const numAcount = params?.numAcount ? params.numAcount : null;
|
||||
|
||||
let student: any = null;
|
||||
let error: string | null = null;
|
||||
let student: any = null;
|
||||
let error: string | null = null;
|
||||
|
||||
const [usuario_sanciones] = useState([
|
||||
{
|
||||
@@ -177,8 +177,8 @@ export default async function Page(props:{
|
||||
label: "Sanciones",
|
||||
content: (
|
||||
<>
|
||||
<SearchUser urlBase="BitacoraSanciones" />
|
||||
|
||||
<SearchUser urlBase="BitacoraSanciones" value={numAcount} />
|
||||
|
||||
<Information NoCuenta="id cuenta" Nombre="id nombre" />
|
||||
|
||||
<form className="containerForm">
|
||||
|
||||
@@ -25,7 +25,7 @@ export default async function Page(props: {
|
||||
const result = await GetStudent(parseInt(numAcount));
|
||||
|
||||
if (result.error) {
|
||||
showError = "Alumno no encontrado"
|
||||
showError = "Alumno no encontrado";
|
||||
} else {
|
||||
student = result;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ export default async function Page(props: {
|
||||
)}
|
||||
|
||||
<h2 className="title">IMPRESIONES Y PLOTEO</h2>
|
||||
<SearchUser urlBase="Impresiones" value={numAcount}/>
|
||||
<SearchUser urlBase="Impresiones" value={numAcount} />
|
||||
|
||||
{student ? (
|
||||
<>
|
||||
@@ -59,7 +59,12 @@ export default async function Page(props: {
|
||||
{
|
||||
key: "1",
|
||||
label: "Recibo",
|
||||
content: <Receipt numAcount={student.id_cuenta} />,
|
||||
content: (
|
||||
<Receipt
|
||||
urlBase="/Impresiones"
|
||||
numAcount={student.id_cuenta}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "2",
|
||||
|
||||
@@ -7,19 +7,18 @@ import { GetStudent } from "@/app/lib/getStudent";
|
||||
|
||||
import "./inscriptions.css";
|
||||
|
||||
export default async function Page(props:{
|
||||
export default async function Page(props: {
|
||||
searchParams?: Promise<{
|
||||
numAcount:string;
|
||||
}>
|
||||
numAcount: string;
|
||||
}>;
|
||||
}) {
|
||||
|
||||
const params =await props.searchParams;
|
||||
const numAcount = params?.numAcount ? parseInt(params.numAcount) : null;
|
||||
const params = await props.searchParams;
|
||||
const numAcount = params?.numAcount ? params.numAcount : null;
|
||||
|
||||
let student: any = null;
|
||||
let error: string | null = null;
|
||||
if (numAcount) {
|
||||
const result = await GetStudent(numAcount);
|
||||
const result = await GetStudent(parseInt(numAcount));
|
||||
|
||||
if (result.error) {
|
||||
error = result.error;
|
||||
@@ -32,7 +31,7 @@ export default async function Page(props:{
|
||||
<section className="containerSection">
|
||||
<h2 className="title"> INSCRIPCION </h2>
|
||||
|
||||
<SearchUser urlBase="Inscripciones" />
|
||||
<SearchUser urlBase="Inscripciones" value={numAcount} />
|
||||
|
||||
{student ? (
|
||||
<>
|
||||
@@ -45,7 +44,7 @@ export default async function Page(props:{
|
||||
|
||||
<StepNavigator totalSteps={2}>
|
||||
<Selection />
|
||||
<Receipt numAcount={student.id_cuenta}/>
|
||||
<Receipt urlBase={"Inscripciones"} numAcount={student.id_cuenta} />
|
||||
</StepNavigator>
|
||||
</>
|
||||
) : (
|
||||
@@ -54,4 +53,4 @@ export default async function Page(props:{
|
||||
</section>
|
||||
);
|
||||
}
|
||||
//IO
|
||||
//IO
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function Page() {
|
||||
return (
|
||||
<section className="containerSection">
|
||||
<h2 className="title"> Quitar Sanciones </h2>
|
||||
<SearchUser urlBase="QuitarSancion"/>
|
||||
<SearchUser urlBase="QuitarSancion" value={"2"} />
|
||||
<div className={styles.tableContainer}>
|
||||
<table className={styles.machineTable}>
|
||||
<thead>
|
||||
|
||||
@@ -10,6 +10,7 @@ function Login() {
|
||||
const [user, setUser] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
const [alert, setAlert] = useState("");
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@@ -28,7 +29,7 @@ function Login() {
|
||||
document.cookie = `token=${token}; path=/; SameSite=Strict`;
|
||||
document.cookie = `id_usuario=${id_usuario}; path=/; SameSite=Strict`;
|
||||
|
||||
setError("Inicio de sesión exitoso");
|
||||
setAlert("Inicio de sesión exitoso");
|
||||
router.push("/Impresiones");
|
||||
}
|
||||
};
|
||||
@@ -71,6 +72,7 @@ function Login() {
|
||||
</button>
|
||||
|
||||
{error && <AlertBox message={error} type="error" />}
|
||||
{alert && <AlertBox message={alert} type="success" />}
|
||||
</form>
|
||||
</section>
|
||||
);
|
||||
|
||||
@@ -7,10 +7,11 @@ import { useRouter } from "next/navigation";
|
||||
import "./Receipt.css";
|
||||
|
||||
interface ReceiptsProps {
|
||||
urlBase:string;
|
||||
numAcount: number | null;
|
||||
}
|
||||
|
||||
function Receipt({ numAcount }: ReceiptsProps) {
|
||||
function Receipt({urlBase , numAcount }: ReceiptsProps) {
|
||||
const router = useRouter();
|
||||
|
||||
const [folio, setFolio] = useState("");
|
||||
@@ -30,27 +31,27 @@ function Receipt({ numAcount }: ReceiptsProps) {
|
||||
const handleSaveReceipt = async () => {
|
||||
if (!numAcount) {
|
||||
router.push(
|
||||
`/Impresiones?numAcount=${numAcount}&error=Error busca denuevo al estudiante`
|
||||
`/${urlBase}?numAcount=${numAcount}&error=Error busca denuevo al estudiante`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!folio) {
|
||||
router.push(
|
||||
`/Impresiones?numAcount=${numAcount}&error=Ingresa el folio del tiket`
|
||||
`/${urlBase}?numAcount=${numAcount}&error=Ingresa el folio del tiket`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!amount) {
|
||||
router.push(
|
||||
`/Impresiones?numAcount=${numAcount}&error=coloca el monto a depositar`
|
||||
`/${urlBase}?numAcount=${numAcount}&error=coloca el monto a depositar`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!date) {
|
||||
router.push(`/Impresiones?numAcount=${numAcount}&error=coloca la fecha`);
|
||||
router.push(`/${urlBase}?numAcount=${numAcount}&error=coloca la fecha`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,10 +67,10 @@ function Receipt({ numAcount }: ReceiptsProps) {
|
||||
setAmount("");
|
||||
setDate("");
|
||||
|
||||
router.push(`/Impresiones?numAcount=${numAcount}&success=1`);
|
||||
router.push(`/${urlBase}?numAcount=${numAcount}&success=1`);
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
router.push(`/Impresiones?numAcount=${numAcount}&error=${err}`);
|
||||
router.push(`/${urlBase}?numAcount=${numAcount}&error=${err}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user