209 lines
6.7 KiB
HTML
209 lines
6.7 KiB
HTML
<script>
|
|
window.onload = function() {
|
|
document.getElementById('ac_reg').focus();
|
|
};
|
|
|
|
// Set default value to current date & time
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
let now = new Date();
|
|
let localDatetime = now.toISOString().slice(0, 16); // Format for datetime-local input
|
|
document.getElementById("eta").value = localDatetime;
|
|
document.getElementById("etd").value = localDatetime;
|
|
});
|
|
|
|
function fetchResults() {
|
|
let input = document.getElementById("ac_reg").value.replace(/[^a-zA-Z0-9]/g, '');
|
|
|
|
// Trigger only if 4+ characters are entered
|
|
if (input.length >= 5) {
|
|
fetch(`lookup.php?reg=${encodeURIComponent(input)}`)
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
let resultsDiv = document.getElementById("results");
|
|
let typeDiv = document.getElementById("ac_type");
|
|
let regDiv = document.getElementById("ac_reg");
|
|
|
|
resultsDiv.innerHTML = ""; // Clear previous results
|
|
console.log(data)
|
|
if (data.length == 1) {
|
|
resultsDiv.innerHTML = "<p>" + data[0].manufacturername + "<br>" + data[0].model + "</p>"
|
|
typeDiv.value = data[0].typecode;
|
|
regDiv.value = data[0].registration;
|
|
} else {
|
|
resultsDiv.innerHTML = "<p>No results found</p>";
|
|
}
|
|
})
|
|
.catch(error => console.error("Error fetching data:", error));
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Manual PPR</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #f4f4f9;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
margin: 20px;
|
|
width: 500px;
|
|
}
|
|
|
|
h2 {
|
|
text-align: center;
|
|
color: #333;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
label {
|
|
font-weight: bold;
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
color: #555;
|
|
}
|
|
|
|
input, textarea {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 5px;
|
|
font-size: 1rem;
|
|
transition: 0.3s;
|
|
}
|
|
|
|
input:focus, textarea:focus {
|
|
border-color: #007bff;
|
|
outline: none;
|
|
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
|
}
|
|
|
|
button {
|
|
width: 100%;
|
|
padding: 10px;
|
|
background: #007bff;
|
|
border: none;
|
|
color: white;
|
|
font-size: 1rem;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
transition: 0.3s;
|
|
}
|
|
|
|
button:hover {
|
|
background: #0056b3;
|
|
}
|
|
|
|
select {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 5px;
|
|
font-size: 1rem;
|
|
transition: 0.3s;
|
|
}
|
|
|
|
#results {
|
|
font-weight: bold;
|
|
font-family: 'Courier New', Courier, monospace;
|
|
}
|
|
|
|
select:focus {
|
|
border-color: #007bff;
|
|
outline: none;
|
|
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
|
}
|
|
|
|
.optional-label {
|
|
color: gray;
|
|
font-style: italic;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="form-container">
|
|
<h2>Log new PPR</h2>
|
|
<form action="newppr.php" method="POST">
|
|
<div class="form-group">
|
|
<label for="ac_reg">Registration</label>
|
|
<input type="text" id="ac_reg" name="ac_reg" onkeyup="fetchResults()" required>
|
|
</div>
|
|
<div id="results"></div>
|
|
<div class="form-group">
|
|
<label for="ac_type">Type</label>
|
|
<input type="text" id="ac_type" name="ac_type" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="optional-label" for="ac_call">Callsign (optional)</label>
|
|
<input type="text" id="ac_call" name="ac_call">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="captain">Captain's Name</label>
|
|
<input type="text" id="captain" name="captain" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="in_from">Arriving From</label>
|
|
<input type="text" id="in_from" name="in_from" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="pob_in">POB Inbound</label>
|
|
<input type="number" id="pob_in" name="pob_in" required>
|
|
</div>
|
|
<div class="form-group"></div>
|
|
<label for="eta">ETA</label>
|
|
<input type="datetime-local" id="eta" name="eta">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="out_to">Out to</label>
|
|
<input type="text" id="out_to" name="out_to">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="pob_out">POB Outbound</label>
|
|
<input type="number" id="pob_out" name="pob_out" >
|
|
</div>
|
|
<div class="form-group"></div>
|
|
<label for="eta">Departing At</label>
|
|
<input type="datetime-local" id="etd" name="etd">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="fuel">Fuel Needed</label>
|
|
<select id="fuel" name="fuel" single>
|
|
<option value="None">None</option>
|
|
<option value="JET A1">JET A1</option>
|
|
<option value="100LL">100LL</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="optional-label" for="email">Email (optional)</label>
|
|
<input type="email" id="email" name="email" >
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="optional-label" for="phone">Phone (optional)</label>
|
|
<input type="text" id="phone" name="phone" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="optional-label" for="notes">Notes (optional)</label>
|
|
<textarea id="message" name="notes" rows="4" ></textarea>
|
|
</div>
|
|
|
|
<button type="submit">Submit</button>
|
|
</form>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|