<?php
include 'koneksi.php'; 

if (isset($_POST['order_id']) && isset($_POST['status'])) {
    $order_id = $_POST['order_id'];
    $status = $_POST['status'];

    $stmt = $conn->prepare("UPDATE orders SET status = ? WHERE order_id = ?");
    $stmt->bind_param("ss", $status, $order_id);

    if ($stmt->execute()) {
        echo "<script>alert('Status berhasil diperbarui'); window.location.href='../order/order.php';</script>";
    } else {
        echo "<script>alert('Gagal memperbarui status'); window.history.back();</script>";
    }

    $stmt->close();
    $conn->close();
} else {
    echo "<script>alert('Data tidak lengkap'); window.history.back();</script>";
}
?>
