feat(catalog): corregir duplicados de menu y agregar 10 platillos y 5 frescos naturales con fotos reales

This commit is contained in:
unknown
2026-10-06 13:31:32 -06:00
parent 6560ecedf7
commit 480d5b9403
19 changed files with 230 additions and 15 deletions
+13 -4
View File
@@ -550,11 +550,20 @@ async function loadInitialData() {
populateStudentSelector();
// 2. Cargar productos y categorías
const resProd = await fetch('/api/productos');
// 2. Cargar productos y categorías de la escuela activa
const escId = (currentUser && currentUser.escuela_id) || (currentStudent && currentStudent.escuela_id) || 1;
const resProd = await fetch(`/api/productos?escuela_id=${escId}`);
const dataProd = await resProd.json();
categories = dataProd.categorias;
products = dataProd.productos;
categories = dataProd.categorias || [];
// Deduplicar productos para garantizar que nunca se repita ninguno
const seenNames = new Set();
products = (dataProd.productos || []).filter(p => {
const key = String(p.nombre).trim().toLowerCase();
if (seenNames.has(key)) return false;
seenNames.add(key);
return true;
});
renderCategories();
renderProducts();