🤩 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 require_once 'header.php'; // Handle Status Update if (isset($_POST['update_status'])) { $oid = (int)$_POST['order_id']; $status = db_escape($conn, $_POST['status']); db_query($conn, "UPDATE orders SET status = '$status' WHERE id = $oid"); } $orders = db_fetch_all($conn, "SELECT * FROM orders ORDER BY created_at DESC"); ?> <div class="admin-card bg-white p-4"> <div class="d-flex justify-content-between align-items-center mb-4"> <h4 class="fw-bold mb-0">Customer Orders</h4> </div> <div class="table-responsive"> <table class="table table-hover align-middle"> <thead class="table-light"> <tr> <th>Order Date</th> <th>Order No</th> <th>Customer Name</th> <th>Phone</th> <th>Price (Est)</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach($orders as $order): ?> <tr> <td class="small"><?= date('d M Y, h:i A', strtotime($order['created_at'])) ?></td> <td><strong><?= $order['order_no'] ?></strong></td> <td><?= e($order['full_name']) ?></td> <td><?= e($order['phone']) ?></td> <td><?= format_currency($order['estimated_price']) ?></td> <td> <form action="orders.php" method="POST" class="d-flex gap-2"> <input type="hidden" name="order_id" value="<?= $order['id'] ?>"> <select name="status" class="form-select form-select-sm" onchange="this.form.submit()"> <option value="Pending" <?= $order['status'] == 'Pending' ? 'selected' : '' ?>>Pending</option> <option value="Processing" <?= $order['status'] == 'Processing' ? 'selected' : '' ?>>Processing</option> <option value="Completed" <?= $order['status'] == 'Completed' ? 'selected' : '' ?>>Completed</option> <option value="Cancelled" <?= $order['status'] == 'Cancelled' ? 'selected' : '' ?>>Cancelled</option> </select> <input type="hidden" name="update_status" value="1"> </form> </td> <td> <button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#orderModal<?= $order['id'] ?>">Details</button> </td> </tr> <!-- Order Details Modal --> <div class="modal fade" id="orderModal<?= $order['id'] ?>" tabindex="-1"> <div class="modal-dialog modal-lg"> <div class="modal-content border-0 rounded-4"> <div class="modal-header border-0 bg-dark text-white rounded-top-4"> <h5 class="modal-title">Order Details: <?= $order['order_no'] ?></h5> <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button> </div> <div class="modal-body p-4"> <div class="row g-4"> <div class="col-md-6"> <h6>Customer Info</h6> <p class="mb-1"><strong>Name:</strong> <?= e($order['full_name']) ?></p> <p class="mb-1"><strong>Phone:</strong> <?= e($order['phone']) ?></p> <p class="mb-1"><strong>Email:</strong> <?= e($order['email']) ?></p> <p class="mb-1"><strong>Address:</strong> <?= e($order['address']) ?></p> </div> <div class="col-md-6 text-md-end"> <h6>Order Summary</h6> <h4 class="text-primary fw-bold"><?= format_currency($order['estimated_price']) ?></h4> <p class="mb-0">Status: <span class="badge bg-primary"><?= $order['status'] ?></span></p> </div> <hr> <div class="col-md-6"> <h6>Measurements</h6> <p class="mb-1">Width: <?= $order['width'] ?> ft</p> <p class="mb-1">Height: <?= $order['height'] ?> ft</p> <p class="mb-1">Depth: <?= $order['depth'] ?> ft</p> </div> <div class="col-md-6"> <h6>Preferences</h6> <p class="mb-1">Style: <?= e($order['cupboard_style']) ?></p> <p class="mb-1">Finish: <?= e($order['finish']) ?></p> <p class="mb-1">LED: <?= $order['led_lights'] ? 'Yes' : 'No' ?></p> </div> <div class="col-12"> <h6>Custom Notes</h6> <p class="text-muted"><?= nl2br(e($order['custom_notes'])) ?></p> </div> <div class="col-12"> <h6>Kitchen Images</h6> <div class="d-flex gap-3 mt-2"> <?php $imgs = json_decode($order['kitchen_images'] ?? '[]', true); foreach($imgs as $img): ?> <a href="../uploads/<?= $img ?>" target="_blank"> <img src="../uploads/<?= $img ?>" class="img-thumbnail" style="width: 100px; height: 100px; object-fit: cover;"> </a> <?php endforeach; ?> </div> </div> </div> </div> </div> </div> </div> <?php endforeach; ?> </tbody> </table> </div> </div> <?php require_once 'footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder