function u(){const d=document.querySelectorAll("[data-kanban-list]");if(!d.length)return;const c=document.querySelector('meta[name="csrf-token"]')?.getAttribute("content")||"";let a=null;document.querySelectorAll("[data-kanban-card]").forEach(t=>{t.addEventListener("dragstart",e=>{a=t,t.classList.add("opacity-50"),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",t.getAttribute("data-ticket-id")||"")}catch{}}),t.addEventListener("dragend",()=>{t.classList.remove("opacity-50"),a=null,d.forEach(e=>e.parentElement?.classList.remove("ring-2","ring-wa-deep"))})}),d.forEach(t=>{const e=t.closest("[data-kanban-col]"),r=e?.getAttribute("data-kanban-col");t.addEventListener("dragover",o=>{o.preventDefault(),o.dataTransfer.dropEffect="move",e?.classList.add("ring-2","ring-wa-deep")}),t.addEventListener("dragleave",()=>{e?.classList.remove("ring-2","ring-wa-deep")}),t.addEventListener("drop",async o=>{if(o.preventDefault(),e?.classList.remove("ring-2","ring-wa-deep"),!a||!r)return;const i=a.getAttribute("data-ticket-id"),l=a.closest("[data-kanban-col]")?.getAttribute("data-kanban-col");if(!(!i||l===r)){t.appendChild(a);try{const n=new FormData;n.append("_token",c),n.append("status",r);const s=await fetch(`/admin/support/${i}/move`,{method:"POST",headers:{"X-CSRF-TOKEN":c,Accept:"text/html"},body:n});s.ok||s.status===302||console.error("[kanban] move failed: HTTP "+s.status),window.location.reload()}catch(n){console.error("[kanban] move error:",n),window.location.reload()}}})})}export{u as default};
