Files
front-AT/app/Components/SearchUser/searchUser.tsx
T

51 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-09-02 19:50:17 -04:00
'use client'
2025-09-17 16:47:19 -06:00
import { useRouter } from "next/navigation";
2025-09-02 19:50:17 -04:00
import { useState } from "react";
2025-09-17 19:42:13 -06:00
interface urlProp{
urlBase:string
}
function SearchUser(url:urlProp) {
2025-09-22 12:15:32 -04:00
const [numAcount, setnumAcount] = useState("");
2025-09-17 16:47:19 -06:00
const router = useRouter();
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
2025-09-17 19:42:13 -06:00
2025-09-22 12:15:32 -04:00
if (numAcount) {
router.push(`/${url.urlBase}?numAcount=${numAcount}`);
2025-09-17 16:47:19 -06:00
}
};
return (
<>
<form className="containerForm"
onSubmit={handleSubmit}>
<label className="label">No.Cuenta</label>
<div className="groupInput">
<input
type="text"
2025-09-22 12:15:32 -04:00
value={numAcount}
2025-09-17 16:47:19 -06:00
onChange={(e) => {
const value = e.target.value;
if (/^\d*$/.test(value) && value.length <= 9) {
2025-09-22 12:15:32 -04:00
setnumAcount(value);
2025-09-17 16:47:19 -06:00
}
}}
placeholder="Coloca un número de cuenta..."
inputMode="numeric"
pattern="[0-9]*"
/>
<button className="button buttonSearch" type="submit">
Buscar
</button>
</div>
</form>
</>
);
2025-09-02 19:50:17 -04:00
}
2025-09-17 16:47:19 -06:00
export default SearchUser;