Shopping Cart
{{ item.name }}
{{ item.quantity }} x {{ item.attributes.friendly_price }}
{{ item.attributes.remark }}
let cartCount = 0; // إنشاء عداد الطلبات أعلى الصفحة const cartBadge = document.createElement('div'); cartBadge.style.position = 'fixed'; cartBadge.style.top = '10px'; cartBadge.style.right = '10px'; cartBadge.style.background = '#d62828'; cartBadge.style.color = '#fff'; cartBadge.style.padding = '10px 15px'; cartBadge.style.borderRadius = '20px'; cartBadge.style.fontWeight = 'bold'; cartBadge.innerText = "طلبات: 0"; document.body.appendChild(cartBadge); // إضافة زر "اطلب الآن" لكل عنصر document.querySelectorAll('.menu-item').forEach(item => { const btn = document.createElement('button'); btn.innerText = "اطلب الآن"; btn.style.background = '#fcbf49'; btn.style.color = '#000'; btn.style.border = 'none'; btn.style.padding = '8px 12px'; btn.style.marginTop = '10px'; btn.style.borderRadius = '8px'; btn.style.cursor = 'pointer'; item.appendChild(btn); // عند الضغط على العنصر يظهر التفاصيل item.addEventListener('click', () => { item.classList.toggle('active'); }); // عند الضغط على زر الطلب btn.addEventListener('click', (e) => { e.stopPropagation(); const name = item.querySelector('h3').innerText; cartCount++; cartBadge.innerText = "طلبات: " + cartCount; showNotification("تمت إضافة: " + name); }); }); // إشعار بسيط function showNotification(text) { const notif = document.createElement('div'); notif.innerText = text; notif.style.position = 'fixed'; notif.style.bottom = '20px'; notif.style.left = '50%'; notif.style.transform = 'translateX(-50%)'; notif.style.background = '#f77f00'; notif.style.color = '#fff'; notif.style.padding = '10px 20px'; notif.style.borderRadius = '10px'; document.body.appendChild(notif); setTimeout(() => { notif.remove(); }, 2000); }