changes
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
<body>
|
||||
<%- include('partials/nav') %>
|
||||
<div class="content">
|
||||
<input type="checkbox" class="setting" name="enable-email">Enable Email<br>
|
||||
<input type="checkbox" class="setting" name="enable-ticket-use">Enable Ticket Use<br>
|
||||
<input type="checkbox" class="setting" name="enable-credit-cards">Enable Credit Cards<br>
|
||||
<form action='/purge' method='post'>
|
||||
<button type="submit" >Purge Revoked Tickets</button>
|
||||
</form>
|
||||
@@ -15,5 +18,22 @@
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
|
||||
|
||||
const MessageArea=document.getElementById("message");
|
||||
const checkboxes = document.getElementsByClassName("setting");
|
||||
for (let i=0; i<checkboxes.length; i++) checkboxes[i].addEventListener('change',(event) => {
|
||||
console.log(event);
|
||||
fetch('/update-setting',{ method:"POST", headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name:event.target.name, checked:event.target.checked }) })
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error("Network Error: Server did not respond.");
|
||||
MessageArea.textContent="Updated "+event.target.name;
|
||||
return response.json();
|
||||
})
|
||||
.catch(error => console.error('Error updating checkbox state:', error));
|
||||
})
|
||||
|
||||
</script>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user