<?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);
?>
<style>
    body {
        background-color: #bebebee7;
        color: white;
    }
</style>
<div class="header">
    <input type="text" id="username" name="username" value="<?php echo $_SESSION['username']; ?>" readonly />
    <button onclick="window.location.href='home.php'">HOME</button>
    <button onclick="window.location.href='profile.php'">PAYMENTS</button>
    <button onclick="window.location.href='bookings.php'" style="border: 2px solid white">BOOKINGS</button>
    <button onclick="window.location.href='news.php'">NEWS</button>
    <button onclick="window.location.href='help.php'">HELP</button>
    <button onclick="window.location.href='services.php'">SERVICES</button>

</div>


<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>BOOKING TYPE</label>
            <input type="text" value="<?php echo $booking['type']; ?>">
            <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>