PPR ACK and Bulk Logging start
This commit is contained in:
+19
-2
@@ -168,7 +168,7 @@ function createLookup(fieldId, resultsId, selectCallback, options = {}) {
|
||||
// Format the aircraft registration
|
||||
const formatted = formatAircraftRegistration(searchTerm);
|
||||
const field = document.getElementById(fieldId);
|
||||
if (field) {
|
||||
if (field && fieldId !== 'aircraft-registration') {
|
||||
field.value = formatted;
|
||||
// Mark the form for auto-saving this aircraft
|
||||
const form = field.closest('form');
|
||||
@@ -194,7 +194,7 @@ function createLookup(fieldId, resultsId, selectCallback, options = {}) {
|
||||
|
||||
// Auto-populate the form fields
|
||||
const field = document.getElementById(fieldId);
|
||||
if (field) {
|
||||
if (field && fieldId !== 'aircraft-registration') {
|
||||
field.value = aircraft.registration;
|
||||
// Clear the unsaved aircraft flag since we found a match
|
||||
const form = field.closest('form');
|
||||
@@ -213,6 +213,8 @@ function createLookup(fieldId, resultsId, selectCallback, options = {}) {
|
||||
typeFieldId = 'book_in_type';
|
||||
} else if (fieldId === 'overflight_registration') {
|
||||
typeFieldId = 'overflight_type';
|
||||
} else if (fieldId === 'aircraft-registration') {
|
||||
typeFieldId = 'aircraft-type';
|
||||
}
|
||||
|
||||
if (typeFieldId) {
|
||||
@@ -330,6 +332,8 @@ const lookupManager = {
|
||||
}
|
||||
};
|
||||
|
||||
window.lookupManager = lookupManager;
|
||||
|
||||
// Initialize all lookups when page loads
|
||||
function initializeLookups() {
|
||||
// Create reusable lookup instances
|
||||
@@ -412,6 +416,14 @@ function initializeLookups() {
|
||||
{ isAirport: true, minLength: 2 }
|
||||
);
|
||||
lookupManager.register('overflight-destination', overflightDestinationLookup);
|
||||
|
||||
const bulkAircraftLookup = createLookup(
|
||||
'aircraft-registration',
|
||||
'bulk-aircraft-lookup-results',
|
||||
null,
|
||||
{ isAircraft: true, minLength: 4, debounceMs: 300 }
|
||||
);
|
||||
lookupManager.register('bulk-aircraft', bulkAircraftLookup);
|
||||
|
||||
// Attach keyboard handlers to airport input fields
|
||||
setTimeout(() => {
|
||||
@@ -459,6 +471,11 @@ function handleLocalAircraftLookup(value) {
|
||||
if (lookup) lookup.handle(value);
|
||||
}
|
||||
|
||||
function handleBulkAircraftLookup(value) {
|
||||
const lookup = lookupManager.lookups['bulk-aircraft'];
|
||||
if (lookup) lookup.handle(value);
|
||||
}
|
||||
|
||||
function clearArrivalAirportLookup() {
|
||||
const lookup = lookupManager.lookups['arrival-airport'];
|
||||
if (lookup) lookup.clear();
|
||||
|
||||
Reference in New Issue
Block a user