Skip to content
Snippets Groups Projects
Commit 221bf712 authored by Nigel  Sahl's avatar Nigel Sahl
Browse files

fix: button display in application page

parent c88da080
Branches
Tags
No related merge requests found
......@@ -35,7 +35,7 @@ AuthMiddleware::getInstance()->secureRoute(true);
</div>
<div class="space"></div>
<div class="first-line-button">
<div class="first-line-button" id="button-acc-rej-trainer">
<button class="button-filter" id="accept-trainer" onclick="showPopupAcc();">
Accept Trainer
</button>
......
......@@ -83,14 +83,22 @@ function getApplication(username, gymId) {
function acceptApplication(gymId, username) {
hidePopupAcc()
const button = document.getElementById("button-acc-rej-trainer");
// hide button
button.style.display = "none";
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 200) {
alert("accept with username: " + username + " and gym id: " + gymId + "\n" + "Email has been sent to the trainer");
// redirect to gym page /admin/gym/?gym_id=${gymId}
window.location.href = `/admin/gym/?gym_id=${gymId}`;
} else {
const xml = this.responseXML;
console.log("error status : " + this.status + " error text : " + xml);
alert("error status : " + this.status + " error text : " + xml);
// show button
button.style.display = "flex";
}
}
};
......@@ -112,14 +120,22 @@ function acceptApplication(gymId, username) {
function rejectApplication(gymId, username) {
hidePopupRej()
const button = document.getElementById("button-acc-rej-trainer");
// hide button
button.style.display = "none";
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 200) {
alert("reject with username: " + username + " and gym id: " + gymId + "\n" + "Email has been sent to the trainer");
// redirect to gym page /admin/gym/?gym_id=${gymId}
window.location.href = `/admin/gym/?gym_id=${gymId}`;
} else {
const xml = this.responseXML;
console.log("error status : " + this.status + " error text : " + xml);
alert("error status : " + this.status + " error text : " + xml);
// show button
button.style.display = "flex";
}
}
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment