Just some improved comments
This commit is contained in:
parent
0402d8469e
commit
1a61604aab
1 changed files with 21 additions and 21 deletions
|
|
@ -112,7 +112,7 @@ export default {
|
||||||
alertCopyNoMatchWarning: "",
|
alertCopyNoMatchWarning: "",
|
||||||
matchingIndirectly: false,
|
matchingIndirectly: false,
|
||||||
matchFound: false,
|
matchFound: false,
|
||||||
enterPressed: false
|
enterPressed: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -242,17 +242,16 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
addressField1.blur();
|
addressField1.blur();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addressField1.addEventListener("change", () => {
|
addressField1.addEventListener("change", () => {
|
||||||
// NOTE: The standard "place_changed" handler of the autocomplete will use the address the user had chosen
|
// NOTE: The "place_changed" event of the autocomplete fires after this and will use eitherthe address the user had chosen
|
||||||
// using either the down / up arrows or the address the user was hovering over when they pressed "Enter."
|
// using either the down / up arrows or the address the user was hovering over when they pressed "Enter."
|
||||||
|
|
||||||
// If there has already been a match found then do nothing
|
// If a match has been previously found then do nothing
|
||||||
// OR
|
// OR
|
||||||
// If the user pressed "Enter" then do nothing
|
// If the user pressed "Enter" then do nothing
|
||||||
if (self.matchFound || self.enterPressed) {
|
if (self.matchFound || self.enterPressed) {
|
||||||
|
|
@ -260,18 +259,21 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the address that the user clicked on (if any)
|
// Get the address that the user clicked on (if any)
|
||||||
const clickedAddress = document.querySelector(".pac-container .pac-item:hover");
|
const clickedAddress = document.querySelector(
|
||||||
|
".pac-container .pac-item:hover"
|
||||||
|
);
|
||||||
|
|
||||||
// If the Street Address field changed without clicking (by pressing Tab, or clicking outside the field)
|
// If the Street Address field changed without clicking (i.e. by pressing Tab, or clicking outside the field)
|
||||||
if (clickedAddress === null) {
|
if (clickedAddress === null) {
|
||||||
// Select for the user, fill-in the address using first item in the list.
|
// Fill-in the address using first item in the list.
|
||||||
const item = document.querySelector(".pac-container .pac-item");
|
const item = document.querySelector(".pac-container .pac-item");
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
self.matchingIndirectly = true;
|
self.matchingIndirectly = true;
|
||||||
|
|
||||||
const firstResult = item.textContent;
|
const firstResult = item.textContent;
|
||||||
const geocoder = new window.google.maps.Geocoder();
|
const geocoder = new window.google.maps.Geocoder();
|
||||||
geocoder.geocode({
|
geocoder.geocode(
|
||||||
|
{
|
||||||
address: firstResult,
|
address: firstResult,
|
||||||
},
|
},
|
||||||
function (results, status) {
|
function (results, status) {
|
||||||
|
|
@ -291,7 +293,6 @@ export default {
|
||||||
self.displayNoMatchWarning = true;
|
self.displayNoMatchWarning = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function fillInAddress(place) {
|
function fillInAddress(place) {
|
||||||
|
|
@ -314,7 +315,8 @@ export default {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "route": {
|
case "route": {
|
||||||
self.addressModel.streetAddress += " " + component.short_name;
|
self.addressModel.streetAddress +=
|
||||||
|
" " + component.short_name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "locality": {
|
case "locality": {
|
||||||
|
|
@ -342,13 +344,11 @@ export default {
|
||||||
if (pacContainer) {
|
if (pacContainer) {
|
||||||
pacContainer.remove();
|
pacContainer.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.displayVerificationWarning = true;
|
self.displayVerificationWarning = true;
|
||||||
self.displayNoMatchWarning = false;
|
self.displayNoMatchWarning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|
@ -367,7 +367,7 @@ export default {
|
||||||
this.displayNoMatchWarning = false;
|
this.displayNoMatchWarning = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
textboxQuestion,
|
textboxQuestion,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue