function validateShow(accessnumber) { const modalBody = $('#verifyModal .modal-body'); modalBody.html('
Loading...

Fetching verification details for #' + accessnumber + '...

'); $.ajax({ url: `${BASE_URL}/api/request/validate/${accessnumber}`, method: 'GET', dataType: 'html', success: function(response) { modalBody.html(response); }, error: function(xhr, status, error) { console.error("AJAX Error:", status, error); modalBody.html(` `); } }); } function invalidate(accessnumber,userid) { if(confirm("Are you sure?")) { $.ajax({ url: `${BASE_URL}/api/request/validate/${accessNumber}`, type: "DELETE", contentType: "application/json; charset=utf-8", dataType: "json", data: JSON.stringify({ userid:`${userid}` }), success: function(response) { console.log("Success:", response); }, error: function(xhr, status, error) { console.error("Error:", status, error); } }); const cell = document.querySelector(`[data-acc="${accessnumber}"]`); if(cell){ cell.querySelector(".badge").textContent = "0"; const btn = cell.querySelector(".invalidate-btn"); if (btn) btn.remove(); } } } function validate(accessnumber,userid) { // toggle checkbox const row = document.getElementById(`row-${accessnumber}`); fetch(`${BASE_URL}/api/request/validate/${accessnumber}`, { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({ userid:`${userid}` }) }).then(response => { console.log("Success:", response); }).catch(error => { }); }