Commit 040fdfa4 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(sports): wizard view crash when $registration undefined on index page

Move PHP reference to total_fees into a JS variable that's safely set with
isset() check, fixing the undefined variable error on the registration list page.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 5d33b996
......@@ -285,6 +285,7 @@ document.addEventListener('DOMContentLoaded', function() {
if (typeof lucide !== 'undefined') lucide.createIcons();
var regId = document.getElementById('wizardApp') ? document.getElementById('wizardApp').dataset.registrationId : null;
var regFee = <?= isset($registration) ? (int) $registration['total_fees'] : 0 ?>;
var csrfToken = document.querySelector('meta[name="csrf-token"]') ? document.querySelector('meta[name="csrf-token"]').content : '';
var csrfInput = document.querySelector('input[name="_csrf_token"]');
if (csrfInput) csrfToken = csrfInput.value;
......@@ -419,7 +420,7 @@ document.addEventListener('DOMContentLoaded', function() {
} else {
alert(data.error || 'حدث خطأ');
btnPayForm.disabled = false;
btnPayForm.textContent = 'إرسال للخزينة — <?= (int) $registration['total_fees'] ?> ج.م';
btnPayForm.textContent = 'إرسال للخزينة — ' + regFee + ' ج.م';
}
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment