Fix kiosk SMS consent routing loop and stuck tablet

- Route param renamed customerId→id so /Kiosk/SmsConsent/15307 binds correctly
  (default MVC route uses {id}; mismatched name caused GetByIdAsync(0)→404→loop)
- Cache entry cleared in GET (not just POST) so returning to Welcome after seeing
  the form never redirects again
- Added POST /Kiosk/CancelSmsConsent for staff to free the kiosk if they pushed
  consent accidentally — Customer Details shows a Cancel button after pushing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-13 23:25:37 -04:00
parent e1256503be
commit 0af31c39b3
3 changed files with 55 additions and 13 deletions
@@ -10,6 +10,8 @@ async function pushSmsConsent(customerId) {
const data = await res.json();
if (data.success) {
toastr.success('Consent form sent to the kiosk tablet — hand it to the customer.', 'Sent to Kiosk');
document.getElementById('btnGetSmsConsent')?.classList.add('d-none');
document.getElementById('btnCancelSmsConsent')?.classList.remove('d-none');
} else {
toastr.warning(data.message || 'Could not send consent to kiosk.');
}
@@ -17,3 +19,21 @@ async function pushSmsConsent(customerId) {
toastr.error('An error occurred. Please try again.');
}
}
async function cancelSmsConsent() {
const tok = document.querySelector('input[name="__RequestVerificationToken"]')?.value ?? '';
try {
const res = await fetch('/Kiosk/CancelSmsConsent', {
method: 'POST',
headers: { 'RequestVerificationToken': tok }
});
const data = await res.json();
if (data.success) {
toastr.info('Consent request cancelled — kiosk is free.');
document.getElementById('btnCancelSmsConsent')?.classList.add('d-none');
document.getElementById('btnGetSmsConsent')?.classList.remove('d-none');
}
} catch {
toastr.error('An error occurred. Please try again.');
}
}