<?php
include "classes/class.loader.php";
$html = new html();
$html->bacground_emoji();
$calls = new functions();
$db = new db();
$user_data_1 = $db->query("SELECT * FROM users WHERE record_id = {$_SESSION['user_id']}");
$user_data = $user_data_1->fetch_assoc();
$user_extended_data_1 = $db->query("SELECT * FROM user_data_1 WHERE user_id = {$_SESSION['user_id']}");
$user_extended_data = $user_extended_data_1->fetch_assoc();

$booking = $db->query("SELECT * FROM bookings WHERE record_id = {$_GET['record_id']}")->fetch_assoc();
$amount_of_dogs = explode(",", $booking['dog_ids']);
$amount_of_dogs = count($amount_of_dogs);
$html->header();

?>
<style>
    body {
        background-color: #bebebee7;
        color: white;
    }
</style>

<div class="home_container">
    <div class="container_wide">
        <h1>BOOKING NO <?php echo $_GET['record_id']; ?></h1>
        <div class="container_wide" id="calendar_container">
            <label>DATE OF BOOKING</label>
            <input type="text" value="<?php echo $booking['date_of_booking']; ?>">
            <label>TIME START</label>
            <input type="text" value="<?php echo $booking['time_start']; ?>">
            <label>TIME END</label>
            <input type="text" value="<?php echo $booking['time_end']; ?>">
            <label>AMOUNT OF DOGS</label>
            <input type="text" value="<?php echo $amount_of_dogs; ?>">
            <label>BOOKING TYPE</label>
            <input type="text" value="<?php echo $booking['type']; ?>">
            <label>ADDITIONAL SERVICE</label>
            <input type="text" value="<?php echo $calls->get_service_name($booking['service']); ?>">
            <br><br>
            <form action="approve_booking.php?record_id=<?php echo $_GET['record_id']; ?>" method="post">
                <input type="submit" value="APPROVE">
            </form>
            <form action="decline_booking.php?record_id=<?php echo $_GET['record_id']; ?>" method="post">
                <input type="submit" value="DECLINE">
            </form>
        </div>

    </div>
</div>