Creacion de nuevo componente y arreglos de botones

This commit is contained in:
2025-10-13 16:47:17 -06:00
parent 139c0b5072
commit d05bf5a3ea
5 changed files with 79 additions and 22 deletions
@@ -3,6 +3,7 @@ import SearchDate from "../SearchDate/SearchDate";
import { useState } from "react";
import styles from "./Page.module.css";
import SearchUserWithDate from "../Global/SearchUser/SearchUserWithDate";
interface alumnos {
tiempo_entrada: string;
@@ -14,8 +15,7 @@ function BitacoraAlumno() {
const [alumnos, setAlumnos] = useState<alumnos[]>([]);
return (
<>
<SearchDate />
<div className={styles.tableContainer} style={{marginTop:"1rem"}}>
<div className={styles.tableContainer} style={{ marginTop: "1rem" }}>
<table className={styles.machineTable}>
<thead>
<tr>
@@ -16,7 +16,6 @@ function BitacoraEquipo() {
const [ubicacion_equipo, setUbicacionEquipo] = useState("");
return (
<>
<SearchDate />
<form className="containerForm">
<label className="label">Ubicacion de equipo</label>
@@ -28,12 +27,10 @@ function BitacoraEquipo() {
<option value="">-- Selecciona un equipo --</option>
<option value="255">Equipo 255</option>
</select>
<button className="button buttonSearch" type="submit">
Asignar
</button>
</div>
<SearchDate />
</form>
<div className={styles.tableContainer} style={{marginTop:"1rem"}}>
<div className={styles.tableContainer} style={{ marginTop: "1rem" }}>
<table className={styles.machineTable}>
<thead>
<tr>
@@ -0,0 +1,58 @@
"use client";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import SearchDate from "../../SearchDate/SearchDate";
interface urlProp {
value: string | null;
}
function SearchUserWithDate(props: urlProp) {
const [numAcount, setnumAcount] = useState("");
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
useEffect(() => {
if (props.value) {
setnumAcount(props.value);
}
}, [props.value]);
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const params = new URLSearchParams(searchParams.toString());
if (numAcount) {
params.set("numAcount", `${numAcount}`);
router.push(`${pathname}?${params.toString()}`);
}
};
return (
<>
<form className="containerForm" onSubmit={handleSubmit}>
<label className="label">No.Cuenta</label>
<div className="groupInput">
<input
type="text"
value={numAcount}
onChange={(e) => {
const value = e.target.value;
if (/^\d*$/.test(value) && value.length <= 9) {
setnumAcount(value);
}
}}
placeholder="Coloca un número de cuenta..."
inputMode="numeric"
pattern="[0-9]*"
/>
<SearchDate />
</div>
</form>
</>
);
}
export default SearchUserWithDate;
//IO