diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index f14075c16..e0c054071 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -1001,6 +1001,7 @@ export default { min-width: 2.5rem; width: 2.5rem; height: 2.5rem; + border: 2px solid transparent; span { &.small { diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index 9304db190..ce67d219f 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -240,7 +240,6 @@ export default { this.internalModel.addressQuestions.zipCode === "" || this.internalModel.addressQuestions.zipCode.length !== 5 ) { - this.setMobileLocationInvalid(true); return; } const zipCodeData = await this.getZipCodeData( @@ -251,12 +250,10 @@ export default { if (!zipCodeData.isValid) { this.displayMismatchStateAndZipAlert = false; this.displayInvalidZipAlert = true; - this.setMobileLocationInvalid(true); return; } else if (zipCodeData.state != this.internalModel.addressQuestions.state) { this.displayInvalidZipAlert = false; this.displayMismatchStateAndZipAlert = true; - this.setMobileLocationInvalid(true); return; } else if ( this.internalModel.addressQuestions.zipCode !== @@ -299,7 +296,6 @@ export default { } // update the page level model this.$emit("setMobileLocation", this.internalModel); - this.setMobileLocationInvalid(false); }, toggleMobileLocation() { this.isMobileLocationOpened = !this.isMobileLocationOpened; diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index 24030fb1f..8a8b7ae55 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -355,6 +355,7 @@ describe("service-location.vue", () => { zipCode: "61606", }, isVehicleProtected: null, + isMobileSelected: false, }; // Act @@ -468,6 +469,7 @@ describe("service-location.vue", () => { zipCode: "43054", }, isVehicleProtected: true, + isMobileSelected: false, }; //wrapper.vm.closeModalAction = jest.fn(); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 3b37c8406..28d3c5d94 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -175,12 +175,12 @@ const MOBILE_FEE_PART_TYPE = "MOBILE FEE"; // DEFINE VALIDATION RULES defineRule("mobile-location-required", (value) => { if ( + value.isMobileSelected && (!value.addressQuestions.streetAddress || !value.addressQuestions.city || !value.addressQuestions.state || !value.addressQuestions.zipCode || - !value.isVehicleProtected) && - value.isMobileSelected + !value.isVehicleProtected) ) { return errorMessages.MOBILE_LOCATION_REQUIRED; } @@ -305,6 +305,9 @@ export default { zipCode: this.zipCode, }, isVehicleProtected: this.isVehicleProtected, + isMobileSelected: + this.selectedAppointmentType == AppointmentTypeStrings.MOBILE && + !this.getIsMobileLocationOpened(), }; }, }, @@ -523,6 +526,7 @@ export default { } if (this.isServiceableMobile) { this.setMobileLocation(newValue); + this.setMobileLocationInValid(false); } else { await getZipCodeData(newZipCode).then((zipCodeData) => { this.serviceZipCodeQuestion = { @@ -753,11 +757,16 @@ export default { }, displayMobileAddressQuestion(openMobileLocation) { var mobileLocationQuestionsRef = this.$refs.mobileLocationQuestions; - var isMobileAddressComplete = mobileLocationQuestionsRef.isMobileAddressComplete; - if (isMobileAddressComplete) { + var isMobileAddressComplete = mobileLocationQuestionsRef?.isMobileAddressComplete; + if (isMobileAddressComplete?.()) { + mobileLocationQuestionsRef.isMobileLocationOpened = false; + } else { mobileLocationQuestionsRef.isMobileLocationOpened = openMobileLocation; } }, + getIsMobileLocationOpened() { + return this.$refs.mobileLocationQuestions?.isMobileLocationOpened; + }, }, watch: { zipCode: { @@ -769,10 +778,8 @@ export default { this.selectedProvider = new Provider( this.shopProviderData.mobileProviderNumber ); - this.displayMobileAddressQuestion(true); } else { this.selectedProvider = new Provider(); - this.displayMobileAddressQuestion(false); } }); } diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 391004a70..3912979ea 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -192,7 +192,12 @@ export default { vm.selectedWindshieldOptions.selectedWindshieldReplaceOptions.push( damageLocationsSelected.SINGLE ); - return vm.forwardButtonAction(); + if ( + store.getters.externalParameterState.isExternalParameter && + store.getters.externalParameterDamage.damageType !== "other" + ) { + return vm.forwardButtonAction(); + } } baseMixin.methods.ResetExternalParamsAndHideModal(); } diff --git a/src/store/index.js b/src/store/index.js index 753d8509b..4f360cc18 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -3621,25 +3621,25 @@ export function mapTaxedLineItemsToStoreFormat(availableLineItems, storeLineItem export function getArrayOfAllLineItemsAndChildParts(lineItems) { let consolidatedLineItemsArray = []; - if (lineItems.glassParts != null) + if (lineItems?.glassParts != null) consolidatedLineItemsArray = [ ...consolidatedLineItemsArray, ...getFlattenedArrayOfLineItemsWithChildParts(lineItems.glassParts), ]; - if (lineItems.supportingItems != null) + if (lineItems?.supportingItems != null) consolidatedLineItemsArray = [ ...consolidatedLineItemsArray, ...getFlattenedArrayOfLineItemsWithChildParts(lineItems.supportingItems), ]; - if (lineItems.vaps != null) + if (lineItems?.vaps != null) consolidatedLineItemsArray = [ ...consolidatedLineItemsArray, ...getFlattenedArrayOfLineItemsWithChildParts(lineItems.vaps), ]; - if (lineItems.promos != null) + if (lineItems?.promos != null) consolidatedLineItemsArray = [ ...consolidatedLineItemsArray, ...getFlattenedArrayOfLineItemsWithChildParts(lineItems.promos), @@ -3789,7 +3789,15 @@ function supportingItemsEqual(supportingItemsA, supportingItemsB) { // if so, make sure it's not in the past. if in the past, clear schedule info in store. // if date not in past, then call schedule service to verify appointment is still available. async function resetScheduleIfUnavailable(context, order, pageNameToLog) { - if (!order.schedule?.date) { + // lineItems empty can happen when a customer goes all the way through scheduling as cash but then + // switches to insurance AND also switches vehicles during policy lookup. If you call shop-time-slots + // without parts, you get 500 errors so skip the call. + const lineItems = getArrayOfAllLineItemsAndChildParts(order.lineItems); + + if (!order.schedule?.date || lineItems.length === 0) { + console.log(new Date() + " no schedule date or lineItems. skip resetSchedule logic."); + console.log(new Date() + " schedule.schedule.date" + JSON.stringify(order.schedule)); + console.log(new Date() + " lineItems" + JSON.stringify(order.lineItems)); return; }