259 lines
9.6 KiB
HTML
259 lines
9.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Book Out</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 0;
|
|
padding: 0;
|
|
background-color: #f4f4f4;
|
|
}
|
|
.form-container {
|
|
max-width: 500px;
|
|
margin: 20px auto;
|
|
padding: 20px;
|
|
background: #fff;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
}
|
|
.form-container h2 {
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
font-weight: bold;
|
|
}
|
|
.form-group input, .form-group select {
|
|
width: 100%;
|
|
padding: 10px;
|
|
font-size: 1rem;
|
|
border: 1px solid #ccc;
|
|
border-radius: 5px;
|
|
}
|
|
.form-group input:focus, .form-group select:focus {
|
|
border-color: #007bff;
|
|
outline: none;
|
|
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
|
}
|
|
.hidden {
|
|
display: none;
|
|
}
|
|
button {
|
|
width: 100%;
|
|
padding: 10px;
|
|
font-size: 1rem;
|
|
color: #fff;
|
|
background-color: #007bff;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
}
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.form-container {
|
|
width: 100%; /* Ensure it fits the screen */
|
|
margin: 20px auto;
|
|
padding: 15px;
|
|
box-sizing: border-box; /* Include padding in width calculation */
|
|
}
|
|
.form-group input, .form-group select, button {
|
|
font-size: 0.9rem;
|
|
padding: 8px;
|
|
}
|
|
h2 {
|
|
font-size: 1.5rem;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.form-container {
|
|
width: 100%; /* Ensure it fits the screen */
|
|
margin: 10px auto;
|
|
padding: 10px;
|
|
box-sizing: border-box; /* Include padding in width calculation */
|
|
}
|
|
.form-group input, .form-group select, button {
|
|
font-size: 0.8rem;
|
|
padding: 6px;
|
|
}
|
|
h2 {
|
|
font-size: 1.2rem;
|
|
}
|
|
}
|
|
|
|
.nature-button {
|
|
flex: 1;
|
|
padding: 10px;
|
|
font-size: 1rem;
|
|
color: #fff;
|
|
background-color: #007bff;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
.nature-button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
.nature-button.selected {
|
|
background-color: #28a745; /* Green for selected */
|
|
}
|
|
|
|
.pob-button {
|
|
flex: 1;
|
|
padding: 10px;
|
|
font-size: 1rem;
|
|
color: #fff;
|
|
background-color: #007bff;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
.pob-button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
.pob-button.selected {
|
|
background-color: #28a745; /* Green for selected */
|
|
}
|
|
</style>
|
|
<script>
|
|
function toggleLandawayFields(natureOfFlight) {
|
|
const landawayFields = document.getElementById("landaway-fields");
|
|
document.getElementById("nature_of_flight").value = natureOfFlight;
|
|
|
|
// Update button styles
|
|
document.querySelectorAll(".nature-button").forEach(button => {
|
|
button.classList.remove("selected");
|
|
});
|
|
document.getElementById(`nature_${natureOfFlight}`).classList.add("selected");
|
|
|
|
if (natureOfFlight === "Landaway") {
|
|
landawayFields.classList.remove("hidden");
|
|
} else {
|
|
landawayFields.classList.add("hidden");
|
|
}
|
|
}
|
|
|
|
function selectPOB(pob) {
|
|
document.getElementById("pob").value = pob;
|
|
|
|
// Update button styles
|
|
document.querySelectorAll(".pob-button").forEach(button => {
|
|
button.classList.remove("selected");
|
|
});
|
|
document.getElementById(`pob_${pob}`).classList.add("selected");
|
|
}
|
|
|
|
function setCookie(name, value, days) {
|
|
const date = new Date();
|
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
document.cookie = `${name}=${value};expires=${date.toUTCString()};path=/`;
|
|
}
|
|
|
|
function getCookie(name) {
|
|
const cookies = document.cookie.split(';');
|
|
for (let i = 0; i < cookies.length; i++) {
|
|
const cookie = cookies[i].trim();
|
|
if (cookie.startsWith(name + '=')) {
|
|
return cookie.substring(name.length + 1);
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
function handleAircraftRegInput() {
|
|
const acRegInput = document.getElementById("ac_reg");
|
|
const acTypeInput = document.getElementById("ac_type");
|
|
const captainNameInput = document.getElementById("captain_name");
|
|
acRegInput.value = acRegInput.value.toUpperCase();
|
|
setCookie("ac_reg", acRegInput.value, 30);
|
|
setCookie("ac_type", acTypeInput.value, 30);
|
|
setCookie("captain_name", captainNameInput.value, 30);
|
|
}
|
|
|
|
function populateAircraftFields() {
|
|
const savedReg = getCookie("ac_reg");
|
|
const savedType = getCookie("ac_type");
|
|
const savedCaptainName = getCookie("captain_name");
|
|
if (savedReg) {
|
|
document.getElementById("ac_reg").value = savedReg;
|
|
}
|
|
if (savedType) {
|
|
document.getElementById("ac_type").value = savedType;
|
|
}
|
|
if (savedCaptainName) {
|
|
document.getElementById("captain_name").value = savedCaptainName;
|
|
}
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", populateAircraftFields);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="form-container">
|
|
<h2>Log Outgoing Flight</h2>
|
|
<form action="submit_outgoing.php" method="POST">
|
|
<div class="form-group">
|
|
<label for="ac_reg">Aircraft Registration</label>
|
|
<input type="text" id="ac_reg" name="ac_reg" required maxlength="16" oninput="handleAircraftRegInput()">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="ac_type">Aircraft Type</label>
|
|
<input type="text" id="ac_type" name="ac_type" required maxlength="32" oninput="handleAircraftRegInput()">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="captain_name">Captain's Name</label>
|
|
<input type="text" id="captain_name" name="captain_name" required maxlength="64" oninput="handleAircraftRegInput()">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>POB (Persons on Board)</label>
|
|
<input type="hidden" id="pob" name="pob" required>
|
|
<div style="display: flex; gap: 10px;">
|
|
<button type="button" id="pob_1" class="pob-button" onclick="selectPOB(1)">1</button>
|
|
<button type="button" id="pob_2" class="pob-button" onclick="selectPOB(2)">2</button>
|
|
<button type="button" id="pob_3" class="pob-button" onclick="selectPOB(3)">3</button>
|
|
<button type="button" id="pob_4" class="pob-button" onclick="selectPOB(4)">4</button>
|
|
<button type="button" id="pob_5" class="pob-button" onclick="selectPOB(5)">5</button>
|
|
<button type="button" id="pob_6" class="pob-button" onclick="selectPOB(6)">6</button>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Nature of Flight</label>
|
|
<input type="hidden" id="nature_of_flight" name="nature_of_flight" required>
|
|
<div style="display: flex; gap: 10px;">
|
|
<button type="button" id="nature_Local" class="nature-button" onclick="toggleLandawayFields('Local')">Local</button>
|
|
<button type="button" id="nature_Circuits" class="nature-button" onclick="toggleLandawayFields('Circuits')">Circuits</button>
|
|
<button type="button" id="nature_Landaway" class="nature-button" onclick="toggleLandawayFields('Landaway')">Landaway</button>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="departure_time">Time of Departure</label>
|
|
<input type="datetime-local" id="etd" name="etd" required>
|
|
</div>
|
|
<div id="landaway-fields" class="hidden">
|
|
<div class="form-group">
|
|
<label for="destination">Destination</label>
|
|
<input type="text" id="destination" name="destination" maxlength="64">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="return_time">Estimated Time of Return</label>
|
|
<input type="datetime-local" id="eta" name="eta">
|
|
</div>
|
|
</div>
|
|
<button type="submit">Submit</button>
|
|
</form>
|
|
</div>
|
|
</body>
|
|
</html> |