🤩 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:orders.php
<?php include 'header.php'; // Handle Order Actions if(isset($_GET['approve'])) { $id = intval($_GET['approve']); $conn->query("UPDATE orders SET status = 'approved' WHERE id = $id"); echo "<script>window.location.href='orders.php';</script>"; } if(isset($_GET['delete'])) { $id = intval($_GET['delete']); $conn->query("DELETE FROM orders WHERE id = $id"); echo "<script>window.location.href='orders.php';</script>"; } $orders = $conn->query("SELECT * FROM orders ORDER BY id DESC"); ?> <div class="d-flex justify-content-between align-items-center mb-4"> <h2><i class="fa fa-shopping-cart me-2"></i> Manage Orders</h2> </div> <div class="card border-0 shadow-sm"> <div class="card-body p-0"> <div class="table-responsive"> <table class="table table-hover align-middle mb-0"> <thead class="bg-light"> <tr> <th class="ps-4">Order ID</th> <th>Customer Details</th> <th>Items</th> <th>Total</th> <th>Status</th> <th>Date</th> <th class="text-end pe-4">Actions</th> </tr> </thead> <tbody> <?php if($orders && $orders->num_rows > 0): ?> <?php while($o = $orders->fetch_assoc()): ?> <tr> <td class="ps-4 fw-bold">#<?php echo $o['id']; ?></td> <td> <div><strong><?php echo $o['customer_name']; ?></strong></div> <div class="small text-muted"><?php echo $o['customer_phone']; ?></div> <div class="small text-muted"><?php echo $o['customer_address']; ?></div> </td> <td> <div class="small" style="max-width: 300px; white-space: pre-wrap;"><?php echo $o['order_details']; ?></div> </td> <td class="fw-bold text-primary">Rs. <?php echo number_format($o['total_amount'], 2); ?></td> <td> <?php if($o['status'] == 'approved'): ?> <span class="badge bg-success-subtle text-success px-3 py-2">Approved</span> <?php else: ?> <span class="badge bg-warning-subtle text-warning px-3 py-2">Pending</span> <?php endif; ?> </td> <td class="small text-muted"><?php echo date('M d, Y h:i A', strtotime($o['created_at'])); ?></td> <td class="text-end pe-4"> <?php if($o['status'] == 'pending'): ?> <a href="orders.php?approve=<?php echo $o['id']; ?>" class="btn btn-sm btn-success me-2" onclick="return confirm('Approve this order?')"> <i class="fa fa-check me-1"></i> Approve </a> <?php endif; ?> <a href="orders.php?delete=<?php echo $o['id']; ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('Delete this order permanently?')"> <i class="fa fa-trash"></i> </a> </td> </tr> <?php endwhile; ?> <?php else: ?> <tr> <td colspan="7" class="text-center py-5 text-muted">No orders found yet.</td> </tr> <?php endif; ?> </tbody> </table> </div> </div> </div> <?php include 'footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder