fork download
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Flight Passenger Details</title>
  7. <style>
  8. /* CSS Styling */
  9. body, html {
  10. margin: 0;
  11. padding: 0;
  12. height: 100%;
  13. font-family: Arial, sans-serif;
  14. }
  15.  
  16. .background-image {
  17. position: fixed;
  18. top: 0;
  19. left: 0;
  20. width: 100%;
  21. height: 100%;
  22. background-image: url('https://v...content-available-to-author-only...r.com/1920x1080'); /* Replace with your flight image */
  23. background-size: cover;
  24. background-position: center;
  25. z-index: -1;
  26. opacity: 0.7;
  27. }
  28.  
  29. .container {
  30. position: relative;
  31. z-index: 1;
  32. max-width: 600px;
  33. margin: 50px auto;
  34. padding: 20px;
  35. background: rgba(255, 255, 255, 0.8);
  36. border-radius: 10px;
  37. box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  38. }
  39.  
  40. h1 {
  41. text-align: center;
  42. color: #333;
  43. }
  44.  
  45. form {
  46. display: flex;
  47. flex-direction: column;
  48. }
  49.  
  50. label {
  51. margin-bottom: 5px;
  52. font-weight: bold;
  53. }
  54.  
  55. input {
  56. margin-bottom: 15px;
  57. padding: 10px;
  58. border: 1px solid #ccc;
  59. border-radius: 5px;
  60. }
  61.  
  62. button {
  63. padding: 10px;
  64. background-color: #007BFF;
  65. color: white;
  66. border: none;
  67. border-radius: 5px;
  68. cursor: pointer;
  69. }
  70.  
  71. button:hover {
  72. background-color: #0056b3;
  73. }
  74.  
  75. .details-container {
  76. margin-top: 20px;
  77. padding: 20px;
  78. background: rgba(255, 255, 255, 0.9);
  79. border-radius: 10px;
  80. box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  81. }
  82.  
  83. .details-container h2 {
  84. margin-top: 0;
  85. color: #333;
  86. }
  87.  
  88. .details-container p {
  89. margin: 5px 0;
  90. color: #555;
  91. }
  92. </style>
  93. </head>
  94. <body>
  95. <!-- HTML Structure -->
  96. <div class="background-image"></div>
  97. <div class="container">
  98. <h1>Flight Passenger Details</h1>
  99. <form id="detailsForm">
  100. <label for="pnr">PNR Number:</label>
  101. <input type="text" id="pnr" name="pnr" required>
  102.  
  103. <label for="lastName">Last Name:</label>
  104. <input type="text" id="lastName" name="lastName" required>
  105.  
  106. <button type="submit">Get Details</button>
  107. </form>
  108.  
  109. <div id="passengerDetails" class="details-container">
  110. <!-- Passenger details will be displayed here -->
  111. </div>
  112. </div>
  113.  
  114. <script>
  115. // JavaScript Functionality
  116. document.getElementById('detailsForm').addEventListener('submit', function(event) {
  117. event.preventDefault();
  118.  
  119. const pnr = document.getElementById('pnr').value;
  120. const lastName = document.getElementById('lastName').value;
  121.  
  122. // Simulate fetching data from an API
  123. fetchPassengerDetails(pnr, lastName)
  124. .then(data => {
  125. displayPassengerDetails(data);
  126. })
  127. .catch(error => {
  128. console.error('Error:', error);
  129. alert('Failed to fetch passenger details. Please try again.');
  130. });
  131. });
  132.  
  133. function fetchPassengerDetails(pnr, lastName) {
  134. // Simulate an API call
  135. return new Promise((resolve, reject) => {
  136. setTimeout(() => {
  137. const mockData = {
  138. pnr: pnr,
  139. lastName: lastName,
  140. firstName: 'John',
  141. flightNumber: 'AA123',
  142. departure: 'New York (JFK)',
  143. destination: 'Los Angeles (LAX)',
  144. departureTime: '10:00 AM',
  145. arrivalTime: '1:00 PM',
  146. seatNumber: '24A',
  147. status: 'On Time'
  148. };
  149. resolve(mockData);
  150. }, 1000);
  151. });
  152. }
  153.  
  154. function displayPassengerDetails(data) {
  155. const detailsContainer = document.getElementById('passengerDetails');
  156. detailsContainer.innerHTML = `
  157. <h2>Passenger Details</h2>
  158. <p><strong>PNR:</strong> ${data.pnr}</p>
  159. <p><strong>Name:</strong> ${data.firstName} ${data.lastName}</p>
  160. <p><strong>Flight Number:</strong> ${data.flightNumber}</p>
  161. <p><strong>Departure:</strong> ${data.departure}</p>
  162. <p><strong>Destination:</strong> ${data.destination}</p>
  163. <p><strong>Departure Time:</strong> ${data.departureTime}</p>
  164. <p><strong>Arrival Time:</strong> ${data.arrivalTime}</p>
  165. <p><strong>Seat Number:</strong> ${data.seatNumber}</p>
  166. <p><strong>Status:</strong> ${data.status}</p>
  167. `;
  168. }
  169. </script>
  170. </body>
  171. </html>
Success #stdin #stdout 0.02s 25908KB
stdin
Standard input is empty
stdout
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flight Passenger Details</title>
    <style>
        /* CSS Styling */
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: Arial, sans-serif;
        }

        .background-image {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: url('https://v...content-available-to-author-only...r.com/1920x1080'); /* Replace with your flight image */
            background-size: cover;
            background-position: center;
            z-index: -1;
            opacity: 0.7;
        }

        .container {
            position: relative;
            z-index: 1;
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        h1 {
            text-align: center;
            color: #333;
        }

        form {
            display: flex;
            flex-direction: column;
        }

        label {
            margin-bottom: 5px;
            font-weight: bold;
        }

        input {
            margin-bottom: 15px;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }

        button {
            padding: 10px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        button:hover {
            background-color: #0056b3;
        }

        .details-container {
            margin-top: 20px;
            padding: 20px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        .details-container h2 {
            margin-top: 0;
            color: #333;
        }

        .details-container p {
            margin: 5px 0;
            color: #555;
        }
    </style>
</head>
<body>
    <!-- HTML Structure -->
    <div class="background-image"></div>
    <div class="container">
        <h1>Flight Passenger Details</h1>
        <form id="detailsForm">
            <label for="pnr">PNR Number:</label>
            <input type="text" id="pnr" name="pnr" required>
            
            <label for="lastName">Last Name:</label>
            <input type="text" id="lastName" name="lastName" required>
            
            <button type="submit">Get Details</button>
        </form>
        
        <div id="passengerDetails" class="details-container">
            <!-- Passenger details will be displayed here -->
        </div>
    </div>

    <script>
        // JavaScript Functionality
        document.getElementById('detailsForm').addEventListener('submit', function(event) {
            event.preventDefault();
            
            const pnr = document.getElementById('pnr').value;
            const lastName = document.getElementById('lastName').value;
            
            // Simulate fetching data from an API
            fetchPassengerDetails(pnr, lastName)
                .then(data => {
                    displayPassengerDetails(data);
                })
                .catch(error => {
                    console.error('Error:', error);
                    alert('Failed to fetch passenger details. Please try again.');
                });
        });

        function fetchPassengerDetails(pnr, lastName) {
            // Simulate an API call
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    const mockData = {
                        pnr: pnr,
                        lastName: lastName,
                        firstName: 'John',
                        flightNumber: 'AA123',
                        departure: 'New York (JFK)',
                        destination: 'Los Angeles (LAX)',
                        departureTime: '10:00 AM',
                        arrivalTime: '1:00 PM',
                        seatNumber: '24A',
                        status: 'On Time'
                    };
                    resolve(mockData);
                }, 1000);
            });
        }

        function displayPassengerDetails(data) {
            const detailsContainer = document.getElementById('passengerDetails');
            detailsContainer.innerHTML = `
                <h2>Passenger Details</h2>
                <p><strong>PNR:</strong> ${data.pnr}</p>
                <p><strong>Name:</strong> ${data.firstName} ${data.lastName}</p>
                <p><strong>Flight Number:</strong> ${data.flightNumber}</p>
                <p><strong>Departure:</strong> ${data.departure}</p>
                <p><strong>Destination:</strong> ${data.destination}</p>
                <p><strong>Departure Time:</strong> ${data.departureTime}</p>
                <p><strong>Arrival Time:</strong> ${data.arrivalTime}</p>
                <p><strong>Seat Number:</strong> ${data.seatNumber}</p>
                <p><strong>Status:</strong> ${data.status}</p>
            `;
        }
    </script>
</body>
</html>