feat(catalog): corregir duplicados de menu y agregar 10 platillos y 5 frescos naturales con fotos reales
|
After Width: | Height: | Size: 4.0 MiB |
|
After Width: | Height: | Size: 4.9 MiB |
|
After Width: | Height: | Size: 760 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 634 KiB |
|
After Width: | Height: | Size: 493 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 891 KiB |
|
After Width: | Height: | Size: 5.2 MiB |
|
After Width: | Height: | Size: 404 KiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 3.3 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 92 KiB |
@@ -2285,6 +2285,6 @@
|
||||
<script src="/js/sounds.js?v=9.6"></script>
|
||||
<script src="/js/jsQR.js"></script>
|
||||
<script src="/js/food-icons.js?v=1.1"></script>
|
||||
<script src="/js/app.js?v=10.0"></script>
|
||||
<script src="/js/app.js?v=10.1"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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();
|
||||
|
||||