"use client"; import React, { useState } from "react"; import Link from "next/link"; import { User } from "@boxicons/react"; // Interface para mapear la estructura de la lista de contratos anulados interface ContratoAnuladoItem { idEmpresas: string; empresa: string; Contrato: string; Fecha: string; DescripcionActividad: string; usuarioResponsable: string; } export default function ContratosHistorialPage() { // --- ESTADOS DE CONTROLES Y SECCIONES --- const [mes, setMes] = useState(""); const [agno, setAgno] = useState(""); const [showSearch, setShowSearch] = useState(false); const [mensajeLabel, setMensajeLabel] = useState(""); // --- ESTADOS DE MODALES Y CARGA --- const [isLoading, setIsLoading] = useState(false); const [modalAlerta, setModalAlerta] = useState({ show: false, message: "" }); // --- DATOS SIMULADOS (DataList / Grid) --- const [contratosAnulados, setContratosAnulados] = useState([ { idEmpresas: "76.123.456-7", empresa: "Empresa Ejemplo S.A.", Contrato: "1002", Fecha: "2026-02-10", DescripcionActividad: "Anulación solicitada por el cliente por cambio de presupuesto", usuarioResponsable: "AdminUser", }, ]); // --- MANEJADORES DE EVENTOS --- const handleBuscar = (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); // Simulación de respuesta de backend setTimeout(() => { setIsLoading(false); if (!mes || !agno) { setModalAlerta({ show: true, message: "Por favor seleccione un mes e ingrese un año válido.", }); return; } setShowSearch(true); setMensajeLabel(""); }, 800); }; const handleExportarExcel = (e: React.MouseEvent) => { e.preventDefault(); setIsLoading(true); setTimeout(() => { setIsLoading(false); setModalAlerta({ show: true, message: "Informe mensual exportado correctamente a Excel.", }); }, 1000); }; return (
{/* CABECERA IZQUIERDA */}
Contratos anulados por mes
Volver
{/* CABECERA DERECHA / FILTROS DE BÚSQUEDA */}
Mes
Agno
setAgno(e.target.value)} placeholder="AAAA" />
{/* BOTÓN EXPORTAR EXCEL */}
{/* TABLA DE RESULTADOS */} {showSearch && ( )}
{/* --- MODAL ALERTA / ERRORES --- */} {modalAlerta.show && (
Módulo Académico - Empresa
{modalAlerta.message}
)} {/* --- MODAL CARGANDO (LOADING SPINNER) --- */} {isLoading && (
Procesando
Espere un momento, por favor...
)}
); }