Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import "../styles/components/editar";
|
||||
export default function Page() {
|
||||
return (
|
||||
<form className="editar">
|
||||
<div className="columna">
|
||||
<label htmlFor="serie">Serie</label>
|
||||
<input type="text" id="serie" />
|
||||
<label htmlFor="marca">Marca</label>
|
||||
<input type="text" id="marca" />
|
||||
<label htmlFor="modelo">Modelo</label>
|
||||
<input type="text" id="modelo" />
|
||||
<label htmlFor="estado">Estado</label>
|
||||
<input type="text" id="estado" />
|
||||
</div>
|
||||
|
||||
<div className="columna">
|
||||
<label htmlFor="so">Sistema Operativo</label>
|
||||
<input type="text" id="so" />
|
||||
<label htmlFor="procesador">Procesador</label>
|
||||
<input type="text" id="procesador" />
|
||||
<label htmlFor="tipoUso">Tipo de uso</label>
|
||||
<input type="text" id="tipoUso" />
|
||||
<label htmlFor="observaciones">Observaciones</label>
|
||||
<input type="text" id="observaciones" />
|
||||
</div>
|
||||
|
||||
<div className="columna">
|
||||
<label htmlFor="adscripcion">Adscripción</label>
|
||||
<input type="text" id="adscripcion" />
|
||||
<label htmlFor="responsable">Responsable</label>
|
||||
<input type="text" id="responsable" />
|
||||
<label htmlFor="lugar">Lugar</label>
|
||||
<input type="text" id="lugar" />
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import BarcodeScanner from "../../components/BarcodeScanner";
|
||||
import "../styles/components/dashboard.scss";
|
||||
|
||||
type Equipo = {
|
||||
id: string;
|
||||
nombre: string;
|
||||
estado: string;
|
||||
};
|
||||
|
||||
const initialEquipos: Equipo[] = [
|
||||
{ id: "001", nombre: "PC Aula 1", estado: "Disponible" },
|
||||
{ id: "002", nombre: "PC Aula 2", estado: "En reparación" },
|
||||
];
|
||||
|
||||
export default function Dashboard() {
|
||||
const router = useRouter();
|
||||
const [equipos, setEquipos] = useState<Equipo[]>(initialEquipos);
|
||||
const [search, setSearch] = useState("");
|
||||
const [lastScan, setLastScan] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
const loggedIn = localStorage.getItem("loggedIn");
|
||||
if (!loggedIn) router.push("/");
|
||||
}, [router]);
|
||||
|
||||
const buscarEquipo = () => {
|
||||
const resultado = equipos.filter(
|
||||
e => e.id.includes(search) || e.nombre.toLowerCase().includes(search.toLowerCase())
|
||||
);
|
||||
setEquipos(resultado);
|
||||
};
|
||||
|
||||
const cerrarSesion = () => {
|
||||
localStorage.removeItem("loggedIn");
|
||||
router.push("/");
|
||||
};
|
||||
|
||||
const handleScan = (code: string) => {
|
||||
setLastScan(code);
|
||||
|
||||
const encontrado = equipos.find(e => e.id === code);
|
||||
if (encontrado) {
|
||||
alert(`Equipo encontrado: ${encontrado.nombre} (${encontrado.estado})`);
|
||||
} else {
|
||||
const nombre = prompt("Equipo no registrado. Ingresa el nombre:");
|
||||
if (nombre) {
|
||||
setEquipos([...equipos, { id: code, nombre, estado: "Disponible" }]);
|
||||
alert("Equipo agregado al inventario");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="dashboard-container">
|
||||
<div className="header">
|
||||
<h2>Dashboard Inventario Escolar</h2>
|
||||
<button onClick={cerrarSesion}>Cerrar sesión</button>
|
||||
</div>
|
||||
|
||||
<div className="search-section">
|
||||
<h3>Buscar equipo</h3>
|
||||
<div style={{ display: "flex", marginTop: "10px" }}>
|
||||
<input type="text" placeholder="ID o nombre" value={search} onChange={(e) => setSearch(e.target.value)} />
|
||||
<button onClick={buscarEquipo}>Buscar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="scanner-section">
|
||||
<h3>Escanear código de barras</h3>
|
||||
<BarcodeScanner onDetected={handleScan} />
|
||||
{lastScan && <p>Último código escaneado: <strong>{lastScan}</strong></p>}
|
||||
</div>
|
||||
|
||||
<div className="equipos-section">
|
||||
<h3>Equipos</h3>
|
||||
<ul>
|
||||
{equipos.map((e) => (
|
||||
<li key={e.id}>
|
||||
<span>{e.id} - {e.nombre}</span>
|
||||
<span className={e.estado === "Disponible" ? "estado-disponible" : "estado-reparacion"}>{e.estado}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import Header from "../components/header";
|
||||
|
||||
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="es">
|
||||
<body>
|
||||
<Header />
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
"use client"; // <-- OBLIGATORIO
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import "../app/styles/components/login.scss";
|
||||
export default function Login() {
|
||||
const router = useRouter();
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
|
||||
const mockUsers = [
|
||||
{ email: "admin@escuela.com", password: "1234" },
|
||||
{ email: "usuario@escuela.com", password: "abcd" },
|
||||
];
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
const user = mockUsers.find(u => u.email === email && u.password === password);
|
||||
|
||||
if (user) {
|
||||
localStorage.setItem("loggedIn", "true");
|
||||
router.push("/dashboard");
|
||||
} else {
|
||||
setError("Usuario o contraseña incorrectos");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="login-container">
|
||||
<h2>Iniciar sesión</h2>
|
||||
{error && <p className="error">{error}</p>}
|
||||
<form onSubmit={handleSubmit}>
|
||||
<input type="email" placeholder="Correo" value={email} onChange={(e) => setEmail(e.target.value)} required />
|
||||
<input type="password" placeholder="Contraseña" value={password} onChange={(e) => setPassword(e.target.value)} required />
|
||||
<button type="submit">Ingresar</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
.barNavigation {
|
||||
text-align: center;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
height: 45px;
|
||||
max-height: 40px;
|
||||
}
|
||||
|
||||
.barNavigation ul {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
width: 100%;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.barNavigation li {
|
||||
transition: all 0.3s ease;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
width: 100%;
|
||||
transition: background-color 0.3s ease;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.barNavigation li:hover {
|
||||
background-color: #bd8c01;
|
||||
}
|
||||
|
||||
.barNavigation ul.active {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.menuToggle {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.menuToggle div {
|
||||
width: 25px;
|
||||
height: 3px;
|
||||
background-color: black;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.subMenu {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
|
||||
.subMenu ul {
|
||||
opacity: 0;
|
||||
max-height: 0;
|
||||
position: absolute;
|
||||
flex-direction: column;
|
||||
top: 100%;
|
||||
width: 100%;
|
||||
background-color: #003e79;
|
||||
transition: color 0.3s ease;
|
||||
transition: opacity 0.4s ease, max-height 0.4s ease;
|
||||
}
|
||||
|
||||
.subMenu ul a {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.subMenu.open ul {
|
||||
display: flex;
|
||||
color: rgba(0, 61, 121, 1);
|
||||
}
|
||||
|
||||
.subMenu ul:hover {
|
||||
color: #5b8cc9;
|
||||
}
|
||||
|
||||
.subMenu:hover ul {
|
||||
opacity: 1;
|
||||
max-height: 500px;
|
||||
}
|
||||
|
||||
.subMenu:hover ul a {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.subMenu li {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.subMenu span {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #383838;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.subMenu:hover > span,
|
||||
.subMenu > a:hover > span {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.containerLinks {
|
||||
padding: 0 !important;
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
|
||||
.links {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: white;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
thead,
|
||||
tbody {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
.menuToggle {
|
||||
display: flex;
|
||||
position: relative;
|
||||
align-items: end;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
.barNavigation {
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.menuToggle.center {
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.barNavigation {
|
||||
font-size: 15px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.barNavigation ul {
|
||||
position: absolute;
|
||||
background-color: #003e79;
|
||||
flex-direction: column;
|
||||
padding: 10px 0;
|
||||
align-items: center;
|
||||
display: none;
|
||||
z-index: 1;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.barNavigation {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.barNavigation li:hover {
|
||||
background-color: #d59f0f;
|
||||
color: white;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.subMenu ul {
|
||||
width: 100%;
|
||||
border-radius: 4px;
|
||||
position: relative;
|
||||
background-color: rgb(1, 92, 184);
|
||||
}
|
||||
|
||||
thead,
|
||||
tbody {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
.editar{
|
||||
|
||||
max-width: 1000px;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.columna{
|
||||
display: flex ;
|
||||
flex-direction: column;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
.dashboard-container {
|
||||
max-width: 900px;
|
||||
margin: 50px auto;
|
||||
padding: 20px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #004aad; // azul marino
|
||||
font-size: 2rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #d4af37; // dorado
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #b5952e;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #ccc;
|
||||
flex: 1;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.search-section, .scanner-section, .equipos-section {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.search-section input, .search-section button {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.scanner-section video {
|
||||
border: 2px solid #004aad;
|
||||
border-radius: 10px;
|
||||
max-width: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.equipos-section ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.equipos-section li {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 10px 15px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #ccc;
|
||||
margin-bottom: 10px;
|
||||
background: white;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
.equipos-section li:hover {
|
||||
background: #e6f0ff;
|
||||
}
|
||||
|
||||
.estado-disponible {
|
||||
color: green;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.estado-reparacion {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
.logo {
|
||||
position: relative;
|
||||
filter: invert(1);
|
||||
z-index: 3;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.cedetecContainer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.cedetecContainer::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(to right, #f9f9f9, rgba(128, 128, 128, 0));
|
||||
}
|
||||
|
||||
.yellowPart {
|
||||
position: absolute;
|
||||
content: "";
|
||||
top: 0;
|
||||
left: -20px;
|
||||
width: 65%;
|
||||
height: 30px;
|
||||
min-width: 300px;
|
||||
background: #bd8c01;
|
||||
transform: skew(-45deg);
|
||||
z-index: 0;
|
||||
}
|
||||
.header {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
padding: 0 40px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
.header::after {
|
||||
content: "";
|
||||
top: 0;
|
||||
left: -40px;
|
||||
position: absolute;
|
||||
background-color: #003e79;
|
||||
height: 100%;
|
||||
min-width: 300px;
|
||||
transform: skew(45deg);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.header::before {
|
||||
content: "";
|
||||
top: 0;
|
||||
left: -20px;
|
||||
position: absolute;
|
||||
background-color: rgb(1, 92, 184);
|
||||
height: 100%;
|
||||
width: 10%;
|
||||
min-width: 300px;
|
||||
transform: skew(45deg);
|
||||
z-index: 2;
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.yellowPart {
|
||||
background: #bd8c01;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
.login-container {
|
||||
width: 300px;
|
||||
margin: 100px auto;
|
||||
padding: 30px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 10px;
|
||||
background: #f8f9fa;
|
||||
text-align: center;
|
||||
|
||||
h2 { margin-bottom: 20px; color: #004aad; }
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin-bottom: 15px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background-color: #004aad;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.error { color: red; margin-bottom: 10px; }
|
||||
}
|
||||
Reference in New Issue
Block a user