Dashboard: rimuovi lista prodotti, rinomina Inventario→Dispensa
- Rimossa lista completa prodotti per location dalla dashboard (solo stat cards + scadenze) - Rinominato 'Inventario' in 'Dispensa' nel nav e nell'header pagina - Dashboard più leggera: non carica più inventory_list
This commit is contained in:
+2
-22
@@ -380,10 +380,9 @@ function showPage(pageId, param = null) {
|
||||
// ===== DASHBOARD =====
|
||||
async function loadDashboard() {
|
||||
try {
|
||||
const [summaryData, statsData, invData] = await Promise.all([
|
||||
const [summaryData, statsData] = await Promise.all([
|
||||
api('inventory_summary'),
|
||||
api('stats'),
|
||||
api('inventory_list')
|
||||
api('stats')
|
||||
]);
|
||||
|
||||
// Update stat cards
|
||||
@@ -459,25 +458,6 @@ async function loadDashboard() {
|
||||
expiredSection.style.display = 'none';
|
||||
}
|
||||
|
||||
// Full inventory grouped by location, then by category within each location
|
||||
const allItems = invData.inventory || [];
|
||||
const grouped = { dispensa: [], frigo: [], freezer: [], altro: [] };
|
||||
allItems.forEach(item => {
|
||||
const loc = grouped[item.location] !== undefined ? item.location : 'altro';
|
||||
grouped[loc].push(item);
|
||||
});
|
||||
|
||||
for (const [loc, items] of Object.entries(grouped)) {
|
||||
const section = document.getElementById(`dash-section-${loc}`);
|
||||
const container = document.getElementById(`dash-inv-${loc}`);
|
||||
if (items.length === 0) {
|
||||
section.style.display = 'none';
|
||||
} else {
|
||||
section.style.display = 'block';
|
||||
container.innerHTML = renderGroupedByCategory(items, true);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.error('Dashboard load error:', err);
|
||||
}
|
||||
|
||||
+2
-19
@@ -64,30 +64,13 @@
|
||||
<div id="expiring-list"></div>
|
||||
</div>
|
||||
|
||||
<!-- Full inventory by location -->
|
||||
<div class="section-card" id="dash-section-dispensa">
|
||||
<h3 onclick="showPage('inventory','dispensa')" style="cursor:pointer">🗄️ Dispensa</h3>
|
||||
<div class="inventory-list compact" id="dash-inv-dispensa"></div>
|
||||
</div>
|
||||
<div class="section-card" id="dash-section-frigo">
|
||||
<h3 onclick="showPage('inventory','frigo')" style="cursor:pointer">🧊 Frigo</h3>
|
||||
<div class="inventory-list compact" id="dash-inv-frigo"></div>
|
||||
</div>
|
||||
<div class="section-card" id="dash-section-freezer">
|
||||
<h3 onclick="showPage('inventory','freezer')" style="cursor:pointer">❄️ Freezer</h3>
|
||||
<div class="inventory-list compact" id="dash-inv-freezer"></div>
|
||||
</div>
|
||||
<div class="section-card" id="dash-section-altro">
|
||||
<h3 onclick="showPage('inventory','altro')" style="cursor:pointer">📦 Altro</h3>
|
||||
<div class="inventory-list compact" id="dash-inv-altro"></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ===== INVENTORY LIST ===== -->
|
||||
<section class="page" id="page-inventory">
|
||||
<div class="page-header">
|
||||
<button class="back-btn" onclick="showPage('dashboard')">← Indietro</button>
|
||||
<h2 id="inventory-title">Inventario</h2>
|
||||
<h2 id="inventory-title">Dispensa</h2>
|
||||
</div>
|
||||
<div class="location-tabs" id="location-tabs">
|
||||
<button class="tab active" onclick="filterLocation('')" data-loc="">Tutti</button>
|
||||
@@ -500,7 +483,7 @@
|
||||
</button>
|
||||
<button class="nav-btn" onclick="showPage('inventory', '')" data-page="inventory">
|
||||
<span class="nav-icon">📋</span>
|
||||
<span class="nav-label">Inventario</span>
|
||||
<span class="nav-label">Dispensa</span>
|
||||
</button>
|
||||
<button class="nav-btn" onclick="openRecipeDialog()" data-page="recipe">
|
||||
<span class="nav-icon">🍳</span>
|
||||
|
||||
Reference in New Issue
Block a user