diff --git a/src/layouts/schedule-page/schedule-page.vue b/src/layouts/schedule-page/schedule-page.vue index 153e97a8..590b319c 100644 --- a/src/layouts/schedule-page/schedule-page.vue +++ b/src/layouts/schedule-page/schedule-page.vue @@ -329,6 +329,7 @@ export default { return { inShopAvailabilityRating: 'high', inShopDatesData: [], + isDatePickerRefreshing: false, isMobileView: false, mobileDatesData: [], mobileFeePart: null, @@ -352,14 +353,18 @@ export default { return false; } + const validMobileAppointmentType = ((this.selectedAppointmentType === AppointmentTypeStrings.MOBILE + || this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) + && serviceLocationToUse.mobileProviderNumber); + const validInShopAppointmentType = ((this.selectedAppointmentType === AppointmentTypeStrings.IN_SHOP + || this.selectedAppointmentType === AppointmentTypeStrings.DROP_OFF) + && (this.selectedProvider?.providerNumber || serviceLocationToUse.provider?.providerNumber)); + const serviceLocationPreReqs = serviceLocationToUse.zipCode !== null && serviceLocationToUse.zipCodeCtu !== null && serviceLocationToUse.appointmentType !== null - && (((this.selectedAppointmentType === AppointmentTypeStrings.MOBILE - || this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) - && serviceLocationToUse.mobileProviderNumber) - || ((this.selectedAppointmentType === AppointmentTypeStrings.IN_SHOP || this.selectedAppointmentType === AppointmentTypeStrings.DROP_OFF) - && (this.selectedProvider?.providerNumber || serviceLocationToUse.provider?.providerNumber))); + && (validMobileAppointmentType || validInShopAppointmentType) + && !this.isDatePickerRefreshing; const damageInfo = useMainStore().order.damage.isRepair || (useMainStore().order.lineItems?.glassParts != null && useMainStore().order.lineItems.glassParts.length > 0); @@ -685,11 +690,12 @@ export default { } }, async refreshDatePicker() { - console.log('refresh date picker...'); this.resetLocalFlags(); + this.isDatePickerRefreshing = true; await this.getDatePickerInitialData().then((data) => { this.selectableDatesData = data.initialShopTimeSlotsResponse; this.$refs.datePicker.initializeComponent(data); + this.isDatePickerRefreshing = false; showIssLoadingModal(false); }); }, diff --git a/src/layouts/schedule-page/service-location/service-location.spec.js b/src/layouts/schedule-page/service-location/service-location.spec.js index 7b1b4294..6a50fe05 100644 --- a/src/layouts/schedule-page/service-location/service-location.spec.js +++ b/src/layouts/schedule-page/service-location/service-location.spec.js @@ -203,7 +203,7 @@ describe('service-location.vue', () => { const newMobileServiceZipCode = '45433'; // Act - mobileServiceZipCodeQuestion.vm.$emit('update:modelValue', newMobileServiceZipCode); + mobileServiceZipCodeQuestion.vm.$emit('service-zip-code-updated', newMobileServiceZipCode); await wrapper.vm.$nextTick(); // Assert diff --git a/src/layouts/schedule-page/service-location/service-location.vue b/src/layouts/schedule-page/service-location/service-location.vue index eb121d40..d5559a95 100644 --- a/src/layouts/schedule-page/service-location/service-location.vue +++ b/src/layouts/schedule-page/service-location/service-location.vue @@ -96,13 +96,14 @@ + cmsWidgetName="MobileZipWidget" + @serviceZipCodeUpdated="handleServiceZipCodeChanged" />
{ const text = '12345'; const wrapper = shallowMount(serviceZipQuestion, { props: { - modelValue: text + parentZipCode: text }, attachTo: document.body }); @@ -32,9 +32,9 @@ describe('service-zip-question.vue', () => { // Act wrapper.vm.internalZipcode = '55555'; - wrapper.vm.updateModelValue(); + wrapper.vm.emitZipCodeUpdate(); // Assert - expect(wrapper.emitted('update:modelValue')).toEqual([['55555']]); + expect(wrapper.emitted('service-zip-code-updated')).toEqual([['55555']]); }); }); diff --git a/src/layouts/schedule-page/service-location/service-zip-question/service-zip-question.vue b/src/layouts/schedule-page/service-location/service-zip-question/service-zip-question.vue index 4f401049..5bea6fe0 100644 --- a/src/layouts/schedule-page/service-location/service-zip-question/service-zip-question.vue +++ b/src/layouts/schedule-page/service-location/service-zip-question/service-zip-question.vue @@ -10,7 +10,7 @@ isRequired :hasError="hasError" :validationRules="`zip-required|${cmsWidgetName}-zip-format`" - @clickEvent="updateModelValue" + @clickEvent="emitZipCodeUpdate" @fieldHasError="handleFieldError" /> @@ -32,7 +32,7 @@ export default { }, // TODO: Correct prop def. props: { - modelValue: String, + parentZipCode: String, cmsWidgetName: String, serviceZipFormatErrorMessage: { type: String, @@ -43,14 +43,14 @@ export default { default: false } }, - emits: ['update:modelValue', 'field-has-error'], + emits: ['service-zip-code-updated', 'field-has-error'], data() { return { - internalZipcode: this.modelValue + internalZipcode: this.parentZipCode }; }, watch: { - modelValue(newValue) { + parentZipCode(newValue) { if (newValue !== this.internalZipcode) { this.internalZipcode = newValue; } @@ -63,8 +63,8 @@ export default { handleFieldError(hasError) { this.$emit('field-has-error', hasError); }, - updateModelValue() { - this.$emit('update:modelValue', this.internalZipcode); + emitZipCodeUpdate() { + this.$emit('service-zip-code-updated', this.internalZipcode); } } }; diff --git a/src/layouts/schedule-page/service-location/shop-address/shop-address.vue b/src/layouts/schedule-page/service-location/shop-address/shop-address.vue index 98563ad1..f2fca788 100644 --- a/src/layouts/schedule-page/service-location/shop-address/shop-address.vue +++ b/src/layouts/schedule-page/service-location/shop-address/shop-address.vue @@ -75,10 +75,11 @@ + @fieldHasError="handleFieldError" + @serviceZipCodeUpdated="handleServiceZipCodeChanged" />
{