قم بملء استمارة الانخراط الرقمية للموسم الرياضي 2024/2025
بعد إرسال الطلب، يرجى تجهيز الوثائق التالية لتسليمها لإدارة النادي:
يرجى الانتظار للحظات
'; document.body.appendChild(overlay); // Give the browser a moment to paint the overlay await new Promise(r => setTimeout(r, 200)); window.scrollTo(0, 0); const template = document.getElementById('pdfTemplate'); const opt = { margin: 0, filename: 'inscription.pdf', image: { type: 'jpeg', quality: 1 }, html2canvas: { scale: 2, useCORS: true, scrollY: 0 }, jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' } }; try { const pdfBase64 = await html2pdf().set(opt).from(template).outputPdf('datauristring'); // Send to server const response = await fetch('api_register.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ playerName: name, userEmail: email, pdfData: pdfBase64 }) }); const result = await response.json(); if (result.success) { alert('🎉 تم استلام طلب الانخراط بنجاح!\n\nتم إرسال الاستمارة جاهزة للطباعة إلى بريدك الإلكتروني (' + email + '). يرجى التحقق من صندوق الوارد (أو مجلد Spam).'); window.location.reload(); // Reload the page to reset everything safely } else { alert('حدث خطأ أثناء الإرسال: ' + (result.error || 'يرجى المحاولة لاحقاً.')); } } catch (err) { console.error(err); alert('حدث خطأ أثناء إنشاء الاستمارة: ' + (err.message || err)); } finally { document.body.removeChild(overlay); btn.innerHTML = originalText; btn.style.opacity = '1'; btn.disabled = false; } });