map system updates
This commit is contained in:
@@ -330,4 +330,10 @@ export function openAddModal(lat, lng) {
|
||||
|
||||
// Show modal
|
||||
modal.classList.remove('hidden');
|
||||
|
||||
// Trigger custom event for auto address lookup
|
||||
const autoLookupEvent = new CustomEvent('autoAddressLookup', {
|
||||
detail: { mode: 'add', lat, lng }
|
||||
});
|
||||
document.dispatchEvent(autoLookupEvent);
|
||||
}
|
||||
|
||||
@@ -284,6 +284,7 @@ export function setupGeoLocationSync() {
|
||||
}
|
||||
}
|
||||
|
||||
// ...existing code...
|
||||
export function setupEventListeners() {
|
||||
// Desktop controls
|
||||
document.getElementById('refresh-btn')?.addEventListener('click', () => {
|
||||
@@ -345,6 +346,17 @@ export function setupEventListeners() {
|
||||
lookupAddress('edit');
|
||||
});
|
||||
|
||||
// Auto address lookup event listener
|
||||
document.addEventListener('autoAddressLookup', (e) => {
|
||||
const { mode } = e.detail;
|
||||
if (mode === 'add') {
|
||||
// Add a small delay to ensure the form is fully rendered
|
||||
setTimeout(() => {
|
||||
lookupAddress('add');
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
|
||||
// Geo-location field sync
|
||||
setupGeoLocationSync();
|
||||
|
||||
@@ -361,4 +373,4 @@ export function setupEventListeners() {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user