Merge branch 'Lino' of https://github.com/jls846/front-censo into Sarabia
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
const token = request.cookies.get("token");
|
||||
|
||||
if (!token) {
|
||||
console.log("No hay token, redirigiendo a la página de inicio de sesión");
|
||||
return NextResponse.redirect(new URL("/", request.url));
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/AgregarEquipo", "Escaner"],
|
||||
};
|
||||
//IO
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import "../styles/layout/agregarEquipo.scss"; // Asegúrate de crear este archivo
|
||||
import "../../styles/layout/agregarEquipo.scss"; // Asegúrate de crear este archivo
|
||||
|
||||
export default function page() {
|
||||
const [formData, setFormData] = useState({
|
||||
@@ -50,7 +50,7 @@ export default function page() {
|
||||
return (
|
||||
<div className="agregarEquipoContainer">
|
||||
<div className="innerContainer">
|
||||
<h2>Agregar Nuevo Equipo</h2>
|
||||
<h2 className="information">Agregar Nuevo Equipo</h2>
|
||||
<form className="equipoForm">
|
||||
{/* Columna Izquierda */}
|
||||
<div className="column">
|
||||
@@ -216,7 +216,7 @@ export default function page() {
|
||||
onChange={(e) =>
|
||||
setFormData({ ...formData, lugar: e.target.value })
|
||||
}
|
||||
rows={4}
|
||||
rows={5}
|
||||
className="textAreaLarge"
|
||||
/>
|
||||
</div>
|
||||
@@ -228,7 +228,7 @@ export default function page() {
|
||||
onChange={(e) =>
|
||||
setFormData({ ...formData, observaciones: e.target.value })
|
||||
}
|
||||
rows={4}
|
||||
rows={5}
|
||||
className="textAreaLarge"
|
||||
/>
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import "../styles/layout/agregarEquipo.scss";
|
||||
import { useEffect, useState } from "react";
|
||||
import "../../styles/layout/agregarEquipo.scss";
|
||||
import "./editar.css";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
export default function Home() {
|
||||
const searchParams = useSearchParams();
|
||||
@@ -47,6 +47,8 @@ export default function Home() {
|
||||
<div className="innerContainer">
|
||||
<h2 className="information">
|
||||
{equipoId ? `Editar Equipo (${equipoId})` : "Agregar Equipo"}
|
||||
<span>Inventario:</span>
|
||||
<span>Fecha de censo:</span>
|
||||
</h2>
|
||||
|
||||
<form className="equipoForm">
|
||||
@@ -203,7 +205,7 @@ export default function Home() {
|
||||
onChange={(e) =>
|
||||
setFormData({ ...formData, lugar: e.target.value })
|
||||
}
|
||||
rows={4}
|
||||
rows={5}
|
||||
className="textAreaLarge"
|
||||
/>
|
||||
</div>
|
||||
@@ -216,7 +218,7 @@ export default function Home() {
|
||||
onChange={(e) =>
|
||||
setFormData({ ...formData, observaciones: e.target.value })
|
||||
}
|
||||
rows={4}
|
||||
rows={5}
|
||||
className="textAreaLarge"
|
||||
/>
|
||||
</div>
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import "../styles/layout/escaner.scss";
|
||||
import BarcodeScanner from "@/components/BarcodeScanner"; // Ajusta la ruta si es necesario
|
||||
import "../../styles/layout/escaner.scss"; // Importación global
|
||||
import BarcodeScanner from "@/components/BarcodeScanner";
|
||||
|
||||
type Equipo = {
|
||||
id: string;
|
||||
@@ -47,16 +47,19 @@ export default function Dashboard() {
|
||||
const encontrado = equipos.find((e) => e.id === code);
|
||||
|
||||
if (encontrado) {
|
||||
// ✅ Si el equipo existe, redirige directamente
|
||||
router.push(`/Editar?equipoId=${encontrado.id}`);
|
||||
} else {
|
||||
// 🚫 Si no existe, se puede registrar
|
||||
<<<<<<< HEAD:src/app/Escaner/page.tsx
|
||||
const marca = prompt("Equipo no registrado. Ingresa la marca:");
|
||||
if (marca) {
|
||||
const nuevoEquipo = { id: code, marca, estado: "Desactivado" };
|
||||
setEquipos([...equipos, nuevoEquipo]);
|
||||
alert("Equipo agregado al inventario");
|
||||
}
|
||||
=======
|
||||
router.push(`/AgregarEquipo`);
|
||||
>>>>>>> 374ce02350db05430bc40286bdff9fe767e82eae:src/app/(Operador)/Escaner/page.tsx
|
||||
}
|
||||
};
|
||||
|
||||
@@ -155,5 +155,7 @@ textarea {
|
||||
}
|
||||
|
||||
.information {
|
||||
border-bottom: 1px solid;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid #003e79;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,14 @@
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.yellowPart {
|
||||
left: 0;
|
||||
background: #bd8c01;
|
||||
transform: skew(0deg);
|
||||
}
|
||||
.header::after {
|
||||
left: -100px;
|
||||
}
|
||||
.header::before {
|
||||
left: -80px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function BarcodeScanner({ onScan }: BarcodeScannerProps) {
|
||||
target: scannerRef.current,
|
||||
constraints: {
|
||||
width: 640,
|
||||
height: 480,
|
||||
height: 370,
|
||||
facingMode: "environment",
|
||||
},
|
||||
},
|
||||
@@ -114,4 +114,4 @@ export default function BarcodeScanner({ onScan }: BarcodeScannerProps) {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ import Image from "next/image";
|
||||
import header from "../app/styles/layout/header.module.scss";
|
||||
import Link from "next/link";
|
||||
import BarNavigation from "./BarNavigation";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
function Header() {
|
||||
const pathname = usePathname(); // obtenemos la ruta actual
|
||||
|
||||
return (
|
||||
<header className={header.header}>
|
||||
<Link
|
||||
@@ -34,9 +37,8 @@ function Header() {
|
||||
maxHeight: "50%",
|
||||
alignItems: "end",
|
||||
}}
|
||||
className=""
|
||||
>
|
||||
<BarNavigation />
|
||||
{pathname !== "/" && <BarNavigation />}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user