fix: close event listener brackets in catalog tree JS

This commit is contained in:
NW
2026-06-25 13:02:25 +01:00
parent 1768c6a5c4
commit 19a275b8e0

View File

@@ -186,12 +186,12 @@ document.querySelectorAll('.tree-toggle .arrow').forEach(el=>{el.addEventListene
const toggle=el.closest('.tree-toggle');
const ch=toggle.nextElementSibling; if(!ch||!ch.classList.contains('tree-children')) return;
ch.classList.toggle('open'); el.classList.toggle('open');
})});
});});
document.querySelectorAll('.tree-toggle .node-label').forEach(el=>{el.addEventListener('click',e=>{
e.stopPropagation();
const loc=el.dataset.loc, cat=el.dataset.cat, sub=el.dataset.sub, all=el.dataset.all;
if(loc||cat||sub||all){ let u='/catalog?'; if(loc) u+='loc='+loc; if(cat) u+='cat='+cat; if(sub) u+='sub='+sub; location.href=u; }
});
});});
function openAdd(){ document.getElementById('modal-body').innerHTML=addFormTpl; initLocationSelects(null); document.getElementById('product-modal').style.display='flex'; }
async function openEdit(id){ const r=await fetch('/catalog/products/'+id+'/json'); const p=await r.json();
document.getElementById('modal-body').innerHTML=editFormTpl.replace('/__ID__/','/'+p.id+'/'); fillEditForm(p); document.getElementById('product-modal').style.display='flex'; }