Safety on admin certification photos page
If a rejection reason is filled out, the approve button will disable so you don't accidentally click it.
This commit is contained in:
parent
9a854e5679
commit
20388172f0
|
@ -187,10 +187,24 @@
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener("DOMContentLoaded", (event) => {
|
window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
document.querySelectorAll("select.common-reasons").forEach(elem => {
|
document.querySelectorAll("select.common-reasons").forEach(elem => {
|
||||||
let textarea = elem.parentNode.parentNode.getElementsByTagName("textarea")[0];
|
let textarea = elem.parentNode.parentNode.getElementsByTagName("textarea")[0],
|
||||||
|
approveButton = elem.parentNode.parentNode.parentNode.parentNode.querySelector("button.is-success");
|
||||||
|
|
||||||
|
// Grey out the Approve button if a rejection reason is filled out.
|
||||||
|
let setApproveState = () => {
|
||||||
|
if (textarea.value.length > 0) {
|
||||||
|
approveButton.disabled = "disabled";
|
||||||
|
} else {
|
||||||
|
approveButton.disabled = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
textarea.addEventListener("change", setApproveState);
|
||||||
|
textarea.addEventListener("keyup", setApproveState);
|
||||||
elem.addEventListener("change", (e) => {
|
elem.addEventListener("change", (e) => {
|
||||||
textarea.value = elem.value;
|
textarea.value = elem.value;
|
||||||
})
|
setApproveState();
|
||||||
|
});
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user