<?php require 'includes/auth.php'; ?>
<?php require_once '../app/db.php'; ?>

<?php
$id = $_GET['id'];
$stmt = $pdo->prepare("
SELECT b.*, c.name, c.phone
FROM bookings b
JOIN customers c ON b.customer_id=c.id
WHERE b.id=?
");
$stmt->execute([$id]);
$booking = $stmt->fetch();
?>

<h2>Booking <?= $booking['booking_code'] ?></h2>
<p>Customer: <?= $booking['name'] ?></p>
<p>Phone: <?= $booking['phone'] ?></p>
<p>Status: <?= $booking['status'] ?></p>
<p>Payment: <?= $booking['payment_status'] ?></p>

<a href="dispatch.php?id=<?= $booking['id'] ?>" class="btn btn-warning">
Assign Driver
</a>
