La carpeta con .git (C:\Mis Aplicaciones\informe-comercial) quedó desactualizada frente a lo que corre hoy en Coolify (deploy directo por Foundry desde esta carpeta, sin paso por git). Este commit fija esta carpeta como fuente de verdad del repo, con Renovaciones, Actividades, Agenda, Admin/Metas y Nuevas Oportunidades que la copia vieja no tenía. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
83 lines
2.9 KiB
JavaScript
83 lines
2.9 KiB
JavaScript
"use client";
|
|
import { useState } from "react";
|
|
|
|
// Modal de informe imprimible — puerto de openReporteEjecutivo()/openInformePrevision() +
|
|
// bindPrint() (App Informe/assets/js/modals.js, pdf.js). Sin librería de PDF: usa window.print()
|
|
// + las reglas @media print de public/assets/css/layout.css sobre body.rep-print (ya existían,
|
|
// vendorizadas junto con el resto del CSS del sitio HTML).
|
|
export default function ReportModal({ buttonLabel, disabled, disabledTitle, children }) {
|
|
const [open, setOpen] = useState(false);
|
|
|
|
function handlePrint() {
|
|
document.body.classList.add("rep-print");
|
|
const cleanup = () => {
|
|
document.body.classList.remove("rep-print");
|
|
window.removeEventListener("afterprint", cleanup);
|
|
};
|
|
window.addEventListener("afterprint", cleanup);
|
|
window.print();
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<button
|
|
type="button"
|
|
className="rep-btn"
|
|
onClick={() => setOpen(true)}
|
|
disabled={disabled}
|
|
title={disabled ? disabledTitle : undefined}
|
|
>
|
|
{buttonLabel}
|
|
</button>
|
|
{open && (
|
|
<>
|
|
<div
|
|
id="repModalBd"
|
|
style={{ display: "block", position: "fixed", inset: 0, background: "rgba(1,32,91,.55)", zIndex: 29 }}
|
|
onClick={() => setOpen(false)}
|
|
/>
|
|
<div
|
|
id="repModal"
|
|
style={{
|
|
display: "block", position: "fixed", top: "3%", left: "8%", right: "8%", bottom: "3%",
|
|
background: "#fff", borderRadius: 12, zIndex: 30, boxShadow: "0 20px 60px rgba(1,32,91,.35)",
|
|
padding: 0, overflow: "auto",
|
|
}}
|
|
>
|
|
<div
|
|
className="rep-actions"
|
|
style={{
|
|
display: "flex", justifyContent: "flex-end", gap: 8, padding: "14px 20px",
|
|
borderBottom: "1px solid var(--linea)", position: "sticky", top: 0, background: "#fff",
|
|
}}
|
|
>
|
|
<button
|
|
type="button"
|
|
onClick={handlePrint}
|
|
style={{
|
|
fontFamily: "var(--sans)", fontSize: 13, padding: "7px 14px", border: "1px solid var(--marca)",
|
|
borderRadius: 6, background: "var(--marca)", color: "#fff", cursor: "pointer", fontWeight: 700,
|
|
}}
|
|
>
|
|
🖨 Imprimir
|
|
</button>
|
|
<button
|
|
type="button"
|
|
onClick={() => setOpen(false)}
|
|
style={{
|
|
fontFamily: "var(--sans)", fontSize: 13, padding: "7px 14px", border: "1px solid var(--linea)",
|
|
borderRadius: 6, background: "#fff", cursor: "pointer",
|
|
}}
|
|
>
|
|
✕ Cerrar
|
|
</button>
|
|
</div>
|
|
<div id="repModalBody" style={{ padding: "32px 40px" }}>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
</>
|
|
)}
|
|
</>
|
|
);
|
|
}
|