From 4da3a5ae6eae67dc7e5e97e2551683d11b779566 Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 10 Jul 2026 14:39:01 -0500 Subject: [PATCH] Actualizar frontend/src/pages/Ventas.jsx --- frontend/src/pages/Ventas.jsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/Ventas.jsx b/frontend/src/pages/Ventas.jsx index 4f7696a..108347c 100644 --- a/frontend/src/pages/Ventas.jsx +++ b/frontend/src/pages/Ventas.jsx @@ -4,6 +4,7 @@ import { api } from "../lib/api"; import { Loader, ErrorBox, Filters, Select } from "../components/UI"; import Modal from "../components/Modal"; import { useColumnasAjustables } from "../lib/useColumnasAjustables"; +import { setVistaActual, onRefrescar } from "../lib/vistaActual"; const MESES = ["ENERO","FEBRERO","MARZO","ABRIL","MAYO","JUNIO","JULIO","AGOSTO","SEPTIEMBRE","OCTUBRE","NOVIEMBRE","DICIEMBRE"]; const ANOS = [2024, 2025, 2026]; @@ -27,11 +28,16 @@ export default function Ventas() { useEffect(() => { let activo = true; - setLoading(true); setError(null); - api.ventas(ano, mes, sede, programa) - .then((res) => { if (activo) { setFilas(res.filas || []); setLoading(false); } }) - .catch((e) => { if (activo) { setError(e.message); setLoading(false); } }); - return () => { activo = false; }; + setVistaActual(`ventas:${ano}|${mes}|${sede}|${programa}|False`); + const cargar = () => { + setLoading(true); setError(null); + api.ventas(ano, mes, sede, programa) + .then((res) => { if (activo) { setFilas(res.filas || []); setLoading(false); } }) + .catch((e) => { if (activo) { setError(e.message); setLoading(false); } }); + }; + cargar(); + const off = onRefrescar(cargar); + return () => { activo = false; off(); }; }, [ano, mes, sede, programa]); const total = useMemo(() => filas.find((f) => f[0] === "TOTAL GENERAL"), [filas]);