Spaces:
Running
Running
Download index.html from mohamed521/anycoder-82889866: direct link, hf CLI and curl.
- Browser
- Download file 40.1 kB
-
https://huggingface.co/spaces/mohamed521/anycoder-82889866/resolve/main/index.html
- Command line
-
hf download hf://spaces/mohamed521/anycoder-82889866/index.html
-
curl -L -o index.html https://huggingface.co/spaces/mohamed521/anycoder-82889866/resolve/main/index.html
40.1 kB
| <html lang="ar" dir="rtl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>نظام فارما برو - إدارة الصيدليات المتكامل</title> | |
| <!-- Preconnect for Performance --> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <!-- Font: Tajawal for Professional Arabic Typography --> | |
| <link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap" rel="stylesheet"> | |
| <!-- Icons: Phosphor Icons (Modern, Lightweight, Outline/Fill mix) --> | |
| <script src="https://unpkg.com/@phosphor-icons/web"></script> | |
| <!-- Tailwind CSS --> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script> | |
| tailwind.config = { | |
| darkMode: 'class', | |
| theme: { | |
| extend: { | |
| fontFamily: { | |
| sans: ['Tajawal', 'system-ui', 'sans-serif'], | |
| }, | |
| colors: { | |
| pharmacy: { | |
| 50: '#f0fdf4', | |
| 100: '#dcfce7', | |
| 200: '#bbf7d0', | |
| 300: '#86efac', | |
| 400: '#4ade80', | |
| 500: '#22c55e', | |
| 600: '#16a34a', // Brand Green | |
| 700: '#15803d', | |
| 800: '#166534', | |
| 900: '#14532d', | |
| 950: '#052e16', | |
| }, | |
| slate: { | |
| 850: '#1e293b', | |
| 900: '#0f172a', | |
| 950: '#020617', | |
| } | |
| }, | |
| animation: { | |
| 'fade-in': 'fadeIn 0.3s ease-out', | |
| 'slide-up': 'slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1)', | |
| 'scale-in': 'scaleIn 0.2s ease-out', | |
| }, | |
| keyframes: { | |
| fadeIn: { | |
| '0%': { opacity: '0' }, | |
| '100%': { opacity: '1' }, | |
| }, | |
| slideUp: { | |
| '0%': { transform: 'translateY(20px)', opacity: '0' }, | |
| '100%': { transform: 'translateY(0)', opacity: '1' }, | |
| }, | |
| scaleIn: { | |
| '0%': { transform: 'scale(0.95)', opacity: '0' }, | |
| '100%': { transform: 'scale(1)', opacity: '1' }, | |
| } | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| /* Custom Scrollbar */ | |
| ::-webkit-scrollbar { | |
| width: 8px; | |
| height: 8px; | |
| } | |
| ::-webkit-scrollbar-track { | |
| background: #0f172a; | |
| } | |
| ::-webkit-scrollbar-thumb { | |
| background: #334155; | |
| border-radius: 4px; | |
| } | |
| ::-webkit-scrollbar-thumb:hover { | |
| background: #475569; | |
| } | |
| /* Glassmorphism Utilities */ | |
| .glass-panel { | |
| background: rgba(15, 23, 42, 0.7); | |
| backdrop-filter: blur(12px); | |
| border: 1px solid rgba(255, 255, 255, 0.08); | |
| } | |
| .glass-input { | |
| background: rgba(30, 41, 59, 0.6); | |
| border: 1px solid rgba(255, 255, 255, 0.1); | |
| color: white; | |
| transition: all 0.2s; | |
| } | |
| .glass-input:focus { | |
| border-color: #22c55e; | |
| background: rgba(30, 41, 59, 0.9); | |
| outline: none; | |
| box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2); | |
| } | |
| /* Table Styles */ | |
| .custom-table th { | |
| position: sticky; | |
| top: 0; | |
| background: #0f172a; | |
| z-index: 10; | |
| } | |
| /* Animation for rows */ | |
| tr { | |
| transition: background-color 0.15s; | |
| } | |
| tr:hover td { | |
| background-color: rgba(34, 197, 94, 0.05); | |
| } | |
| /* Print Styles */ | |
| @media print { | |
| body * { | |
| visibility: hidden; | |
| } | |
| #print-area, #print-area * { | |
| visibility: visible; | |
| } | |
| #print-area { | |
| position: absolute; | |
| left: 0; | |
| top: 0; | |
| width: 100%; | |
| background: white; | |
| color: black; | |
| } | |
| .no-print { | |
| display: none ; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-slate-950 text-slate-200 font-sans antialiased selection:bg-pharmacy-500 selection:text-white overflow-hidden"> | |
| <!-- Main Application Container --> | |
| <div class="flex h-screen w-full" id="app-container"> | |
| <!-- Sidebar Navigation --> | |
| <aside class="w-72 bg-slate-900 border-l border-slate-800 flex flex-col h-full transition-all duration-300 z-20 flex-shrink-0 shadow-2xl" id="sidebar"> | |
| <!-- Brand --> | |
| <div class="h-20 flex items-center px-6 border-b border-slate-800"> | |
| <div class="flex items-center gap-3"> | |
| <div class="w-10 h-10 rounded-xl bg-gradient-to-tr from-pharmacy-600 to-emerald-400 flex items-center justify-center text-white shadow-lg shadow-pharmacy-900/50"> | |
| <i class="ph-fill ph-first-aid text-xl"></i> | |
| </div> | |
| <div> | |
| <h1 class="text-xl font-bold text-white tracking-tight">فارما برو</h1> | |
| <p class="text-xs text-slate-500 font-medium">نظام إدارة الصيدليات</p> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Nav Links --> | |
| <nav class="flex-1 overflow-y-auto py-6 px-3 space-y-1 custom-scrollbar"> | |
| <button onclick="app.navigate('dashboard')" class="nav-btn w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all text-slate-400 hover:bg-slate-800 hover:text-white group" data-target="dashboard"> | |
| <i class="ph-duotone ph-squares-four text-lg group-hover:text-pharmacy-400 transition-colors"></i> | |
| <span>الرئيسية والمؤشرات</span> | |
| </button> | |
| <button onclick="app.navigate('sales')" class="nav-btn w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all text-slate-400 hover:bg-slate-800 hover:text-white group" data-target="sales"> | |
| <i class="ph-duotone ph-shopping-cart text-lg group-hover:text-pharmacy-400 transition-colors"></i> | |
| <span>شاشة البيع السريع</span> | |
| </button> | |
| <button onclick="app.navigate('products')" class="nav-btn w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all text-slate-400 hover:bg-slate-800 hover:text-white group" data-target="products"> | |
| <i class="ph-duotone ph-pill text-lg group-hover:text-pharmacy-400 transition-colors"></i> | |
| <span>الأصناف والمخزون</span> | |
| </button> | |
| <button onclick="app.navigate('customers')" class="nav-btn w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all text-slate-400 hover:bg-slate-800 hover:text-white group" data-target="customers"> | |
| <i class="ph-duotone ph-users text-lg group-hover:text-pharmacy-400 transition-colors"></i> | |
| <span>العملاء والآجل</span> | |
| </button> | |
| <button onclick="app.navigate('suppliers')" class="nav-btn w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all text-slate-400 hover:bg-slate-800 hover:text-white group" data-target="suppliers"> | |
| <i class="ph-duotone ph-truck text-lg group-hover:text-pharmacy-400 transition-colors"></i> | |
| <span>الموردين</span> | |
| </button> | |
| <button onclick="app.navigate('purchases')" class="nav-btn w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all text-slate-400 hover:bg-slate-800 hover:text-white group" data-target="purchases"> | |
| <i class="ph-duotone ph-hand-arrow-down text-lg group-hover:text-pharmacy-400 transition-colors"></i> | |
| <span>المشتريات</span> | |
| </button> | |
| <button onclick="app.navigate('reports')" class="nav-btn w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all text-slate-400 hover:bg-slate-800 hover:text-white group" data-target="reports"> | |
| <i class="ph-duotone ph-chart-pie-slice text-lg group-hover:text-pharmacy-400 transition-colors"></i> | |
| <span>التقارير والتحليلات</span> | |
| </button> | |
| <button onclick="app.navigate('settings')" class="nav-btn w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all text-slate-400 hover:bg-slate-800 hover:text-white group" data-target="settings"> | |
| <i class="ph-duotone ph-gear text-lg group-hover:text-pharmacy-400 transition-colors"></i> | |
| <span>الإعدادات والصيانة</span> | |
| </button> | |
| </nav> | |
| <!-- Footer --> | |
| <div class="p-4 border-t border-slate-800"> | |
| <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="block text-center text-xs text-slate-500 hover:text-pharmacy-400 transition-colors"> | |
| Built with anycoder | |
| </a> | |
| </div> | |
| </aside> | |
| <!-- Main Content --> | |
| <main class="flex-1 flex flex-col h-full overflow-hidden relative bg-slate-950"> | |
| <!-- Header --> | |
| <header class="h-20 border-b border-slate-800 bg-slate-900/50 backdrop-blur flex items-center justify-between px-8 z-10"> | |
| <h2 id="page-title" class="text-2xl font-bold text-white">لوحة التحكم</h2> | |
| <div class="flex items-center gap-4"> | |
| <div class="text-left hidden md:block"> | |
| <p class="text-xs text-slate-400">تاريخ اليوم</p> | |
| <p class="text-sm font-semibold text-slate-200" id="current-date">...</p> | |
| </div> | |
| <button onclick="app.toggleNotifications()" class="w-10 h-10 rounded-full bg-slate-800 hover:bg-slate-700 flex items-center justify-center text-slate-400 transition-colors relative"> | |
| <i class="ph-duotone ph-bell text-xl"></i> | |
| <span class="absolute top-2 right-2 w-2 h-2 bg-red-500 rounded-full animate-pulse"></span> | |
| </button> | |
| <button onclick="app.toggleSidebar()" class="md:hidden w-10 h-10 rounded-full bg-slate-800 flex items-center justify-center"> | |
| <i class="ph ph-list text-xl"></i> | |
| </button> | |
| </div> | |
| </header> | |
| <!-- Dynamic Content Area --> | |
| <div id="content-area" class="flex-1 overflow-y-auto p-8 relative"> | |
| <!-- Content injected via JS --> | |
| </div> | |
| <!-- Toast Container --> | |
| <div id="toast-container" class="absolute bottom-6 left-6 flex flex-col gap-3 pointer-events-none z-50"></div> | |
| </main> | |
| </div> | |
| <!-- MODALS --> | |
| <!-- Backdrop --> | |
| <div id="modal-backdrop" class="fixed inset-0 bg-black/80 backdrop-blur-sm z-40 hidden transition-opacity opacity-0" onclick="app.closeModal()"></div> | |
| <!-- Add/Edit Product Modal --> | |
| <div id="modal-product" class="fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-2xl z-50 hidden transition-all scale-95 opacity-0"> | |
| <div class="bg-slate-900 border border-slate-700 rounded-2xl shadow-2xl overflow-hidden"> | |
| <div class="px-6 py-4 border-b border-slate-800 flex justify-between items-center bg-slate-800/50"> | |
| <h3 class="text-lg font-bold text-white" id="product-modal-title">إضافة صنف جديد</h3> | |
| <button onclick="app.closeModal()" class="text-slate-400 hover:text-white"><i class="ph ph-x text-xl"></i></button> | |
| </div> | |
| <div class="p-6 grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div class="md:col-span-2"> | |
| <label class="block text-xs font-medium text-slate-400 mb-1">اسم الصنف</label> | |
| <input type="text" id="prod-name" class="glass-input w-full px-4 py-2 rounded-lg" placeholder="مثال: بانادول أزرق"> | |
| </div> | |
| <div> | |
| <label class="block text-xs font-medium text-slate-400 mb-1">الباركود</label> | |
| <input type="text" id="prod-barcode" class="glass-input w-full px-4 py-2 rounded-lg" placeholder="-scan or type-"> | |
| </div> | |
| <div> | |
| <label class="block text-xs font-medium text-slate-400 mb-1">التصنيف</label> | |
| <select id="prod-cat" class="glass-input w-full px-4 py-2 rounded-lg"> | |
| <option value="أقراص">أقراص</option> | |
| <option value="شراب">شراب</option> | |
| <option value="حقن">حقن</option> | |
| <option value="مستحضرات">مستحضرات تجميل</option> | |
| <option value="مستلزمات">مستلزمات طبية</option> | |
| </select> | |
| </div> | |
| <div class="bg-slate-800/50 p-3 rounded-lg border border-slate-700"> | |
| <h4 class="text-sm font-bold text-pharmacy-400 mb-2 flex items-center gap-2"><i class="ph-fill ph-cube"></i> الوحدة الكبيرة</h4> | |
| <div class="grid grid-cols-2 gap-2"> | |
| <div> | |
| <label class="text-xs text-slate-500">السعر</label> | |
| <input type="number" id="prod-price-box" class="glass-input w-full px-3 py-1 rounded text-sm" placeholder="0.00"> | |
| </div> | |
| <div> | |
| <label class="text-xs text-slate-500">الكمية</label> | |
| <input type="number" id="prod-qty-box" class="glass-input w-full px-3 py-1 rounded text-sm" placeholder="0"> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-slate-800/50 p-3 rounded-lg border border-slate-700"> | |
| <h4 class="text-sm font-bold text-blue-400 mb-2 flex items-center gap-2"><i class="ph-fill ph-cube-transparent"></i> الوحدة الصغيرة (الجزء)</h4> | |
| <div class="grid grid-cols-2 gap-2"> | |
| <div> | |
| <label class="text-xs text-slate-500">السعر</label> | |
| <input type="number" id="prod-price-unit" class="glass-input w-full px-3 py-1 rounded text-sm" placeholder="0.00"> | |
| </div> | |
| <div> | |
| <label class="text-xs text-slate-500">الكمية</label> | |
| <input type="number" id="prod-qty-unit" class="glass-input w-full px-3 py-1 rounded text-sm" placeholder="0"> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="md:col-span-2 flex justify-end gap-3 mt-2"> | |
| <button onclick="app.closeModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800 transition-colors">إلغاء</button> | |
| <button onclick="app.saveProduct()" class="px-6 py-2 rounded-lg bg-pharmacy-600 hover:bg-pharmacy-500 text-white font-bold shadow-lg shadow-pharmacy-900/50 transition-all hover:scale-105">حفظ الصنف</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Add/Edit Customer Modal --> | |
| <div id="modal-customer" class="fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-lg z-50 hidden transition-all scale-95 opacity-0"> | |
| <div class="bg-slate-900 border border-slate-700 rounded-2xl shadow-2xl p-6"> | |
| <h3 class="text-lg font-bold text-white mb-4" id="cust-modal-title">عميل جديد</h3> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="block text-xs text-slate-400 mb-1">الاسم</label> | |
| <input type="text" id="cust-name" class="glass-input w-full px-4 py-2 rounded-lg"> | |
| </div> | |
| <div> | |
| <label class="block text-xs text-slate-400 mb-1">الهاتف</label> | |
| <input type="text" id="cust-phone" class="glass-input w-full px-4 py-2 rounded-lg"> | |
| </div> | |
| <div> | |
| <label class="block text-xs text-slate-400 mb-1">الحد الائتماني (الآجل)</label> | |
| <input type="number" id="cust-limit" class="glass-input w-full px-4 py-2 rounded-lg" value="1000"> | |
| </div> | |
| <div class="flex justify-end gap-3 pt-2"> | |
| <button onclick="app.closeModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">إلغاء</button> | |
| <button onclick="app.saveCustomer()" class="px-6 py-2 rounded-lg bg-pharmacy-600 hover:bg-pharmacy-500 text-white font-bold shadow-lg shadow-pharmacy-900/50">حفظ</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Quick Sale Search Modal --> | |
| <div id="modal-search" class="fixed top-24 left-1/2 -translate-x-1/2 w-full max-w-2xl z-50 hidden transition-all scale-95 opacity-0"> | |
| <div class="bg-slate-900 border border-slate-700 rounded-2xl shadow-2xl overflow-hidden"> | |
| <div class="p-4 border-b border-slate-800"> | |
| <input type="text" id="global-search-input" class="w-full bg-transparent text-xl text-white placeholder-slate-500 outline-none font-bold" placeholder="ابحث باسم الصنف أو الباركود..." oninput="app.handleGlobalSearch(this.value)"> | |
| </div> | |
| <div id="search-results" class="max-h-96 overflow-y-auto p-2 space-y-1"> | |
| <!-- Results injected here --> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- TEMPLATES (Hidden) --> | |
| <template id="tmpl-dashboard"> | |
| <div class="space-y-6 animate-fade-in"> | |
| <!-- KPI Grid --> | |
| <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6"> | |
| <!-- Sales Today --> | |
| <div class="glass-panel rounded-2xl p-5 relative overflow-hidden group"> | |
| <div class="absolute top-0 left-0 w-1 h-full bg-pharmacy-500"></div> | |
| <div class="flex justify-between items-start mb-4"> | |
| <div> | |
| <p class="text-slate-400 text-sm">مبيعات اليوم</p> | |
| <h3 class="text-2xl font-bold text-white mt-1">{{salesToday}} ج.م</h3> | |
| </div> | |
| <div class="w-10 h-10 rounded-lg bg-pharmacy-500/20 text-pharmacy-400 flex items-center justify-center"> | |
| <i class="ph-duotone ph-currency-egp text-xl"></i> | |
| </div> | |
| </div> | |
| <div class="w-full bg-slate-800 h-1 rounded-full overflow-hidden"> | |
| <div class="bg-pharmacy-500 h-full rounded-full" style="width: 75%"></div> | |
| </div> | |
| </div> | |
| <!-- Low Stock --> | |
| <div class="glass-panel rounded-2xl p-5 relative overflow-hidden"> | |
| <div class="absolute top-0 left-0 w-1 h-full bg-orange-500"></div> | |
| <div class="flex justify-between items-start mb-4"> | |
| <div> | |
| <p class="text-slate-400 text-sm">نواقص المخزون</p> | |
| <h3 class="text-2xl font-bold text-white mt-1">{{lowStockCount}}</h3> | |
| </div> | |
| <div class="w-10 h-10 rounded-lg bg-orange-500/20 text-orange-400 flex items-center justify-center"> | |
| <i class="ph-duotone ph-warning text-xl"></i> | |
| </div> | |
| </div> | |
| <button onclick="app.navigate('products')" class="text-xs text-orange-400 hover:text-orange-300 flex items-center gap-1">عرض النواقص <i class="ph-bold ph-arrow-left"></i></button> | |
| </div> | |
| <!-- Credit Balance --> | |
| <div class="glass-panel rounded-2xl p-5 relative overflow-hidden"> | |
| <div class="absolute top-0 left-0 w-1 h-full bg-blue-500"></div> | |
| <div class="flex justify-between items-start mb-4"> | |
| <div> | |
| <p class="text-slate-400 text-sm">إجمالي المديونيات</p> | |
| <h3 class="text-2xl font-bold text-white mt-1">{{totalCredit}} ج.م</h3> | |
| </div> | |
| <div class="w-10 h-10 rounded-lg bg-blue-500/20 text-blue-400 flex items-center justify-center"> | |
| <i class="ph-duotone ph-receipt text-xl"></i> | |
| </div> | |
| </div> | |
| <p class="text-xs text-slate-500">من {{creditCount}} عميل</p> | |
| </div> | |
| <!-- Total Items --> | |
| <div class="glass-panel rounded-2xl p-5 relative overflow-hidden"> | |
| <div class="absolute top-0 left-0 w-1 h-full bg-purple-500"></div> | |
| <div class="flex justify-between items-start mb-4"> | |
| <div> | |
| <p class="text-slate-400 text-sm">إجمالي الأصناف</p> | |
| <h3 class="text-2xl font-bold text-white mt-1">{{totalItems}}</h3> | |
| </div> | |
| <div class="w-10 h-10 rounded-lg bg-purple-500/20 text-purple-400 flex items-center justify-center"> | |
| <i class="ph-duotone ph-pill text-xl"></i> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Charts & Lists --> | |
| <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> | |
| <!-- Chart: Sales Trend --> | |
| <div class="glass-panel rounded-2xl p-6 lg:col-span-2"> | |
| <h3 class="text-lg font-bold text-white mb-6 flex items-center gap-2"> | |
| <i class="ph-duotone ph-chart-line-up text-pharmacy-400"></i> حركة المبيعات الأسبوعية | |
| </h3> | |
| <div class="h-64 w-full flex items-end justify-between gap-2 px-2" id="dashboard-chart"> | |
| <!-- Simple CSS Bar Chart injected via JS --> | |
| </div> | |
| </div> | |
| <!-- Recent Activity --> | |
| <div class="glass-panel rounded-2xl p-6"> | |
| <h3 class="text-lg font-bold text-white mb-4">آخر العمليات</h3> | |
| <div class="space-y-4 overflow-y-auto max-h-64 custom-scrollbar pr-2"> | |
| {{#recentActivity}} | |
| <div class="flex items-center gap-3 pb-3 border-b border-slate-800 last:border-0"> | |
| <div class="w-8 h-8 rounded-full bg-slate-800 flex items-center justify-center text-xs text-slate-400"> | |
| {{icon}} | |
| </div> | |
| <div class="flex-1"> | |
| <p class="text-sm font-medium text-slate-200">{{desc}}</p> | |
| <p class="text-xs text-slate-500">{{time}}</p> | |
| </div> | |
| <span class="text-xs font-bold {{color}}">{{amount}}</span> | |
| </div> | |
| {{/recentActivity}} | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </template> | |
| <template id="tmpl-products"> | |
| <div class="space-y-6 animate-fade-in h-full flex flex-col"> | |
| <!-- Toolbar --> | |
| <div class="flex flex-col md:flex-row justify-between gap-4"> | |
| <div class="relative flex-1"> | |
| <i class="ph ph-magnifying-glass absolute right-4 top-1/2 -translate-y-1/2 text-slate-400"></i> | |
| <input type="text" id="product-search" class="glass-input w-full pr-12 pl-4 py-3 rounded-xl" placeholder="بحث جوجلي في الأصناف..." oninput="app.filterProducts(this.value)"> | |
| </div> | |
| <div class="flex gap-3"> | |
| <button onclick="app.openProductModal()" class="bg-pharmacy-600 hover:bg-pharmacy-500 text-white px-6 py-3 rounded-xl font-bold flex items-center gap-2 transition-all shadow-lg shadow-pharmacy-900/50 hover:scale-105"> | |
| <i class="ph-bold ph-plus"></i> إضافة صنف | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Table --> | |
| <div class="glass-panel rounded-2xl flex-1 overflow-hidden flex flex-col"> | |
| <div class="overflow-x-auto flex-1"> | |
| <table class="w-full text-right border-collapse"> | |
| <thead class="bg-slate-900 text-slate-400 text-xs uppercase font-bold sticky top-0 z-10 shadow-md"> | |
| <tr> | |
| <th class="px-6 py-4">الصنف</th> | |
| <th class="px-6 py-4">الباركود</th> | |
| <th class="px-6 py-4 text-center">وحدة كبيرة (س/ك)</th> | |
| <th class="px-6 py-4 text-center">وحدة صغيرة (س/ك)</th> | |
| <th class="px-6 py-4 text-center">الإجمالي</th> | |
| <th class="px-6 py-4 text-left">إجراء</th> | |
| </tr> | |
| </thead> | |
| <tbody id="products-tbody" class="divide-y divide-slate-800 text-sm"> | |
| <!-- Rows --> | |
| </tbody> | |
| </table> | |
| </div> | |
| <div class="p-4 border-t border-slate-800 bg-slate-900/50 flex justify-between items-center text-xs text-slate-500"> | |
| <span id="prod-count-display">0 صنف</span> | |
| <div class="flex gap-2"> | |
| <button class="hover:text-white px-2"><i class="ph-bold ph-caret-right"></i></button> | |
| <button class="hover:text-white px-2"><i class="ph-bold ph-caret-left"></i></button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </template> | |
| <template id="tmpl-sales"> | |
| <div class="h-full flex flex-col md:flex-row gap-6 animate-fade-in"> | |
| <!-- Cart Section --> | |
| <div class="flex-1 glass-panel rounded-2xl flex flex-col h-full overflow-hidden"> | |
| <div class="p-6 border-b border-slate-800 flex justify-between items-center bg-slate-900/50"> | |
| <h3 class="font-bold text-lg text-white">فاتورة البيع</h3> | |
| <button onclick="app.openSearchModal()" class="md:hidden bg-slate-800 p-2 rounded-lg text-pharmacy-400"><i class="ph-bold ph-plus"></i></button> | |
| </div> | |
| <div class="flex-1 overflow-y-auto p-0 custom-scrollbar"> | |
| <table class="w-full text-right"> | |
| <thead class="bg-slate-800/50 text-slate-400 text-xs sticky top-0"> | |
| <tr> | |
| <th class="px-4 py-3">الصنف</th> | |
| <th class="px-4 py-3 text-center">النوع</th> | |
| <th class="px-4 py-3 text-center">الكمية</th> | |
| <th class="px-4 py-3 text-center">السعر</th> | |
| <th class="px-4 py-3 text-center">الإجمالي</th> | |
| <th class="px-4 py-3"></th> | |
| </tr> | |
| </thead> | |
| <tbody id="cart-items" class="divide-y divide-slate-800"> | |
| <!-- Cart items --> | |
| </tbody> | |
| </table> | |
| <div id="empty-cart-msg" class="h-full flex flex-col items-center justify-center text-slate-600 gap-4"> | |
| <i class="ph-duotone ph-shopping-cart text-6xl opacity-20"></i> | |
| <p>السلة فارغة</p> | |
| <p class="text-xs">اضغط Ctrl+Space للبحث السريع</p> | |
| </div> | |
| </div> | |
| <!-- Totals --> | |
| <div class="p-6 bg-slate-900 border-t border-slate-800 space-y-3"> | |
| <div class="flex justify-between text-slate-400 text-sm"> | |
| <span>المجموع:</span> | |
| <span id="cart-subtotal">0.00 ج.م</span> | |
| </div> | |
| <div class="flex justify-between text-white text-xl font-bold"> | |
| <span>الإجمالي النهائي:</span> | |
| <span id="cart-total">0.00 ج.م</span> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Sidebar Actions --> | |
| <div class="w-full md:w-80 flex flex-col gap-4"> | |
| <!-- Customer Select --> | |
| <div class="glass-panel rounded-2xl p-4"> | |
| <label class="block text-xs text-slate-400 mb-2">العميل (اختياري للآجل)</label> | |
| <select id="sale-customer" class="glass-input w-full px-3 py-2 rounded-lg text-sm mb-2"> | |
| <option value="">عميل نقدي</option> | |
| <!-- Customers loaded here --> | |
| </select> | |
| <div class="text-xs text-slate-500 flex justify-between"> | |
| <span>الحد الائتماني:</span> | |
| <span id="cust-credit-limit" class="text-pharmacy-400">--</span> | |
| </div> | |
| </div> | |
| <!-- Shortcuts --> | |
| <div class="glass-panel rounded-2xl p-6 flex-1 flex flex-col justify-center gap-4"> | |
| <button onclick="app.openSearchModal()" class="w-full py-4 bg-slate-800 hover:bg-slate-700 rounded-xl flex items-center justify-center gap-2 text-slate-200 transition-colors border border-dashed border-slate-600"> | |
| <i class="ph-bold ph-magnifying-glass"></i> إضافة صنف (Ctrl+Space) | |
| </button> | |
| <button onclick="app.processSale('cash')" class="w-full py-4 bg-pharmacy-600 hover:bg-pharmacy-500 rounded-xl font-bold text-white shadow-lg shadow-pharmacy-900/50 transition-all hover:scale-[1.02] flex items-center justify-center gap-2"> | |
| <i class="ph-bold ph-check"></i> اتمام البيع (نقدي) | |
| </button> | |
| <button onclick="app.processSale('credit')" class="w-full py-3 bg-blue-600/20 hover:bg-blue-600/30 text-blue-400 rounded-xl font-bold border border-blue-500/30 transition-all hover:scale-[1.02] flex items-center justify-center gap-2"> | |
| <i class="ph-bold ph-timer"></i> حفظ كآجل | |
| </button> | |
| <button onclick="app.clearCart()" class="w-full py-2 text-red-400 hover:bg-red-400/10 rounded-xl transition-colors text-sm"> | |
| إلغاء الفاتورة | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </template> | |
| <script> | |
| /* -------------------------------------------------------------------------- */ | |
| /* STATE & DATA */ | |
| /* -------------------------------------------------------------------------- */ | |
| const state = { | |
| currentPage: 'dashboard', | |
| products: [], | |
| customers: [], | |
| sales: [], | |
| cart: [], | |
| editingId: null, | |
| settings: { | |
| pharmacyName: "صيدلية الدكتور", | |
| address: "شارع الجمهورية، القاهرة", | |
| phone: "02-12345678" | |
| } | |
| }; | |
| // Mock Data Generator | |
| const seedData = () => { | |
| const products = [ | |
| { id: 1, name: "بانادول أزرق", barcode: "622100019", category: "أقراص", priceBox: 24, qtyBox: 5, priceUnit: 2, qtyUnit: 100 }, | |
| { id: 2, name: "كومتريكس", barcode: "622105432", category: "أقراص", priceBox: 30, qtyBox: 2, priceUnit: 3, qtyUnit: 40 }, | |
| { id: 3, name: "أموكسيل شراب", barcode: "622112345", category: "شراب", priceBox: 45, qtyBox: 10, priceUnit: 45, qtyUnit: 0 }, // No unit | |
| { id: 4, name: "فولتارين جيل", barcode: "622198765", category: "مستحضرات", priceBox: 55, qtyBox: 0, priceUnit: 55, qtyUnit: 15 }, | |
| { id: 5, name: "سيتال", barcode: "622111222", category: "أقراص", priceBox: 18, qtyBox: 20, priceUnit: 1.5, qtyUnit: 200 }, | |
| { id: 6, name: "بنادول نايت", barcode: "622133444", category: "أقراص", priceBox: 35, qtyBox: 8, priceUnit: 3.5, qtyUnit: 80 }, | |
| { id: 7, name: "أوجمنتين 1جم", barcode: "622155666", category: "أقراص", priceBox: 85, qtyBox: 12, priceUnit: 8.5, qtyUnit: 120 }, | |
| { id: 8, name: "ناسيف مسحوق", barcode: "622177888", category: "مستحضرات", priceBox: 15, qtyBox: 50, priceUnit: 15, qtyUnit: 0 }, | |
| { id: 9, name: "جافيسكون", barcode: "622199000", category: "شراب", priceBox: 60, qtyBox: 5, priceUnit: 60, qtyUnit: 0 }, | |
| { id: 10, name: "ديكساميثازون", barcode: "622100111", category: "حقن", priceBox: 12, qtyBox: 0, priceUnit: 12, qtyUnit: 30 }, | |
| ]; | |
| const customers = [ | |
| { id: 1, name: "أحمد محمد", phone: "01001234567", limit: 5000, balance: 1250 }, | |
| { id: 2, name: "فاطمة علي", phone: "01109876543", limit: 2000, balance: 0 }, | |
| { id: 3, name: "الدكتور خالد", phone: "01223456789", limit: 10000, balance: 4500 }, | |
| { id: 4, name: "صيدلية النور", phone: "02-3334444", limit: 15000, balance: 8200 }, | |
| ]; | |
| const sales = [ | |
| { id: 101, date: new Date().toISOString(), total: 125, type: 'cash' }, | |
| { id: 102, date: new Date().toISOString(), total: 340, type: 'credit', customerId: 1 }, | |
| { id: 103, date: new Date(Date.now() - 86400000).toISOString(), total: 55, type: 'cash' }, | |
| ]; | |
| state.products = products; | |
| state.customers = customers; | |
| state.sales = sales; | |
| }; | |
| /* -------------------------------------------------------------------------- */ | |
| /* CORE APP */ | |
| /* -------------------------------------------------------------------------- */ | |
| const app = { | |
| init: () => { | |
| seedData(); | |
| app.updateDate(); | |
| app.navigate('dashboard'); | |
| app.setupShortcuts(); | |
| setInterval(app.updateDate, 60000); | |
| }, | |
| updateDate: () => { | |
| const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute:'2-digit' }; | |
| document.getElementById('current-date').innerText = new Date().toLocaleDateString('ar-EG', options); | |
| }, | |
| navigate: (page) => { | |
| state.currentPage = page; | |
| const container = document.getElementById('content-area'); | |
| const title = document.getElementById('page-title'); | |
| // Update Sidebar Active State | |
| document.querySelectorAll('.nav-btn').forEach(btn => { | |
| if(btn.dataset.target === page) { | |
| btn.classList.remove('text-slate-400', 'hover:bg-slate-800'); | |
| btn.classList.add('bg-pharmacy-600', 'text-white', 'shadow-lg', 'shadow-pharmacy-900/50'); | |
| } else { | |
| btn.classList.add('text-slate-400', 'hover:bg-slate-800'); | |
| btn.classList.remove('bg-pharmacy-600', 'text-white', 'shadow-lg', 'shadow-pharmacy-900/50'); | |
| } | |
| }); | |
| // Render Content | |
| container.innerHTML = ''; | |
| switch(page) { | |
| case 'dashboard': app.renderDashboard(container); break; | |
| case 'products': app.renderProducts(container); break; | |
| case 'sales': app.renderSales(container); break; | |
| case 'customers': app.renderCustomers(container); break; | |
| case 'settings': app.renderSettings(container); break; | |
| default: app.renderDashboard(container); | |
| } | |
| // Update Title | |
| const titles = { | |
| 'dashboard': 'لوحة التحكم الرئيسية', | |
| 'products': 'إدارة الأصناف', | |
| 'sales': 'نقطة البيع (POS)', | |
| 'customers': 'العملاء', | |
| 'settings': 'الإعدادات' | |
| }; | |
| title.innerText = titles[page] || 'فارما برو'; | |
| }, | |
| /* ---------------------------------------------------------------------- */ | |
| /* RENDERERS */ | |
| /* ---------------------------------------------------------------------- */ | |
| renderDashboard: (container) => { | |
| // Calculate Stats | |
| const todaySales = state.sales | |
| .filter(s => new Date(s.date).toDateString() === new Date().toDateString()) | |
| .reduce((acc, s) => acc + s.total, 0); | |
| const lowStock = state.products.filter(p => p.qtyBox < 5 && p.qtyUnit < 20).length; | |
| const totalCredit = state.customers.reduce((acc, c) => acc + c.balance, 0); | |
| // Simple Template Engine (replace {{key}} with value) | |
| let html = document.getElementById('tmpl-dashboard').innerHTML; | |
| // Stats | |
| html = html.replace('{{salesToday}}', todaySales); | |
| html = html.replace('{{lowStockCount}}', lowStock); | |
| html = html.replace('{{totalCredit}}', totalCredit); | |
| html = html.replace('{{creditCount}}', state.customers.filter(c => c.balance > 0).length); | |
| html = html.replace('{{totalItems}} |