diff --git a/src/layouts/schedule-page/schedule-page.vue b/src/layouts/schedule-page/schedule-page.vue index effcc5f4..617ffa7d 100644 --- a/src/layouts/schedule-page/schedule-page.vue +++ b/src/layouts/schedule-page/schedule-page.vue @@ -27,6 +27,7 @@ import siteHeader from '@/iss-components/site-header/site-header.vue'; import siteFooter from '@/iss-components/site-footer/site-footer.vue'; // Supporting files +import { AppointmentTypeStrings } from '@/constants/schedule-constants.js'; import { fetchCmsContentForPage } from '@/helpers/cms-content-helper'; import settleAllPromises from '@/helpers/layout-helper'; import { Form } from 'vee-validate'; @@ -67,19 +68,42 @@ export default { data() { }, - methods: - { - backButtonAction() { - this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); - }, + methods: { + arePagePrerequisitesValid() { + console.log('schedule preReqs...'); + console.log('serviceLocation...'); + const { serviceLocation } = useMainStore().order; + console.log(serviceLocation); + const serviceLocationPreReqs = serviceLocation.zipCode + && serviceLocation.zipCodeCtu + && serviceLocation.appointmentType + && (serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE + || serviceLocation.provider.providerNumber); + console.log('paymentInfo...'); + const paymentInfo = useMainStore().payment.isInsurance !== null; + console.log(paymentInfo); + console.log('supportingItems...'); + const supportingItems = useMainStore().lineItems.supportingItems !== null; + console.log(supportingItems); + console.log('damageInfo...'); + const damageInfo = + useMainStore().order.damage.isRepair + || (useMainStore().order.lineItems?.glassParts != null + && useMainStore().order.lineItems.glassParts.length > 0); + console.log(damageInfo); + return serviceLocationPreReqs && paymentInfo && supportingItems && damageInfo; + }, + backButtonAction() { + this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); + }, - forwardButtonAction() { - // validate and save here - this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route); - }, + forwardButtonAction() { + // validate and save here + this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route); + }, - navigateForward() { - } + navigateForward() { } + } }; diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index a44d6712..75b735f7 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -390,6 +390,7 @@ export default { setData(zipCodeData, serviceabilityDetails, mobileFeePart) { if (zipCodeData) { this.zipContainsMilitaryBase = zipCodeData.containsMilitaryBase; + this.zipCodeCtu = zipCodeData.zipCodeCtu; } if (serviceabilityDetails) { diff --git a/src/store/index.js b/src/store/index.js index 3ca9afc6..ed5455c9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -751,8 +751,10 @@ export const useMainStore = defineStore({ return []; }); - availableLineItems = addPricesToLineItems(availableLineItems, response.data.lineItems); - + if (response.data?.lineItems) { + const retAvailableLineItems = addPricesToLineItems(availableLineItems, response.data.lineItems); + return retAvailableLineItems; + } return availableLineItems; }, @@ -995,7 +997,6 @@ export const useMainStore = defineStore({ this.order.vehicle.registration.firstName = registrationInfo?.firstName; this.order.vehicle.registration.lastName = registrationInfo?.lastName; }, - updateServiceLocation(serviceLocationInfo) { state.order.serviceLocation.address = serviceLocationInfo.address; state.order.serviceLocation.address2 = serviceLocationInfo.address2; @@ -1264,7 +1265,6 @@ export const useMainStore = defineStore({ this.order.customer.address.zipCode = customerQuestions.addressQuestions.zipCode; this.order.customer.firstName = customerQuestions.firstName; this.order.customer.lastName = customerQuestions.lastName; - this.order.serviceLocation.zipCode = customerQuestions.addressQuestions.zipCode; }, savePartQuestionAnswers(partQuestionAnswersArray) { // if part question answers have changed, reset subsequent question answers