🤩 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 // admin/index.php require_once '../includes/db.php'; require_once '../includes/functions.php'; // Fetch Widget Counts try { $total_orders = $pdo->query("SELECT COUNT(*) FROM orders")->fetchColumn(); $pending_orders = $pdo->query("SELECT COUNT(*) FROM orders WHERE status = 'Pending'")->fetchColumn(); $processing_orders = $pdo->query("SELECT COUNT(*) FROM orders WHERE status = 'Processing'")->fetchColumn(); $completed_orders = $pdo->query("SELECT COUNT(*) FROM orders WHERE status = 'Completed'")->fetchColumn(); // Today's orders $today_orders = $pdo->query("SELECT COUNT(*) FROM orders WHERE DATE(created_at) = CURDATE()")->fetchColumn(); // Monthly orders $monthly_orders = $pdo->query("SELECT COUNT(*) FROM orders WHERE MONTH(created_at) = MONTH(CURDATE()) AND YEAR(created_at) = YEAR(CURDATE())")->fetchColumn(); // Fetch 5 most recent orders $recent_stmt = $pdo->prepare("SELECT * FROM orders ORDER BY created_at DESC LIMIT 5"); $recent_stmt->execute(); $recent_orders = $recent_stmt->fetchAll(); } catch (PDOException $e) { die("Error retrieving dashboard statistics: " . $e->getMessage()); } include '../includes/admin_header.php'; ?> <!-- Widgets Grid --> <div class="row g-3 mb-5"> <!-- Total Orders --> <div class="col-md-4 col-sm-6"> <div class="widget-card"> <div> <div class="widget-title">Total Orders</div> <div class="widget-value"><?php echo $total_orders; ?></div> </div> <div class="widget-icon bg-primary text-white"> <i class="fas fa-shopping-bag"></i> </div> </div> </div> <!-- Pending Orders --> <div class="col-md-4 col-sm-6"> <div class="widget-card"> <div> <div class="widget-title">Pending Orders</div> <div class="widget-value"><?php echo $pending_orders; ?></div> </div> <div class="widget-icon bg-warning text-dark"> <i class="fas fa-clock"></i> </div> </div> </div> <!-- Processing Orders --> <div class="col-md-4 col-sm-6"> <div class="widget-card"> <div> <div class="widget-title">Processing Orders</div> <div class="widget-value"><?php echo $processing_orders; ?></div> </div> <div class="widget-icon bg-primary text-white" style="background-color: var(--royal-blue-light) !important;"> <i class="fas fa-spinner fa-spin"></i> </div> </div> </div> <!-- Completed Orders --> <div class="col-md-4 col-sm-6"> <div class="widget-card"> <div> <div class="widget-title">Completed Orders</div> <div class="widget-value"><?php echo $completed_orders; ?></div> </div> <div class="widget-icon bg-success text-white"> <i class="fas fa-check-circle"></i> </div> </div> </div> <!-- Today's Orders --> <div class="col-md-4 col-sm-6"> <div class="widget-card"> <div> <div class="widget-title">Today's Orders</div> <div class="widget-value"><?php echo $today_orders; ?></div> </div> <div class="widget-icon bg-info text-dark"> <i class="fas fa-calendar-day"></i> </div> </div> </div> <!-- Monthly Orders --> <div class="col-md-4 col-sm-6"> <div class="widget-card"> <div> <div class="widget-title">Monthly Orders</div> <div class="widget-value"><?php echo $monthly_orders; ?></div> </div> <div class="widget-icon bg-secondary text-white"> <i class="fas fa-calendar-alt"></i> </div> </div> </div> </div> <!-- Recent Orders Section --> <div class="card premium-card"> <div class="card-header-royal d-flex justify-content-between align-items-center py-3"> <h5 class="mb-0"><i class="fas fa-list-ul me-2"></i>Recent Orders</h5> <a href="orders.php" class="btn btn-gold btn-sm py-1 px-3 text-uppercase">View All Orders</a> </div> <div class="card-body p-0"> <div class="table-responsive"> <table class="table table-hover align-middle mb-0"> <thead class="table-light"> <tr> <th class="ps-4">Order No</th> <th>Customer</th> <th>Curtain Specs</th> <th>Dimensions</th> <th>Order Date</th> <th>Status</th> <th class="text-end pe-4">Actions</th> </tr> </thead> <tbody> <?php if (empty($recent_orders)): ?> <tr> <td colspan="7" class="text-center py-5 text-muted"> <i class="fas fa-inbox fa-3x mb-3 d-block text-secondary"></i> No orders received yet. </td> </tr> <?php else: ?> <?php foreach ($recent_orders as $order): ?> <tr> <td class="ps-4 fw-bold font-monospace text-royal"> <a href="order_detail.php?id=<?php echo $order['id']; ?>" class="text-decoration-none"> <?php echo s($order['order_no']); ?> </a> </td> <td> <div class="fw-semibold"><?php echo s($order['customer_name']); ?></div> <div class="small text-muted"><?php echo s($order['phone']); ?></div> </td> <td> <div class="small"> <strong>Type:</strong> <?php echo s($order['curtain_type']); ?><br> <strong>Fabric:</strong> <?php echo s($order['fabric']); ?> </div> </td> <td> <span class="small font-monospace"> <?php echo s($order['width']); ?>"W × <?php echo s($order['height']); ?>"H </span> <div class="small text-muted">Qty: <?php echo (int)$order['quantity']; ?></div> </td> <td> <div class="small"><?php echo date('M d, Y', strtotime($order['created_at'])); ?></div> <div class="small text-muted"><?php echo date('h:i A', strtotime($order['created_at'])); ?></div> </td> <td> <?php echo render_status_badge($order['status']); ?> </td> <td class="text-end pe-4"> <div class="btn-group"> <a href="order_detail.php?id=<?php echo $order['id']; ?>" class="btn btn-outline-primary btn-sm" title="View details"> <i class="fas fa-eye"></i> </a> <a href="order_edit.php?id=<?php echo $order['id']; ?>" class="btn btn-outline-secondary btn-sm" title="Edit order"> <i class="fas fa-edit"></i> </a> <button type="button" class="btn btn-outline-danger btn-sm btn-delete-order" data-id="<?php echo $order['id']; ?>" data-order-no="<?php echo s($order['order_no']); ?>" title="Delete order"> <i class="fas fa-trash-alt"></i> </button> </div> </td> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table> </div> </div> </div> <?php include '../includes/admin_footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder