const editwaiterbtn=document.querySelectorAll('.editwaiterbtn');
editwaiterbtn.forEach(btn=>{
    btn.addEventListener('click',()=>{
      document.getElementById("editWaiterid").value=btn.dataset.id;
      document.getElementById("editWaitername").value=btn.dataset.name;
      document.getElementById("editWaiterstatus").value=btn.dataset.active;
    })
})
document.querySelectorAll(".dlt_waiter_btn").forEach(btn=>{
  btn.addEventListener("click",()=>{
    if(confirm("Are you sure you want to delete this waiter?")){
      const id=btn.dataset.id;
      fetch("../pages/submissions/waitersSubmission.php",{
        method:"POST",
        headers:{"Content-Type":"application/x-www-form-urlencoded"},
        body:"id="+id
      }).then(res=>res.text())
      .then(data=>location.reload())
    }
  })
})