Devco1
Home
Console
Upload
New File
New Folder
Tools
Info
About
/
home
/
wifiyecu
/
www
/
admin
/
Filename :
index.php
back
Copy
<?php session_start(); include '../includes/config.php'; if (!isset($_SESSION['admin_logged_in'])) { header('Location: login.php'); exit; } // إحصائيات سريعة try { // عدد المنتجات $products_stmt = $pdo->query("SELECT COUNT(*) as count FROM products"); $products_count = $products_stmt->fetch()['count']; // عدد الطلبات $orders_stmt = $pdo->query("SELECT COUNT(*) as count FROM orders"); $orders_count = $orders_stmt->fetch()['count']; // إجمالي المبيعات $sales_stmt = $pdo->query("SELECT SUM(total_amount) as total FROM orders WHERE status = 'completed'"); $sales_total = $sales_stmt->fetch()['total'] ?: 0; // المنتجات قليلة المخزون $low_stock_stmt = $pdo->query("SELECT COUNT(*) as count FROM products WHERE stock_quantity > 0 AND stock_quantity <= 10"); $low_stock_count = $low_stock_stmt->fetch()['count']; } catch (PDOException $e) { die("خطأ في قاعدة البيانات: " . $e->getMessage()); } ?> <!DOCTYPE html> <html lang="ar" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>لوحة التحكم - الرئيسية</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> </head> <body> <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <div class="container"> <a class="navbar-brand" href="index.php"> <i class="fas fa-cog"></i> لوحة التحكم </a> <div class="navbar-nav ms-auto"> <a class="nav-link" href="products.php">المنتجات</a> <a class="nav-link" href="orders.php">الطلبات</a> <a class="nav-link" href="logout.php">تسجيل الخروج</a> </div> </div> </nav> <div class="container mt-4"> <h2 class="mb-4">مرحباً بك في لوحة التحكم</h2> <div class="row"> <div class="col-md-3 mb-4"> <div class="card text-white bg-primary"> <div class="card-body"> <div class="d-flex justify-content-between"> <div> <h4><?php echo $products_count; ?></h4> <span>المنتجات</span> </div> <i class="fas fa-mobile-alt fa-2x opacity-50"></i> </div> </div> </div> </div> <div class="col-md-3 mb-4"> <div class="card text-white bg-success"> <div class="card-body"> <div class="d-flex justify-content-between"> <div> <h4><?php echo $orders_count; ?></h4> <span>الطلبات</span> </div> <i class="fas fa-shopping-cart fa-2x opacity-50"></i> </div> </div> </div> </div> <div class="col-md-3 mb-4"> <div class="card text-white bg-warning"> <div class="card-body"> <div class="d-flex justify-content-between"> <div> <h4>$<?php echo number_format($sales_total, 2); ?></h4> <span>إجمالي المبيعات</span> </div> <i class="fas fa-chart-line fa-2x opacity-50"></i> </div> </div> </div> </div> <div class="col-md-3 mb-4"> <div class="card text-white bg-danger"> <div class="card-body"> <div class="d-flex justify-content-between"> <div> <h4><?php echo $low_stock_count; ?></h4> <span>منتجات قليلة المخزون</span> </div> <i class="fas fa-exclamation-triangle fa-2x opacity-50"></i> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="card"> <div class="card-header"> <h5 class="card-title mb-0">الإجراءات السريعة</h5> </div> <div class="card-body"> <div class="d-grid gap-2"> <a href="add_product.php" class="btn btn-primary"> <i class="fas fa-plus me-2"></i> إضافة منتج جديد </a> <a href="products.php" class="btn btn-outline-primary"> <i class="fas fa-list me-2"></i> عرض جميع المنتجات </a> <a href="orders.php" class="btn btn-outline-success"> <i class="fas fa-shopping-cart me-2"></i> إدارة الطلبات </a> </div> </div> </div> </div> </div> </div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> </body> </html>