AI

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Luxury Hotel Booking</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
        }
        header {
            background-color: #333;
            color: white;
            padding: 10px 20px;
            text-align: center;
        }
        .container {
            max-width: 800px;
            margin: 20px auto;
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .form-group {
            margin-bottom: 20px;
        }
        label {
            font-weight: bold;
            display: block;
            margin-bottom: 5px;
        }
        input, button {
            width: 100%;
            padding: 10px;
            margin-top: 5px;
            border: 1px solid #ddd;
            border-radius: 5px;
        }
        button {
            background-color: #007BFF;
            color: white;
            border: none;
            cursor: pointer;
        }
        button:hover {
            background-color: #0056b3;
        }
        .response {
            margin-top: 20px;
            padding: 15px;
            background: #e9ecef;
            border-left: 5px solid #007BFF;
        }
    </style>
</head>
<body>
    <header>
        <h1>Luxury Hotel Booking</h1>
    </header>

    <div class="container">
        <h2>Find Your Perfect Stay</h2>
        <div class="form-group">
            <label for="query">What are you looking for in a hotel?</label>
            <input type="text" id="query" placeholder="E.g., spa, beach view, fine dining">
        </div>
        <button id="search-button">Ask AI</button>

        <div id="response" class="response" style="display: none;"></div>
    </div>

    <div class="container">
        <h2>Book Your Stay</h2>
        <div class="form-group">
            <label for="hotel-id">Hotel ID</label>
            <input type="text" id="hotel-id" placeholder="Enter the ID of the hotel">
        </div>
        <div class="form-group">
            <label for="customer-name">Your Name</label>
            <input type="text" id="customer-name" placeholder="Enter your name">
        </div>
        <button id="book-button">Book Now</button>

        <div id="booking-response" class="response" style="display: none;"></div>
    </div>

    <script>
        document.getElementById('search-button').addEventListener('click', async () => {
            const query = document.getElementById('query').value;
            const responseDiv = document.getElementById('response');

            const response = await fetch('/ask', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({ query }),
            });

            const data = await response.json();
            responseDiv.style.display = 'block';
            responseDiv.textContent = data.response;
        });

        document.getElementById('book-button').addEventListener('click', async () => {
            const hotelId = document.getElementById('hotel-id').value;
            const customerName = document.getElementById('customer-name').value;
            const bookingResponseDiv = document.getElementById('booking-response');

            const response = await fetch('/book', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({ hotel_id: parseInt(hotelId), customer_name: customerName }),
            });

            const data = await response.json();
            bookingResponseDiv.style.display = 'block';

            if (data.error) {
                bookingResponseDiv.textContent = `Error: ${data.error}`;
            } else {
                bookingResponseDiv.textContent = data.message;
            }
        });
    </script>
</body>
</html>