const edituserbtn=document.querySelectorAll(".edituserbtn");

edituserbtn.forEach(btn=>{
    btn.addEventListener("click",()=>{
      document.getElementById("edituserId").value=btn.dataset.id;
      document.getElementById("edituserName").value=btn.dataset.name;
      document.getElementById("edituserUName").value=btn.dataset.username;
      document.getElementById("edituserPassword").value=btn.dataset.password;
   
      document.getElementById("editUserRole").value=btn.dataset.role;
    })
})
document.querySelectorAll(".dlt_user_btn").forEach(btn=>{
  btn.addEventListener("click",()=>{
    if(confirm("Are you sure you want to delete this user?")){
      const ID=btn.dataset.id;
      fetch("../pages/submissions/userSubmission.php",{
        method:"POST",
        headers:{"Content-Type":"application/x-www-form-urlencoded"},
        body:"id="+ID
      }).then(res=>res.text())
      .then(data=>location.reload())
    }
  })
})