<?php
require_once '../config/db_config.php';
session_start();
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
    header('Location: login.php');
    exit;
}
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    header('Location: orders.php');
    exit;
}
$order_id = (int)$_GET['id'];
$db = getDbConnection();
// Hapus order_items, payment_proofs, dst jika perlu
$db->prepare("DELETE FROM order_items WHERE order_id = ?")->execute([$order_id]);
$db->prepare("DELETE FROM payment_proofs WHERE order_id = ?")->execute([$order_id]);
$db->prepare("DELETE FROM orders WHERE order_id = ?")->execute([$order_id]);
header('Location: orders.php');
exit; 