(()=>{const table=document.querySelector('[data-sort-sections]');if(!table)return;let held;table.querySelectorAll('tr[data-id]').forEach(r=>{r.draggable=true;r.addEventListener('dragstart',()=>held=r);r.addEventListener('dragover',e=>{e.preventDefault();if(held&&held!==r)r.before(held)});});document.querySelector('[data-save-order]')?.addEventListener('click',()=>{document.querySelector('[name=order]').value=[...table.querySelectorAll('tr[data-id]')].map(x=>x.dataset.id).join(',')})})();
