@@ -2131,6 +2161,53 @@
});
}
+ function sendQuoteSms(quoteId) {
+ document.getElementById('sendQuoteSmsSending').classList.remove('d-none');
+ document.getElementById('sendQuoteSmsResult').classList.add('d-none');
+ document.getElementById('sendQuoteSmsFooter').classList.add('d-none');
+ document.getElementById('sendQuoteSmsModalHeader').className = 'modal-header';
+
+ const modal = new bootstrap.Modal(document.getElementById('sendQuoteSmsModal'));
+ modal.show();
+
+ const token = document.querySelector('input[name="__RequestVerificationToken"]')?.value ?? '';
+
+ fetch('@Url.Action("SendQuoteApprovalSms", "Quotes")?id=' + quoteId, {
+ method: 'POST',
+ headers: { 'RequestVerificationToken': token, 'X-Requested-With': 'XMLHttpRequest' }
+ })
+ .then(r => r.json())
+ .then(data => {
+ document.getElementById('sendQuoteSmsSending').classList.add('d-none');
+ document.getElementById('sendQuoteSmsResult').classList.remove('d-none');
+ document.getElementById('sendQuoteSmsFooter').classList.remove('d-none');
+
+ const icon = document.getElementById('sendQuoteSmsIcon');
+ const msg = document.getElementById('sendQuoteSmsMessage');
+ const header = document.getElementById('sendQuoteSmsModalHeader');
+
+ if (data.success) {
+ icon.className = 'bi bi-check-circle-fill text-success fs-1 d-block mb-3';
+ header.className = 'modal-header bg-success text-white';
+ showInfo(data.message, 'SMS Sent');
+ } else {
+ icon.className = 'bi bi-x-circle-fill text-danger fs-1 d-block mb-3';
+ header.className = 'modal-header bg-danger text-white';
+ showWarning(data.message, 'SMS Not Sent');
+ }
+ msg.textContent = data.message;
+ })
+ .catch(() => {
+ document.getElementById('sendQuoteSmsSending').classList.add('d-none');
+ document.getElementById('sendQuoteSmsResult').classList.remove('d-none');
+ document.getElementById('sendQuoteSmsFooter').classList.remove('d-none');
+ document.getElementById('sendQuoteSmsIcon').className = 'bi bi-x-circle-fill text-danger fs-1 d-block mb-3';
+ document.getElementById('sendQuoteSmsModalHeader').className = 'modal-header bg-danger text-white';
+ document.getElementById('sendQuoteSmsMessage').textContent = 'A network error occurred. Please try again.';
+ showWarning('A network error occurred. Please try again.', 'SMS Not Sent');
+ });
+ }
+
function loadNotifications(quoteId) {
const modal = new bootstrap.Modal(document.getElementById('notificationsModal'));
document.getElementById('notificationsLoading').classList.remove('d-none');
diff --git a/src/PowderCoating.Web/appsettings.json b/src/PowderCoating.Web/appsettings.json
index 281a7fc..9eab6c6 100644
--- a/src/PowderCoating.Web/appsettings.json
+++ b/src/PowderCoating.Web/appsettings.json
@@ -48,9 +48,9 @@
"FromName": "Powder Coating App Staff"
},
"Twilio": {
- "AccountSid": "SK45bb87a7645d34c9227ea20faccad642",
- "AuthToken": " f262409674753f285b1c8184785c270e",
- "FromNumber": "+18664883595",
+ "AccountSid": "your-twilio-account-sid",
+ "AuthToken": "your-twilio-auth-token",
+ "FromNumber": "your-twilio-from-number",
"DevRedirectPhone": ""
},
"Stripe": {
diff --git a/src/PowderCoating.Web/wwwroot/js/passkey.js b/src/PowderCoating.Web/wwwroot/js/passkey.js
index c3c7fe4..a6ec843 100644
--- a/src/PowderCoating.Web/wwwroot/js/passkey.js
+++ b/src/PowderCoating.Web/wwwroot/js/passkey.js
@@ -256,7 +256,11 @@ document.addEventListener('DOMContentLoaded', async () => {
const result = await loginWithPasskey();
if (result.success) {
- window.location.href = result.redirectUrl || '/';
+ // Prefer the login page's ReturnUrl hidden field (set by the server to route
+ // through EnrollPrompt with the original destination) over the server's default
+ // dashboard redirect, so QR-code and deep-link flows land in the right place.
+ const formReturnUrl = document.querySelector('input[name="ReturnUrl"]')?.value;
+ window.location.href = formReturnUrl || result.redirectUrl || '/';
} else if (!result.cancelled) {
passkeyBtn.disabled = false;
passkeyBtn.innerHTML = ` ${label}`;