hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
home
/
u313348419
/
domains
/
etsbay.com
/
public_html
/
admin
/
Upload FileeE
HOME
<!DOCTYPE html> <html lang="en"> <head> <?php include 'include/links.php';?> </head> <body> <!-- tap on top starts--> <div class="tap-top"><i data-feather="chevrons-up"></i></div> <!-- tap on tap ends--> <!-- page-wrapper Start--> <div class="page-wrapper compact-wrapper" id="pageWrapper"> <!-- Page Header Start--> <?php include 'include/topnav.php';?> <!-- Page Header Ends --> <!-- Page Body Start--> <div class="page-body-wrapper"> <!-- Page Sidebar Start--> <?php include 'include/sidenav.php';?> <!-- Page Sidebar Ends--> <div class="page-body"> <div class="container-fluid"> <div class="page-title"> <div class="row"> <div class="col-6 col-sm-6"> <h3>Orders Table</h3> </div> </div> </div> </div> <!-- Container-fluid starts--> <div class="container-fluid default-dash"> <div class="row"> <div class="col-sm-12"> <div class="card"> <div class="card-body"> <div class="table-responsive"> <table class="display" id="excel-cust-bolder"> <thead> <tr> <th>#</th> <th>Order Date</th> <th>Name </th> <th>Order No.</th> <!--<th>Mobile</th>--> <th>Quantity</th> <th>Order Total</th> <th>Order Status</th> <th>AWB No.</th> <th>payment Type</th> <th>Action</th> </tr> </thead> <tbody> <?php $sno = 1; $sql = "SELECT * FROM order_details ORDER BY id DESC"; $query = mysqli_query($conn, $sql); while ($row = mysqli_fetch_array($query)) { ?> <tr> <td><?= $sno++; ?></td> <td> <?php if (empty($row['order_date'])) { $date = $row['created_at']; $dateString = $date; $formattedDate = date('d/m/Y', strtotime($dateString)); echo $formattedDate; } else { $formattedDate = date('d/m/Y', strtotime($row['order_date'])); echo $formattedDate; } ?> </td> <td><?= $row['name']; ?></td> <td><?= $row['Unique_order_id']; ?></td> <!--<td><?= $row['mobile']; ?></td>--> <td> <?php $uniqid = $row['Unique_order_id']; // Replace with the actual uniqid value $sql = "SELECT SUM(quantity) AS total_quantity FROM cart WHERE uniqid = '$uniqid'"; $result_quen = $conn->query($sql); if ($result_quen) { $row_quen = $result_quen->fetch_assoc(); $totalQuantity = $row_quen['total_quantity']; if ($totalQuantity === NULL) { $totalQuantity = 0; } echo $totalQuantity; } else { echo "Error: " . $mysqli->error; } ?> </td> <td><?= $row['total_price']; ?></td> <td><?= $row['payment_type']; ?></td> <td><?= $row['awb_no']; ?></td> <td> <!-- Order Status Dropdown --> <select class="form-select order-status" data-order-id="<?= $row['id']; ?>" data-email-id="<?= $row['email']; ?>"> <option value="1" <?= $row['order_place'] == 1 ? 'selected' : ''; ?>>Order Placed</option> <option value="2" <?= $row['order_place'] == 2 ? 'selected' : ''; ?>>Order Packed</option> <option value="3" <?= $row['order_place'] == 3 ? 'selected' : ''; ?>>Order Dispatched</option> <option value="4" <?= $row['order_place'] == 4 ? 'selected' : ''; ?>>Order Delivered</option> </select> </td> <td> <a href="Order-review.php?id=<?= $row['id']; ?>&sessid=<?= $row['seasson_id']; ?>" class="btn btn-info btn-sm"><i class="fa fa-eye"></i></a> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <div class="modal fade" id="awbModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Update Order Dispatch Details</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <form id="awbForm"> <div class="mb-3"> <label for="awbNo" class="form-label">AWB Number</label> <input type="text" class="form-control" id="awbNo" name="awbNo" placeholder="Enter AWB Number" required> </div> <div class="mb-3"> <label for="courierName" class="form-label">Courier Name</label> <input type="text" class="form-control" id="courierName" name="courierName" placeholder="Enter Courier Name" required> </div> <input type="hidden" id="orderId" name="orderId" value=""> <input type="hidden" id="emailId" name="emailId" value=""> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="submit" form="awbForm" class="btn btn-primary">Save changes</button> </div> </div> </div> </div> <!-- Container-fluid Ends--> </div> <!-- footer start--> <?php include 'include/scripts.php';?> <script src="assets/js/jquery-3.5.1.min.js"></script> <!-- Bootstrap js--> <script src="assets/js/bootstrap/bootstrap.bundle.min.js"></script> <!-- feather icon js--> <script src="assets/js/icons/feather-icon/feather.min.js"></script> <script src="assets/js/icons/feather-icon/feather-icon.js"></script> <!-- scrollbar js--> <script src="assets/js/scrollbar/simplebar.js"></script> <script src="assets/js/scrollbar/custom.js"></script> <!-- Sidebar jquery--> <script src="assets/js/config.js"></script> <!-- Plugins JS start--> <script src="assets/js/sidebar-menu.js"></script> <script src="assets/js/datatable/datatables/jquery.dataTables.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.buttons.min.js"></script> <script src="assets/js/datatable/datatable-extension/jszip.min.js"></script> <script src="assets/js/datatable/datatable-extension/buttons.colVis.min.js"></script> <script src="assets/js/datatable/datatable-extension/pdfmake.min.js"></script> <script src="assets/js/datatable/datatable-extension/vfs_fonts.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.autoFill.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.select.min.js"></script> <script src="assets/js/datatable/datatable-extension/buttons.bootstrap4.min.js"></script> <script src="assets/js/datatable/datatable-extension/buttons.html5.min.js"></script> <script src="assets/js/datatable/datatable-extension/buttons.print.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.bootstrap4.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.responsive.min.js"></script> <script src="assets/js/datatable/datatable-extension/responsive.bootstrap4.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.keyTable.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.colReorder.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.fixedHeader.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.rowReorder.min.js"></script> <script src="assets/js/datatable/datatable-extension/dataTables.scroller.min.js"></script> <script src="assets/js/datatable/datatable-extension/custom.js"></script> <script> $(document).ready(function () { // Event delegation for dynamically loaded rows $(document).on('change', '.order-status', function () { var status = $(this).val(); var orderId = $(this).data('order-id'); var emailId = $(this).data('email-id'); // If "Order Dispatched" is selected, open the AWB modal if (status == '3') { $('#orderId').val(orderId); // Pass order ID to hidden input in the modal $('#emailId').val(emailId); $('#awbModal').modal('show'); } else { // For other statuses, update the order status via AJAX $.ajax({ url: 'ajax/update_order_status.php', type: 'POST', data: { orderId: orderId, status: status }, success: function (response) { alert('Order status updated successfully!'); }, error: function () { alert('Failed to update order status.'); } }); } }); // Handle form submission for dispatch details $('#awbForm').on('submit', function (e) { e.preventDefault(); var awbNo = $('#awbNo').val(); var courierName = $('#courierName').val(); var orderId = $('#orderId').val(); var emailId = $('#emailId').val(); // Update dispatch info via AJAX $.ajax({ url: 'ajax/update_order_status.php', type: 'POST', data: { orderId: orderId, status: '3', awbNo: awbNo, courierName: courierName, emailId: emailId }, success: function (response) { $('#awbModal').modal('hide'); alert('Order dispatch details updated successfully!'); window.location.reload(); }, error: function () { alert('Failed to update order dispatch details.'); } }); }); }); </script> </div> </div> </body> </html>