"use strict"; async function pushSmsConsent(customerId) { const tok = document.querySelector('input[name="__RequestVerificationToken"]')?.value ?? ''; try { const res = await fetch(`/Kiosk/PushSmsConsent?customerId=${customerId}`, { method: 'POST', headers: { 'RequestVerificationToken': tok } }); 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.'); } } catch { 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.'); } } window.updateCustomerSmsStatus = function () { const section = document.getElementById('sms-status-section'); if (!section) return; const today = new Date().toLocaleDateString('en-US', { month: '2-digit', day: '2-digit', year: 'numeric' }); section.innerHTML = ` SMS on `; };