-
+
+
+
+
@@ -87,6 +92,7 @@ import { defineRule } from "vee-validate";
import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages";
import baseMixin from "@/mixins/base-mixin.js";
+import loader from "@/ux-components/loader/loader";
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
@@ -109,6 +115,7 @@ export default {
localShopProviderData: this.shopProviderDataFromParent,
localSelectedProviderNumber: null,
zipCodeData: null,
+ isLoading: false,
};
},
props: {
@@ -160,6 +167,7 @@ export default {
},
isModalFooterButtonDisabled() {
return (
+ this.isLoading ||
this.displayInvalidZipAlert ||
this.displayNoShopsAlert ||
!this.localSelectedProviderNumber
@@ -248,8 +256,14 @@ export default {
this.modal.closeModal();
},
async onSearchZip(event) {
+ this.isLoading = true;
event.preventDefault();
- this.zipCodeData = await this.getZipCodeData(this.localZipCode, "service-location");
+ if (this.localZipCode) {
+ this.zipCodeData = await this.getZipCodeData(this.localZipCode, "service-location");
+ } else {
+ this.zipCodeData = { containsMilitaryBase: false, isServiceable: false, isValid: false, state: "", zipCode: this.localZipCode, zipCodeCtu: "" };
+ this.isLoading = false;
+ }
// Add zipCode to zipCodeData as it does not come back from endpoint
this.zipCodeData.zipCode = this.localZipCode;
if (this.zipCodeData.isValid) {
@@ -270,8 +284,11 @@ export default {
this.localShopProviderData = result.data;
this.numberOfShopsToDisplay = 3;
this.updateShopsForZip();
+ this.isLoading = false;
});
}
+ } else {
+ this.isLoading = false;
}
},
updateShopsForZip() {
@@ -317,6 +334,7 @@ export default {
serviceZipQuestion,
buttonQuestion,
alert,
+ loader,
},
};
@@ -444,4 +462,10 @@ export default {
display: block;
width: 100%;
}
+.loader-wrapper {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ max-width: 100%;
+}