feat: arquitectura multi-escuela con panel de gestion developer y SINPE dinamico

This commit is contained in:
unknown
2026-10-05 23:55:48 -06:00
parent 4ecf53d1c9
commit 6bb452bf88
6 changed files with 630 additions and 47 deletions
+20 -2
View File
@@ -88,7 +88,17 @@ document.addEventListener('DOMContentLoaded', async () => {
// Cargar catálogo de productos
async function loadCatalog() {
try {
const res = await fetch('/api/productos');
let url = '/api/productos';
const storedUser = localStorage.getItem('recreopay_user');
if (storedUser) {
try {
const u = JSON.parse(storedUser);
if (u && u.escuela_id) {
url += `?escuela_id=${u.escuela_id}`;
}
} catch (e) {}
}
const res = await fetch(url);
const data = await res.json();
posCategories = data.categorias;
posProducts = data.productos;
@@ -1365,7 +1375,15 @@ async function loadSinpeRequests() {
if (!list) return;
try {
const res = await fetch('/api/sinpe/solicitudes?estado=pendiente');
let url = '/api/sinpe/solicitudes?estado=pendiente';
const storedUser = localStorage.getItem('recreopay_user');
if (storedUser) {
try {
const u = JSON.parse(storedUser);
if (u && u.escuela_id) url += `&escuela_id=${u.escuela_id}`;
} catch (e) {}
}
const res = await fetch(url);
const data = await res.json();
if (!res.ok) throw new Error(data.error);