<div dir="rtl" style="font-family: Arial, sans-serif; margin: 30px auto; max-width: 600px;"> <h2 style="text-align: center;">نموذج التواصل مع الإدارة</h2> <p style="text-align: center;"> يرجى تعبئة النموذج أدناه لطلب الدعم أو إرسال استفسار، وسيتم الرد عليك عبر معلوماتك التي أدخلتها. </p> <!--رسائل الحالة--> <div id="formStatus" style="border-radius: 5px; display: none; font-weight: bold; margin: 15px 0px; padding: 12px; text-align: center;"></div> <form id="contactForm"> <label>رقم واتساب العميل</label><br /> <input id="whatsapp" name="whatsapp" placeholder="مثال: 2126XXXXXXXX" required="" style="margin-bottom: 15px; padding: 10px; width: 100%;" type="text" /><br /> <label>البريد الإلكتروني</label><br /> <input id="Email" name="Email" placeholder="مثال: test@gmail.com" required="" style="margin-bottom: 15px; padding: 10px; width: 100%;" type="text" /><br /> <label>مضمون الرسالة</label><br /> <textarea id="message" name="message" placeholder="اكتب هنا تفاصيل طلبك أو مشكلتك..." required="" rows="5" style="margin-bottom: 15px; padding: 10px; width: 100%;"></textarea><br /> <button onclick="sendToTelegram(this)" style="background-color: #007bff; border-radius: 5px; border: none; color: white; cursor: pointer; font-size: 16px; padding: 12px; width: 100%;" type="button"> إرسال </button> </form> </div> <script> function showStatusMessage(message, type = 'success') { const statusDiv = document.getElementById('formStatus'); statusDiv.style.display = 'block'; statusDiv.style.backgroundColor = type === 'success' ? '#d4edda' : '#f8d7da'; statusDiv.style.color = type === 'success' ? '#155724' : '#721c24'; statusDiv.style.border = type === 'success' ? '1px solid #c3e6cb' : '1px solid #f5c6cb'; statusDiv.textContent = message; setTimeout(() => { statusDiv.style.display = 'none'; }, 5000); // تختفي بعد 5 ثوانٍ } function sendToTelegram(btn) { const whatsapp = document.getElementById('whatsapp').value.trim(); const Email = document.getElementById('Email').value.trim(); const message = document.getElementById('message').value.trim(); if (!whatsapp || !Email || !message) { showStatusMessage('يرجى ملء جميع الحقول.', 'error'); return; } btn.disabled = true; btn.textContent = 'جاري الإرسال...'; const botToken = '7558242625:AAFd5eneQ3Ar4QlY36w7ePgGoreFoOYlWnU'; const chatId = '1693543914'; const telegramMessage = `📩 رسالة جديدة:\n📱 واتساب: ${whatsapp}\n📧 البريد الإلكتروني: ${Email}\n✉️ الرسالة:\n${message}`; fetch(`https://api.telegram.org/bot${botToken}/sendMessage?chat_id=${chatId}&text=${encodeURIComponent(telegramMessage)}`) .then(response => response.json()) .then(data => { if (data.ok) { showStatusMessage('✅ تم الإرسال بنجاح.'); document.getElementById('contactForm').reset(); } else { showStatusMessage('❌ خطأ أثناء الإرسال: ' + (data.description || 'خطأ غير معروف'), 'error'); } }) .catch(() => { showStatusMessage('❌ فشل الاتصال بالخادم.', 'error'); }) .finally(() => { btn.disabled = false; btn.textContent = 'إرسال'; }); } </script>