🤩 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:order_detail.php
<?php // admin/order_detail.php require_once '../includes/db.php'; require_once '../includes/functions.php'; $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; try { $stmt = $pdo->prepare("SELECT * FROM orders WHERE id = ?"); $stmt->execute([$id]); $order = $stmt->fetch(); if (!$order) { header("Location: orders.php"); exit; } // Generate WhatsApp Message & Links $whatsapp_message = generate_whatsapp_message($order); // Links to send the structured message $whatsapp_send_link = get_whatsapp_link($order['whatsapp'], $whatsapp_message); $whatsapp_web_send_link = get_whatsapp_web_link($order['whatsapp'], $whatsapp_message); // General links (chat only, no prefilled message) $whatsapp_general_link = get_whatsapp_link($order['whatsapp']); $whatsapp_web_general_link = get_whatsapp_web_link($order['whatsapp']); } catch (PDOException $e) { die("Database query error: " . $e->getMessage()); } include '../includes/admin_header.php'; ?> <div class="mb-4"> <a href="orders.php" class="btn btn-outline-secondary btn-sm px-3"> <i class="fas fa-arrow-left me-2"></i>Back to Orders </a> </div> <div class="row g-4"> <!-- LEFT COLUMN: Customer & Status Details --> <div class="col-lg-6"> <!-- Status & Timeline Card --> <div class="card premium-card mb-4 border-start border-warning border-4"> <div class="card-body p-4"> <div class="d-flex justify-content-between align-items-center mb-3"> <span class="text-uppercase text-muted small fw-bold">Order Number</span> <span class="fw-bold font-monospace bg-light border px-2 py-1 rounded text-royal"><?php echo s($order['order_no']); ?></span> </div> <div class="d-flex justify-content-between align-items-center mb-3"> <span class="text-uppercase text-muted small fw-bold">Current Status</span> <div><?php echo render_status_badge($order['status']); ?></div> </div> <div class="d-flex justify-content-between align-items-center"> <span class="text-uppercase text-muted small fw-bold">Change Status</span> <select class="form-select form-select-sm select-order-status" data-id="<?php echo $order['id']; ?>" style="max-width: 150px;"> <option value="Pending" <?php echo $order['status'] == 'Pending' ? 'selected' : ''; ?>>Pending</option> <option value="Confirmed" <?php echo $order['status'] == 'Confirmed' ? 'selected' : ''; ?>>Confirmed</option> <option value="Processing" <?php echo $order['status'] == 'Processing' ? 'selected' : ''; ?>>Processing</option> <option value="Completed" <?php echo $order['status'] == 'Completed' ? 'selected' : ''; ?>>Completed</option> <option value="Cancelled" <?php echo $order['status'] == 'Cancelled' ? 'selected' : ''; ?>>Cancelled</option> </select> </div> </div> </div> <!-- Customer Information Card --> <div class="card premium-card mb-4"> <div class="card-header bg-light py-3"> <h6 class="mb-0 text-royal fw-bold"><i class="fas fa-user-circle me-2"></i>Customer Information</h6> </div> <div class="card-body p-4"> <div class="table-responsive"> <table class="table table-sm table-borderless mb-0 align-middle"> <tbody> <tr> <td class="text-muted py-2" style="width: 35%;">Customer Name:</td> <td class="fw-semibold py-2"><?php echo s($order['customer_name']); ?></td> </tr> <tr> <td class="text-muted py-2">Mobile Number:</td> <td class="py-2"> <a href="tel:<?php echo s($order['phone']); ?>" class="text-decoration-none text-royal fw-semibold"> <i class="fas fa-phone-alt me-1 text-muted"></i><?php echo s($order['phone']); ?> </a> </td> </tr> <tr> <td class="text-muted py-2">WhatsApp Number:</td> <td class="py-2"> <a href="<?php echo $whatsapp_general_link; ?>" target="_blank" class="text-decoration-none text-success fw-semibold"> <i class="fa-brands fa-whatsapp me-1"></i><?php echo s($order['whatsapp']); ?> </a> </td> </tr> <tr> <td class="text-muted py-2">Email Address:</td> <td class="py-2"> <a href="mailto:<?php echo s($order['email']); ?>" class="text-decoration-none text-muted"> <i class="fas fa-envelope me-1"></i><?php echo s($order['email']); ?> </a> </td> </tr> <tr> <td class="text-muted py-2">Fitting/Delivery Address:</td> <td class="py-2 text-wrap" style="max-width: 250px;"><?php echo nl2br(s($order['address'])); ?></td> </tr> </tbody> </table> </div> </div> </div> <!-- Reference Image Card --> <div class="card premium-card"> <div class="card-header bg-light py-3"> <h6 class="mb-0 text-royal fw-bold"><i class="fas fa-image me-2"></i>Reference Image</h6> </div> <div class="card-body p-4 text-center"> <?php if (!empty($order['image']) && file_exists('../uploads/' . $order['image'])): ?> <div class="mb-3 border rounded p-1 bg-light inline-block overflow-hidden" style="max-height: 350px;"> <img src="../uploads/<?php echo s($order['image']); ?>" alt="Reference Curtain Image" class="img-fluid rounded" style="max-height: 340px; object-fit: contain;"> </div> <a href="../uploads/<?php echo s($order['image']); ?>" target="_blank" class="btn btn-outline-secondary btn-sm"> <i class="fas fa-search-plus me-1"></i>Open Full Image </a> <?php else: ?> <div class="py-4 text-muted"> <i class="far fa-image fa-3x mb-3 text-secondary d-block"></i> No reference image uploaded. </div> <?php endif; ?> </div> </div> </div> <!-- RIGHT COLUMN: Curtain Specs & WhatsApp Center --> <div class="col-lg-6"> <!-- Curtain Specifications Card --> <div class="card premium-card mb-4"> <div class="card-header bg-light py-3"> <h6 class="mb-0 text-royal fw-bold"><i class="fas fa-sliders-h me-2"></i>Curtain Specifications</h6> </div> <div class="card-body p-4"> <div class="row g-3 mb-3"> <div class="col-md-6 col-sm-6"> <span class="text-muted small d-block">Curtain Type</span> <span class="fw-semibold text-royal fs-6"><?php echo s($order['curtain_type']); ?></span> </div> <div class="col-md-6 col-sm-6"> <span class="text-muted small d-block">Fabric Selection</span> <span class="fw-semibold text-royal fs-6"><?php echo s($order['fabric']); ?></span> </div> <div class="col-md-6 col-sm-6"> <span class="text-muted small d-block">Fabric Color</span> <span class="fw-semibold text-royal fs-6"><?php echo s($order['color']); ?></span> </div> <div class="col-md-6 col-sm-6"> <span class="text-muted small d-block">Quantity Ordered</span> <span class="fw-semibold text-royal fs-6"><?php echo (int)$order['quantity']; ?> Unit(s)</span> </div> </div> <div class="border rounded p-3 bg-light mb-3"> <div class="row"> <div class="col-6 text-center border-end"> <span class="text-muted small d-block">Width</span> <span class="fw-bold fs-4 font-monospace text-royal"><?php echo s($order['width']); ?> <small class="fs-6">inches</small></span> </div> <div class="col-6 text-center"> <span class="text-muted small d-block">Height</span> <span class="fw-bold fs-4 font-monospace text-royal"><?php echo s($order['height']); ?> <small class="fs-6">inches</small></span> </div> </div> </div> <div class="mb-0"> <span class="text-muted small d-block mb-1">Additional Specifications / Special Notes</span> <div class="bg-light p-3 rounded text-muted small text-wrap" style="min-height: 80px;"> <?php echo !empty($order['notes']) ? nl2br(s($order['notes'])) : '<em>None</em>'; ?> </div> </div> </div> </div> <!-- WhatsApp Action Center --> <div class="card premium-card"> <div class="card-header bg-success text-white py-3"> <h6 class="mb-0 fw-bold"><i class="fa-brands fa-whatsapp me-2"></i>WhatsApp Communication Center</h6> </div> <div class="card-body p-4"> <!-- Action Buttons --> <div class="d-grid gap-2 mb-4"> <!-- Copy Button --> <button type="button" id="copyWaTextBtn" data-text="<?php echo s($whatsapp_message); ?>" class="btn btn-royal py-2 text-uppercase"> <i class="fa-regular fa-copy me-2"></i>Copy WhatsApp Message </button> <!-- Open WA app --> <a href="<?php echo $whatsapp_send_link; ?>" target="_blank" class="btn btn-whatsapp py-2 text-uppercase"> <i class="fa-brands fa-whatsapp fa-lg me-2"></i>Open WhatsApp (App/Mobile) </a> <!-- Open WA Web --> <a href="<?php echo $whatsapp_web_send_link; ?>" target="_blank" class="btn btn-success py-2 text-uppercase bg-gradient"> <i class="fa-solid fa-laptop-code me-2"></i>Send via WhatsApp Web </a> </div> <!-- Direct Links (No prefilled message) --> <div class="mb-4 pt-3 border-top"> <span class="text-muted small d-block mb-2 fw-semibold">Quick Action Links (Chat Only):</span> <div class="row g-2"> <div class="col-sm-6"> <a href="<?php echo $whatsapp_general_link; ?>" target="_blank" class="btn btn-outline-success btn-sm w-100 py-2"> <i class="fa-solid fa-mobile-screen me-2"></i>wa.me Link </a> </div> <div class="col-sm-6"> <a href="<?php echo $whatsapp_web_general_link; ?>" target="_blank" class="btn btn-outline-dark btn-sm w-100 py-2"> <i class="fa-solid fa-globe me-2"></i>web.whatsapp Link </a> </div> </div> </div> <!-- Preview Area --> <div class="mb-0"> <label class="form-label fw-bold text-royal small"><i class="fa-solid fa-message me-2"></i>Order Message Details</label> <textarea class="form-control bg-light font-monospace text-muted small" rows="10" readonly><?php echo s($whatsapp_message); ?></textarea> </div> </div> </div> </div> </div> <!-- Bottom Operations Panel --> <div class="card premium-card mt-4 mb-5 bg-light"> <div class="card-body d-flex justify-content-between align-items-center py-3"> <span class="text-muted small font-monospace">Created: <?php echo date('Y-m-d H:i:s', strtotime($order['created_at'])); ?> | Updated: <?php echo date('Y-m-d H:i:s', strtotime($order['updated_at'])); ?></span> <div> <a href="order_edit.php?id=<?php echo $order['id']; ?>" class="btn btn-sm btn-outline-secondary px-3 me-2"> <i class="fas fa-edit me-1"></i>Modify Order Details </a> <button type="button" class="btn btn-sm btn-danger px-3 btn-delete-order" data-id="<?php echo $order['id']; ?>" data-order-no="<?php echo s($order['order_no']); ?>" data-redirect="true"> <i class="fas fa-trash-alt me-1"></i>Delete Order Record </button> </div> </div> </div> <?php include '../includes/admin_footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder