Actualizar frontend/src/pages/Retiros.jsx

This commit is contained in:
2026-09-10 14:03:41 -05:00
parent 8cbee48947
commit b86e511182

View File

@@ -56,6 +56,8 @@ export default function Retiros() {
const [sectorista, setSectorista] = useState("TODOS"); const [sectorista, setSectorista] = useState("TODOS");
const [filas, setFilas] = useState([]); const [filas, setFilas] = useState([]);
const [guardado, setGuardado] = useState(false); // ¿mostrando snapshot guardado?
const [guardadoEn, setGuardadoEn] = useState(null); // fecha del guardado
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [error, setError] = useState(null); const [error, setError] = useState(null);
@@ -107,7 +109,7 @@ export default function Retiros() {
let activo = true; let activo = true;
setLoading(true); setError(null); setMsgTotal(null); setLoading(true); setError(null); setMsgTotal(null);
api.retiros(ano, mes) api.retiros(ano, mes)
.then((r) => { if (activo) { setFilas(r.filas || []); setLoading(false); } }) .then((r) => { if (activo) { setFilas(r.filas || []); setGuardado(!!r.guardado); setGuardadoEn(r.guardado_en || null); setLoading(false); } })
.catch((e) => { if (activo) { setError(e.message); setLoading(false); } }); .catch((e) => { if (activo) { setError(e.message); setLoading(false); } });
return () => { activo = false; }; return () => { activo = false; };
}, [ano, mes]); }, [ano, mes]);
@@ -226,8 +228,16 @@ export default function Retiros() {
{loading ? <Loader text="Cargando retiros..." /> : {loading ? <Loader text="Cargando retiros..." /> :
error ? <ErrorBox msg={error} /> : error ? <ErrorBox msg={error} /> :
<> <>
<div style={{ fontSize: 13, color: "#1e40af", fontWeight: 600, margin: "10px 0 8px" }}> <div style={{ display: "flex", alignItems: "center", gap: 12, margin: "10px 0 8px", flexWrap: "wrap" }}>
{filasFiltradas.length} alumno(s) por retirar <span style={{ fontSize: 13, color: "#1e40af", fontWeight: 600 }}>
{filasFiltradas.length} alumno(s) por retirar
</span>
{guardado && (
<span style={{ fontSize: 12, color: "#92400e", background: "#fffbeb",
border: "1px solid #fde68a", borderRadius: 999, padding: "3px 10px", fontWeight: 600 }}>
📌 Mostrando datos guardados{guardadoEn ? ` · ${guardadoEn}` : ""}
</span>
)}
</div> </div>
<div className="table-wrap" style={{ overflow: "auto", maxHeight: "65vh" }}> <div className="table-wrap" style={{ overflow: "auto", maxHeight: "65vh" }}>
<table className="cob-table" {...cols.tableProps}> <table className="cob-table" {...cols.tableProps}>