const editRiderbtn=document.querySelectorAll(".editRiderbtn");
editRiderbtn.forEach(btn=>{
    btn.addEventListener("click",()=>{
        document.getElementById("editRiderid").value=btn.dataset.id;
        document.getElementById("editRidername").value=btn.dataset.ridername;
        document.getElementById("editRiderstatus").value=btn.dataset.isactive;
    })
});

document.querySelectorAll(".dlt_rider_btn").forEach(btn=>{
    btn.addEventListener("click",()=>{
    if(confirm("Ar you sure you want to delete this rider?")){
        const ID=btn.dataset.id;
        fetch("../pages/submissions/ridersSubmission.php",{
            method:"POST",
            headers:{"Content-Type":"application/x-www-form-urlencoded"},
            body:"id="+ID
        }).then(res=>res.text())
        .then(data=>location.reload())
    }    
    })
})