-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP users page, working updates and deactivation - needs polish
- Loading branch information
Showing
8 changed files
with
606 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,82 @@ | ||
// Initialize Bootstraps 5 tooltips | ||
const tooltipTriggerList = document.querySelectorAll( | ||
'[data-bs-toggle="tooltip"]' | ||
) | ||
); | ||
const tooltipList = [...tooltipTriggerList].map( | ||
(tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl) | ||
) | ||
); | ||
|
||
async function changeColorMode() { | ||
const color = document.getElementById('colormode') | ||
const color = document.getElementById("colormode"); | ||
|
||
document.documentElement.setAttribute('data-bs-theme', color.value) | ||
document.documentElement.setAttribute("data-bs-theme", color.value); | ||
|
||
await fetch('/profile', { | ||
method: 'POST', | ||
await fetch("/profile", { | ||
method: "POST", | ||
headers: { | ||
'Content-Type': 'application/json' | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
name: color.id, | ||
value: color.value | ||
}) | ||
}) | ||
value: color.value, | ||
}), | ||
}); | ||
} | ||
|
||
// Change settings when checkbox state changes | ||
const checkboxes = document.getElementsByClassName('realtime-checkbox') | ||
const checkboxes = document.getElementsByClassName("realtime-checkbox"); | ||
|
||
const _checkboxesEvent = [...checkboxes].forEach((element) => { | ||
element.addEventListener('change', async function () { | ||
await fetch('/profile', { | ||
method: 'POST', | ||
element.addEventListener("change", async function () { | ||
await fetch("/profile", { | ||
method: "POST", | ||
headers: { | ||
'Content-Type': 'application/json' | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
name: this.id, | ||
value: this.checked | ||
}) | ||
}) | ||
}) | ||
}) | ||
value: this.checked, | ||
}), | ||
}); | ||
}); | ||
}); | ||
|
||
// Change IBAN settings when state changes | ||
const iban = document.getElementById('realtime-iban') | ||
const ibanEvents = ['paste', 'keyup'] | ||
const iban = document.getElementById("realtime-iban"); | ||
const ibanEvents = ["paste", "keyup"]; | ||
|
||
ibanEvents.forEach(function (event) { | ||
iban.addEventListener(event, async function () { | ||
const sanitizedValue = this.value.replace(/\s/g, '') | ||
const sanitizedValue = this.value.replace(/\s/g, ""); | ||
|
||
if (this.checkValidity()) { | ||
this.style.color = 'green' | ||
const status = document.getElementById('iban-status') | ||
status.style.color = 'green' | ||
status.classList.remove('fa-times-circle') | ||
status.classList.add('fa-check-circle') | ||
this.style.color = "green"; | ||
const status = document.getElementById("iban-status"); | ||
status.style.color = "green"; | ||
status.classList.remove("fa-times-circle"); | ||
status.classList.add("fa-check-circle"); | ||
|
||
await fetch('/profile', { | ||
method: 'POST', | ||
await fetch("/profile", { | ||
method: "POST", | ||
headers: { | ||
'Content-Type': 'application/json' | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
name: this.id, | ||
value: sanitizedValue | ||
}) | ||
}) | ||
value: sanitizedValue, | ||
}), | ||
}); | ||
} else { | ||
this.style.color = 'red' | ||
const status = document.getElementById('iban-status') | ||
status.style.color = 'red' | ||
status.classList.remove('fa-check-circle') | ||
status.classList.add('fa-times-circle') | ||
this.style.color = "red"; | ||
const status = document.getElementById("iban-status"); | ||
status.style.color = "red"; | ||
status.classList.remove("fa-check-circle"); | ||
status.classList.add("fa-times-circle"); | ||
} | ||
}) | ||
}) | ||
}); | ||
}); | ||
|
||
window.onload = function (_event) { | ||
document.getElementById('colormode').value = | ||
document.documentElement.getAttribute('data-bs-theme') | ||
} | ||
document.getElementById("colormode").value = | ||
document.documentElement.getAttribute("data-bs-theme"); | ||
}; |
Oops, something went wrong.