Spaces:
Running
Running
Download index.html from afarouk79/ecommerce-website: direct link, hf CLI and curl.
- Browser
- Download file 37 kB
-
https://huggingface.co/spaces/afarouk79/ecommerce-website/resolve/main/index.html
- Command line
-
hf download hf://spaces/afarouk79/ecommerce-website/index.html
-
curl -L -o index.html https://huggingface.co/spaces/afarouk79/ecommerce-website/resolve/main/index.html
37 kB
| <html lang="ar" dir="rtl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Epay - متجرك الإلكتروني</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap'); | |
| body { | |
| font-family: 'Tajawal', sans-serif; | |
| background-color: #f8fafc; | |
| } | |
| .gradient-bg { | |
| background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); | |
| } | |
| .product-card:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); | |
| } | |
| .cart-item { | |
| transition: all 0.3s ease; | |
| } | |
| .cart-item:hover { | |
| background-color: #f1f5f9; | |
| } | |
| .search-input:focus { | |
| outline: none; | |
| box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3); | |
| } | |
| /* Animation for notification */ | |
| @keyframes slideIn { | |
| from { transform: translateX(100%); opacity: 0; } | |
| to { transform: translateX(0); opacity: 1; } | |
| } | |
| .notification { | |
| animation: slideIn 0.3s ease-out; | |
| } | |
| </style> | |
| </head> | |
| <body class="text-gray-800"> | |
| <!-- Header --> | |
| <header class="gradient-bg text-white shadow-lg"> | |
| <div class="container mx-auto px-4 py-3"> | |
| <div class="flex items-center justify-between"> | |
| <!-- Logo --> | |
| <div class="flex items-center space-x-2"> | |
| <i class="fas fa-shopping-bag text-2xl"></i> | |
| <h1 class="text-2xl font-bold">Epay</h1> | |
| </div> | |
| <!-- Search Bar --> | |
| <div class="hidden md:flex flex-1 mx-8"> | |
| <div class="relative w-full max-w-xl"> | |
| <input type="text" placeholder="ابحث عن المنتجات..." class="w-full py-2 px-4 rounded-full text-gray-800 focus:ring-2 focus:ring-indigo-300"> | |
| <button class="absolute left-0 top-0 h-full px-4 text-gray-500"> | |
| <i class="fas fa-search"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Navigation --> | |
| <nav class="flex items-center space-x-6"> | |
| <a href="#" class="hover:text-indigo-200 transition"> | |
| <i class="fas fa-home text-xl"></i> | |
| <span class="hidden md:inline">الرئيسية</span> | |
| </a> | |
| <a href="#" class="hover:text-indigo-200 transition"> | |
| <i class="fas fa-list text-xl"></i> | |
| <span class="hidden md:inline">الفئات</span> | |
| </a> | |
| <button id="cart-btn" class="relative hover:text-indigo-200 transition"> | |
| <i class="fas fa-shopping-cart text-xl"></i> | |
| <span class="hidden md:inline">السلة</span> | |
| <span id="cart-count" class="absolute -top-2 -right-2 bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center">0</span> | |
| </button> | |
| <a href="#" class="hover:text-indigo-200 transition"> | |
| <i class="fas fa-user text-xl"></i> | |
| <span class="hidden md:inline">حسابي</span> | |
| </a> | |
| </nav> | |
| </div> | |
| <!-- Mobile Search --> | |
| <div class="mt-3 md:hidden"> | |
| <div class="relative"> | |
| <input type="text" placeholder="ابحث عن المنتجات..." class="w-full py-2 px-4 rounded-full text-gray-800 pl-10"> | |
| <button class="absolute right-0 top-0 h-full px-4 text-gray-500"> | |
| <i class="fas fa-search"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="container mx-auto px-4 py-6"> | |
| <!-- Hero Section --> | |
| <section class="gradient-bg rounded-xl text-white p-8 mb-8"> | |
| <div class="flex flex-col md:flex-row items-center"> | |
| <div class="md:w-1/2 mb-6 md:mb-0"> | |
| <h2 class="text-3xl md:text-4xl font-bold mb-4">خصومات تصل إلى 50%</h2> | |
| <p class="text-lg mb-6">اكتشف أحدث العروض والمنتجات بأسعار لا تقبل المنافسة</p> | |
| <button class="bg-white text-indigo-600 font-bold py-2 px-6 rounded-full hover:bg-gray-100 transition"> | |
| تسوق الآن <i class="fas fa-arrow-left ml-2"></i> | |
| </button> | |
| </div> | |
| <div class="md:w-1/2 flex justify-center"> | |
| <img src="https://via.placeholder.com/500x300" alt="عروض خاصة" class="rounded-lg shadow-xl"> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Categories --> | |
| <section class="mb-10"> | |
| <h2 class="text-2xl font-bold mb-6 border-b pb-2">تصفح حسب الفئة</h2> | |
| <div class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4"> | |
| <a href="#" class="bg-white p-4 rounded-lg shadow-sm text-center hover:shadow-md transition"> | |
| <div class="bg-indigo-100 text-indigo-600 rounded-full p-3 inline-block mb-2"> | |
| <i class="fas fa-mobile-alt text-xl"></i> | |
| </div> | |
| <p class="font-medium">الهواتف</p> | |
| </a> | |
| <a href="#" class="bg-white p-4 rounded-lg shadow-sm text-center hover:shadow-md transition"> | |
| <div class="bg-blue-100 text-blue-600 rounded-full p-3 inline-block mb-2"> | |
| <i class="fas fa-laptop text-xl"></i> | |
| </div> | |
| <p class="font-medium">أجهزة كمبيوتر</p> | |
| </a> | |
| <a href="#" class="bg-white p-4 rounded-lg shadow-sm text-center hover:shadow-md transition"> | |
| <div class="bg-green-100 text-green-600 rounded-full p-3 inline-block mb-2"> | |
| <i class="fas fa-tshirt text-xl"></i> | |
| </div> | |
| <p class="font-medium">الملابس</p> | |
| </a> | |
| <a href="#" class="bg-white p-4 rounded-lg shadow-sm text-center hover:shadow-md transition"> | |
| <div class="bg-yellow-100 text-yellow-600 rounded-full p-3 inline-block mb-2"> | |
| <i class="fas fa-home text-xl"></i> | |
| </div> | |
| <p class="font-medium">المنزل</p> | |
| </a> | |
| <a href="#" class="bg-white p-4 rounded-lg shadow-sm text-center hover:shadow-md transition"> | |
| <div class="bg-red-100 text-red-600 rounded-full p-3 inline-block mb-2"> | |
| <i class="fas fa-gamepad text-xl"></i> | |
| </div> | |
| <p class="font-medium">الألعاب</p> | |
| </a> | |
| <a href="#" class="bg-white p-4 rounded-lg shadow-sm text-center hover:shadow-md transition"> | |
| <div class="bg-purple-100 text-purple-600 rounded-full p-3 inline-block mb-2"> | |
| <i class="fas fa-headphones text-xl"></i> | |
| </div> | |
| <p class="font-medium">إلكترونيات</p> | |
| </a> | |
| </div> | |
| </section> | |
| <!-- Featured Products --> | |
| <section class="mb-10"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <h2 class="text-2xl font-bold border-b pb-2">منتجات مميزة</h2> | |
| <a href="#" class="text-indigo-600 hover:text-indigo-800 font-medium">عرض الكل <i class="fas fa-arrow-left ml-1"></i></a> | |
| </div> | |
| <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6"> | |
| <!-- Product 1 --> | |
| <div class="bg-white rounded-lg shadow-md overflow-hidden product-card transition duration-300"> | |
| <div class="relative"> | |
| <img src="https://via.placeholder.com/300x200" alt="هاتف ذكي" class="w-full h-48 object-cover"> | |
| <span class="absolute top-2 right-2 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full">خصم 20%</span> | |
| </div> | |
| <div class="p-4"> | |
| <h3 class="font-bold text-lg mb-1">هاتف ذكي XZ Pro</h3> | |
| <div class="flex items-center mb-2"> | |
| <div class="flex text-yellow-400"> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star-half-alt"></i> | |
| </div> | |
| <span class="text-gray-600 text-sm mr-1">(125)</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <div> | |
| <span class="text-gray-500 line-through text-sm">2,499 ر.س</span> | |
| <p class="font-bold text-indigo-600">1,999 ر.س</p> | |
| </div> | |
| <button class="add-to-cart bg-indigo-100 text-indigo-600 p-2 rounded-full hover:bg-indigo-200 transition" data-id="1" data-name="هاتف ذكي XZ Pro" data-price="1999"> | |
| <i class="fas fa-plus"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Product 2 --> | |
| <div class="bg-white rounded-lg shadow-md overflow-hidden product-card transition duration-300"> | |
| <div class="relative"> | |
| <img src="https://via.placeholder.com/300x200" alt="لابتوب" class="w-full h-48 object-cover"> | |
| </div> | |
| <div class="p-4"> | |
| <h3 class="font-bold text-lg mb-1">لابتوب UltraBook</h3> | |
| <div class="flex items-center mb-2"> | |
| <div class="flex text-yellow-400"> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="far fa-star"></i> | |
| </div> | |
| <span class="text-gray-600 text-sm mr-1">(89)</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <p class="font-bold text-indigo-600">3,499 ر.س</p> | |
| <button class="add-to-cart bg-indigo-100 text-indigo-600 p-2 rounded-full hover:bg-indigo-200 transition" data-id="2" data-name="لابتوب UltraBook" data-price="3499"> | |
| <i class="fas fa-plus"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Product 3 --> | |
| <div class="bg-white rounded-lg shadow-md overflow-hidden product-card transition duration-300"> | |
| <div class="relative"> | |
| <img src="https://via.placeholder.com/300x200" alt="سماعات" class="w-full h-48 object-cover"> | |
| <span class="absolute top-2 right-2 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full">جديد</span> | |
| </div> | |
| <div class="p-4"> | |
| <h3 class="font-bold text-lg mb-1">سماعات لاسلكية</h3> | |
| <div class="flex items-center mb-2"> | |
| <div class="flex text-yellow-400"> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| </div> | |
| <span class="text-gray-600 text-sm mr-1">(215)</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <p class="font-bold text-indigo-600">599 ر.س</p> | |
| <button class="add-to-cart bg-indigo-100 text-indigo-600 p-2 rounded-full hover:bg-indigo-200 transition" data-id="3" data-name="سماعات لاسلكية" data-price="599"> | |
| <i class="fas fa-plus"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Product 4 --> | |
| <div class="bg-white rounded-lg shadow-md overflow-hidden product-card transition duration-300"> | |
| <div class="relative"> | |
| <img src="https://via.placeholder.com/300x200" alt="ساعة ذكية" class="w-full h-48 object-cover"> | |
| </div> | |
| <div class="p-4"> | |
| <h3 class="font-bold text-lg mb-1">ساعة ذكية Pro 5</h3> | |
| <div class="flex items-center mb-2"> | |
| <div class="flex text-yellow-400"> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star"></i> | |
| <i class="fas fa-star-half-alt"></i> | |
| <i class="far fa-star"></i> | |
| </div> | |
| <span class="text-gray-600 text-sm mr-1">(47)</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <div> | |
| <span class="text-gray-500 line-through text-sm">899 ر.س</span> | |
| <p class="font-bold text-indigo-600">749 ر.س</p> | |
| </div> | |
| <button class="add-to-cart bg-indigo-100 text-indigo-600 p-2 rounded-full hover:bg-indigo-200 transition" data-id="4" data-name="ساعة ذكية Pro 5" data-price="749"> | |
| <i class="fas fa-plus"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Special Offers --> | |
| <section class="mb-10"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <h2 class="text-2xl font-bold border-b pb-2">عروض خاصة</h2> | |
| <a href="#" class="text-indigo-600 hover:text-indigo-800 font-medium">عرض الكل <i class="fas fa-arrow-left ml-1"></i></a> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> | |
| <!-- Offer 1 --> | |
| <div class="bg-white rounded-lg shadow-md overflow-hidden relative"> | |
| <div class="md:flex"> | |
| <div class="md:w-1/3"> | |
| <img src="https://via.placeholder.com/300x300" alt="عرض خاص" class="w-full h-full object-cover"> | |
| </div> | |
| <div class="p-6 md:w-2/3"> | |
| <span class="bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full absolute top-4 left-4">عرض محدود</span> | |
| <h3 class="font-bold text-xl mb-2">خصم كبير على الأجهزة المنزلية</h3> | |
| <p class="text-gray-600 mb-4">احصل على خصم يصل إلى 40% على مجموعة مختارة من الأجهزة المنزلية. العرض ساري حتى نفاذ الكمية.</p> | |
| <div class="flex items-center"> | |
| <span class="text-gray-500 line-through text-lg mr-2">2,999 ر.س</span> | |
| <span class="text-red-500 font-bold text-xl">1,799 ر.س</span> | |
| </div> | |
| <button class="mt-4 bg-indigo-600 text-white font-bold py-2 px-6 rounded-full hover:bg-indigo-700 transition"> | |
| تسوق الآن <i class="fas fa-arrow-left ml-2"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Offer 2 --> | |
| <div class="bg-white rounded-lg shadow-md overflow-hidden relative"> | |
| <div class="md:flex"> | |
| <div class="md:w-1/3"> | |
| <img src="https://via.placeholder.com/300x300" alt="عرض خاص" class="w-full h-full object-cover"> | |
| </div> | |
| <div class="p-6 md:w-2/3"> | |
| <span class="bg-blue-500 text-white text-xs font-bold px-2 py-1 rounded-full absolute top-4 left-4">جديد</span> | |
| <h3 class="font-bold text-xl mb-2">مجموعة العناية الشخصية</h3> | |
| <p class="text-gray-600 mb-4">احصل على 3 منتجات للعناية الشخصية بسعر منتجين فقط. العرض ساري حتى نهاية الشهر.</p> | |
| <div class="flex items-center"> | |
| <span class="text-gray-500 line-through text-lg mr-2">450 ر.س</span> | |
| <span class="text-blue-500 font-bold text-xl">299 ر.س</span> | |
| </div> | |
| <button class="mt-4 bg-indigo-600 text-white font-bold py-2 px-6 rounded-full hover:bg-indigo-700 transition"> | |
| تسوق الآن <i class="fas fa-arrow-left ml-2"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Brands --> | |
| <section class="mb-10"> | |
| <h2 class="text-2xl font-bold mb-6 border-b pb-2">العلامات التجارية</h2> | |
| <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-6 gap-4"> | |
| <div class="bg-white p-4 rounded-lg shadow-sm flex items-center justify-center"> | |
| <img src="https://via.placeholder.com/100x50" alt="براند" class="h-10 object-contain"> | |
| </div> | |
| <div class="bg-white p-4 rounded-lg shadow-sm flex items-center justify-center"> | |
| <img src="https://via.placeholder.com/100x50" alt="براند" class="h-10 object-contain"> | |
| </div> | |
| <div class="bg-white p-4 rounded-lg shadow-sm flex items-center justify-center"> | |
| <img src="https://via.placeholder.com/100x50" alt="براند" class="h-10 object-contain"> | |
| </div> | |
| <div class="bg-white p-4 rounded-lg shadow-sm flex items-center justify-center"> | |
| <img src="https://via.placeholder.com/100x50" alt="براند" class="h-10 object-contain"> | |
| </div> | |
| <div class="bg-white p-4 rounded-lg shadow-sm flex items-center justify-center"> | |
| <img src="https://via.placeholder.com/100x50" alt="براند" class="h-10 object-contain"> | |
| </div> | |
| <div class="bg-white p-4 rounded-lg shadow-sm flex items-center justify-center"> | |
| <img src="https://via.placeholder.com/100x50" alt="براند" class="h-10 object-contain"> | |
| </div> | |
| </div> | |
| </section> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="bg-gray-900 text-white pt-10 pb-6"> | |
| <div class="container mx-auto px-4"> | |
| <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8 mb-8"> | |
| <!-- About --> | |
| <div> | |
| <h3 class="text-xl font-bold mb-4">عن Epay</h3> | |
| <p class="text-gray-400 mb-4">متجر إلكتروني رائد يوفر أحدث المنتجات بأسعار تنافسية وخدمة عملاء مميزة.</p> | |
| <div class="flex space-x-4"> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i class="fab fa-facebook-f"></i> | |
| </a> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i class="fab fa-twitter"></i> | |
| </a> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i class="fab fa-instagram"></i> | |
| </a> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i class="fab fa-youtube"></i> | |
| </a> | |
| </div> | |
| </div> | |
| <!-- Quick Links --> | |
| <div> | |
| <h3 class="text-xl font-bold mb-4">روابط سريعة</h3> | |
| <ul class="space-y-2"> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">الرئيسية</a></li> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">من نحن</a></li> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">المنتجات</a></li> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">العروض</a></li> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">اتصل بنا</a></li> | |
| </ul> | |
| </div> | |
| <!-- Customer Service --> | |
| <div> | |
| <h3 class="text-xl font-bold mb-4">خدمة العملاء</h3> | |
| <ul class="space-y-2"> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">حسابي</a></li> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">تتبع الطلب</a></li> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">سياسة الإرجاع</a></li> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">الأسئلة الشائعة</a></li> | |
| <li><a href="#" class="text-gray-400 hover:text-white transition">الشروط والأحكام</a></li> | |
| </ul> | |
| </div> | |
| <!-- Newsletter --> | |
| <div> | |
| <h3 class="text-xl font-bold mb-4">النشرة البريدية</h3> | |
| <p class="text-gray-400 mb-4">اشترك في نشرتنا البريدية لتصلك أحدث العروض والتخفيضات.</p> | |
| <div class="flex"> | |
| <input type="email" placeholder="بريدك الإلكتروني" class="bg-gray-800 text-white px-4 py-2 rounded-r-lg focus:outline-none w-full"> | |
| <button class="bg-indigo-600 text-white px-4 py-2 rounded-l-lg hover:bg-indigo-700 transition"> | |
| <i class="fas fa-paper-plane"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="border-t border-gray-800 pt-6 flex flex-col md:flex-row justify-between items-center"> | |
| <p class="text-gray-400 mb-4 md:mb-0">© 2023 Epay. جميع الحقوق محفوظة.</p> | |
| <div class="flex space-x-6"> | |
| <img src="https://via.placeholder.com/50x30" alt="Payment" class="h-8"> | |
| <img src="https://via.placeholder.com/50x30" alt="Payment" class="h-8"> | |
| <img src="https://via.placeholder.com/50x30" alt="Payment" class="h-8"> | |
| <img src="https://via.placeholder.com/50x30" alt="Payment" class="h-8"> | |
| </div> | |
| </div> | |
| </div> | |
| </footer> | |
| <!-- Shopping Cart Sidebar --> | |
| <div id="cart-sidebar" class="fixed top-0 right-0 h-full w-full md:w-96 bg-white shadow-lg transform translate-x-full transition-transform duration-300 z-50 overflow-y-auto"> | |
| <div class="p-4"> | |
| <div class="flex justify-between items-center border-b pb-4 mb-4"> | |
| <h3 class="text-xl font-bold">سلة التسوق</h3> | |
| <button id="close-cart" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-times text-xl"></i> | |
| </button> | |
| </div> | |
| <div id="cart-items" class="mb-4"> | |
| <!-- Cart items will be added here dynamically --> | |
| <p class="text-gray-500 text-center py-8">سلة التسوق فارغة</p> | |
| </div> | |
| <div class="border-t pt-4"> | |
| <div class="flex justify-between mb-2"> | |
| <span>المجموع:</span> | |
| <span id="cart-total" class="font-bold">0 ر.س</span> | |
| </div> | |
| <div class="flex justify-between mb-4"> | |
| <span>التوصيل:</span> | |
| <span class="font-bold">25 ر.س</span> | |
| </div> | |
| <div class="flex justify-between border-t pt-2 mb-6"> | |
| <span class="font-bold">الإجمالي:</span> | |
| <span id="cart-grand-total" class="font-bold text-indigo-600">25 ر.س</span> | |
| </div> | |
| <button class="w-full bg-indigo-600 text-white py-3 rounded-lg font-bold hover:bg-indigo-700 transition mb-2"> | |
| إتمام الشراء | |
| </button> | |
| <button class="w-full border border-indigo-600 text-indigo-600 py-3 rounded-lg font-bold hover:bg-indigo-50 transition"> | |
| مواصلة التسوق | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Overlay --> | |
| <div id="overlay" class="fixed inset-0 bg-black bg-opacity-50 z-40 hidden"></div> | |
| <!-- Notification --> | |
| <div id="notification" class="fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg hidden notification"> | |
| <div class="flex items-center"> | |
| <i class="fas fa-check-circle mr-2"></i> | |
| <span id="notification-message">تمت إضافة المنتج إلى السلة</span> | |
| </div> | |
| </div> | |
| <script> | |
| // Shopping Cart Functionality | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const cartBtn = document.getElementById('cart-btn'); | |
| const closeCartBtn = document.getElementById('close-cart'); | |
| const cartSidebar = document.getElementById('cart-sidebar'); | |
| const overlay = document.getElementById('overlay'); | |
| const addToCartBtns = document.querySelectorAll('.add-to-cart'); | |
| const cartItemsContainer = document.getElementById('cart-items'); | |
| const cartCount = document.getElementById('cart-count'); | |
| const cartTotal = document.getElementById('cart-total'); | |
| const cartGrandTotal = document.getElementById('cart-grand-total'); | |
| const notification = document.getElementById('notification'); | |
| const notificationMessage = document.getElementById('notification-message'); | |
| let cart = []; | |
| // Load cart from localStorage if exists | |
| if (localStorage.getItem('cart')) { | |
| cart = JSON.parse(localStorage.getItem('cart')); | |
| updateCart(); | |
| } | |
| // Toggle Cart Sidebar | |
| cartBtn.addEventListener('click', function() { | |
| cartSidebar.classList.remove('translate-x-full'); | |
| overlay.classList.remove('hidden'); | |
| document.body.style.overflow = 'hidden'; | |
| }); | |
| closeCartBtn.addEventListener('click', function() { | |
| cartSidebar.classList.add('translate-x-full'); | |
| overlay.classList.add('hidden'); | |
| document.body.style.overflow = 'auto'; | |
| }); | |
| overlay.addEventListener('click', function() { | |
| cartSidebar.classList.add('translate-x-full'); | |
| overlay.classList.add('hidden'); | |
| document.body.style.overflow = 'auto'; | |
| }); | |
| // Add to Cart | |
| addToCartBtns.forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const id = this.getAttribute('data-id'); | |
| const name = this.getAttribute('data-name'); | |
| const price = parseFloat(this.getAttribute('data-price')); | |
| // Check if item already in cart | |
| const existingItem = cart.find(item => item.id === id); | |
| if (existingItem) { | |
| existingItem.quantity += 1; | |
| } else { | |
| cart.push({ | |
| id, | |
| name, | |
| price, | |
| quantity: 1 | |
| }); | |
| } | |
| // Save to localStorage | |
| localStorage.setItem('cart', JSON.stringify(cart)); | |
| // Update cart UI | |
| updateCart(); | |
| // Show notification | |
| notificationMessage.textContent = `تمت إضافة ${name} إلى السلة`; | |
| notification.classList.remove('hidden'); | |
| // Hide notification after 3 seconds | |
| setTimeout(() => { | |
| notification.classList.add('hidden'); | |
| }, 3000); | |
| }); | |
| }); | |
| // Update Cart | |
| function updateCart() { | |
| // Update cart count | |
| const totalItems = cart.reduce((total, item) => total + item.quantity, 0); | |
| cartCount.textContent = totalItems; | |
| // Update cart items | |
| if (cart.length === 0) { | |
| cartItemsContainer.innerHTML = '<p class="text-gray-500 text-center py-8">سلة التسوق فارغة</p>'; | |
| cartTotal.textContent = '0 ر.س'; | |
| cartGrandTotal.textContent = '25 ر.س'; | |
| return; | |
| } | |
| let itemsHTML = ''; | |
| let subtotal = 0; | |
| cart.forEach(item => { | |
| const itemTotal = item.price * item.quantity; | |
| subtotal += itemTotal; | |
| itemsHTML += ` | |
| <div class="cart-item flex items-center justify-between p-3 border-b"> | |
| <div class="flex items-center"> | |
| <img src="https://via.placeholder.com/60x60" alt="${item.name}" class="w-12 h-12 object-cover rounded mr-3"> | |
| <div> | |
| <h4 class="font-medium">${item.name}</h4> | |
| <p class="text-gray-600 text-sm">${item.price} ر.س</p> | |
| </div> | |
| </div> | |
| <div class="flex items-center"> | |
| <button class="decrease-quantity text-gray-500 px-2" data-id="${item.id}"> | |
| <i class="fas fa-minus text-xs"></i> | |
| </button> | |
| <span class="mx-2">${item.quantity}</span> | |
| <button class="increase-quantity text-gray-500 px-2" data-id="${item.id}"> | |
| <i class="fas fa-plus text-xs"></i> | |
| </button> | |
| <button class="remove-item text-red-500 ml-3" data-id="${item.id}"> | |
| <i class="fas fa-trash"></i> | |
| </button> | |
| </div> | |
| </div> | |
| `; | |
| }); | |
| cartItemsContainer.innerHTML = itemsHTML; | |
| cartTotal.textContent = `${subtotal.toFixed(2)} ر.س`; | |
| cartGrandTotal.textContent = `${(subtotal + 25).toFixed(2)} ر.س`; | |
| // Add event listeners to quantity buttons | |
| document.querySelectorAll('.decrease-quantity').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const id = this.getAttribute('data-id'); | |
| const item = cart.find(item => item.id === id); | |
| if (item.quantity > 1) { | |
| item.quantity -= 1; | |
| } else { | |
| cart = cart.filter(item => item.id !== id); | |
| } | |
| localStorage.setItem('cart', JSON.stringify(cart)); | |
| updateCart(); | |
| }); | |
| }); | |
| document.querySelectorAll('.increase-quantity').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const id = this.getAttribute('data-id'); | |
| const item = cart.find(item => item.id === id); | |
| item.quantity += 1; | |
| localStorage.setItem('cart', JSON.stringify(cart)); | |
| updateCart(); | |
| }); | |
| }); | |
| document.querySelectorAll('.remove-item').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const id = this.getAttribute('data-id'); | |
| cart = cart.filter(item => item.id !== id); | |
| localStorage.setItem('cart', JSON.stringify(cart)); | |
| updateCart(); | |
| // Show notification | |
| notificationMessage.textContent = 'تمت إزالة المنتج من السلة'; | |
| notification.classList.remove('hidden'); | |
| // Hide notification after 3 seconds | |
| setTimeout(() => { | |
| notification.classList.add('hidden'); | |
| }, 3000); | |
| }); | |
| }); | |
| } | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=afarouk79/ecommerce-website" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |