Commit 3749be56 authored by Vũ Hoàng Anh's avatar Vũ Hoàng Anh

feat: render all occasion tabs in outfit recommendations panel even if product count is zero

parent 20098dc6
...@@ -1524,15 +1524,17 @@ ...@@ -1524,15 +1524,17 @@
function renderOutfitOccTabs() { function renderOutfitOccTabs() {
const tabsEl = document.getElementById('outfitOccTabs'); const tabsEl = document.getElementById('outfitOccTabs');
if (!tabsEl) return; if (!tabsEl) return;
// Collect unique occasions from current outfits
const occs = [...new Set(currentOutfits.map(o => o.occasion).filter(Boolean))]; // Define the list of occasions to show
if (occs.length <= 1) { let occsToShow = [];
tabsEl.innerHTML = ''; if (isKidProduct()) {
activeOccFilter = null; occsToShow = ['hang_ngay', 'di_hoc', 'di_choi', 'di_tiec', 'the_thao', 'mac_nha', 'du_lich'];
return; } else {
occsToShow = ['hang_ngay', 'di_lam', 'di_choi', 'di_tiec', 'the_thao', 'mac_nha', 'du_lich'];
} }
let html = `<span class="occ-tab ${!activeOccFilter ? 'active' : ''}" onclick="filterOutfitsByOcc(null)">Tất cả (${currentOutfits.length})</span>`; let html = `<span class="occ-tab ${!activeOccFilter ? 'active' : ''}" onclick="filterOutfitsByOcc(null)">Tất cả (${currentOutfits.length})</span>`;
occs.forEach(occ => { occsToShow.forEach(occ => {
const count = currentOutfits.filter(o => o.occasion === occ).length; const count = currentOutfits.filter(o => o.occasion === occ).length;
const label = OCC_LABELS[occ] || occ; const label = OCC_LABELS[occ] || occ;
html += `<span class="occ-tab ${activeOccFilter === occ ? 'active' : ''}" onclick="filterOutfitsByOcc('${occ}')">${label} (${count})</span>`; html += `<span class="occ-tab ${activeOccFilter === occ ? 'active' : ''}" onclick="filterOutfitsByOcc('${occ}')">${label} (${count})</span>`;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment