diff --git a/src/PowderCoating.Web/Services/InAppNotificationService.cs b/src/PowderCoating.Web/Services/InAppNotificationService.cs index c8ed105..2891adc 100644 --- a/src/PowderCoating.Web/Services/InAppNotificationService.cs +++ b/src/PowderCoating.Web/Services/InAppNotificationService.cs @@ -72,6 +72,7 @@ public class InAppNotificationService : IInAppNotificationService message = notification.Message, link = notification.Link, notificationType = notification.NotificationType, + customerId = notification.CustomerId, createdAt = now.ToString("o") }); } diff --git a/src/PowderCoating.Web/Views/Customers/Details.cshtml b/src/PowderCoating.Web/Views/Customers/Details.cshtml index 53fc64e..0c641e4 100644 --- a/src/PowderCoating.Web/Views/Customers/Details.cshtml +++ b/src/PowderCoating.Web/Views/Customers/Details.cshtml @@ -173,6 +173,7 @@ Email off } + @if (Model.NotifyBySms) { Cancel Consent } + diff --git a/src/PowderCoating.Web/Views/Shared/_Layout.cshtml b/src/PowderCoating.Web/Views/Shared/_Layout.cshtml index a49db1e..2638c2f 100644 --- a/src/PowderCoating.Web/Views/Shared/_Layout.cshtml +++ b/src/PowderCoating.Web/Views/Shared/_Layout.cshtml @@ -1914,7 +1914,8 @@ const icons = { QuoteApproved: { icon: 'bi-check-circle-fill', cls: 'success', title: 'Quote Approved' }, QuoteDeclined: { icon: 'bi-x-circle-fill', cls: 'danger', title: 'Quote Declined' }, - InvoicePaid: { icon: 'bi-cash-coin', cls: 'primary', title: 'Payment Received' } + InvoicePaid: { icon: 'bi-cash-coin', cls: 'primary', title: 'Payment Received' }, + KioskConsent: { icon: 'bi-chat-fill', cls: 'success', title: 'SMS Consent' } }; const t = icons[data.notificationType] || { icon: 'bi-bell', cls: 'info', title: 'Notification' }; toastr[t.cls === 'danger' ? 'warning' : t.cls === 'primary' ? 'info' : 'success']( @@ -1922,6 +1923,12 @@ `${t.title}`, { timeOut: 10000, extendedTimeOut: 3000, closeButton: true, enableHtml: true } ); + if (data.notificationType === 'KioskConsent' && data.customerId) { + const path = window.location.pathname.toLowerCase(); + if (path === `/customers/details/${data.customerId}`) { + window.updateCustomerSmsStatus?.(); + } + } }); connection.start().catch(err => console.warn('SignalR connection failed:', err)); diff --git a/src/PowderCoating.Web/wwwroot/js/customer-details.js b/src/PowderCoating.Web/wwwroot/js/customer-details.js index fb081b3..126b6fc 100644 --- a/src/PowderCoating.Web/wwwroot/js/customer-details.js +++ b/src/PowderCoating.Web/wwwroot/js/customer-details.js @@ -37,3 +37,13 @@ async function cancelSmsConsent() { 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 + `; +};