1418
This commit is contained in:
parent
67ebc72e59
commit
5c70ff81fd
2 changed files with 29 additions and 18 deletions
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import dropdownQuestion from "@/digital-components/dropdown-question/dropdown-question";
|
import dropdownQuestion from "@/digital-components/dropdown-question/dropdown-question";
|
||||||
|
// import { storeActions } from "@/constants/store-actions.js";
|
||||||
|
// import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "vehicle-question",
|
name: "vehicle-question",
|
||||||
|
|
@ -15,7 +17,6 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
values: [],
|
values: [],
|
||||||
selectedIndex: null,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -38,11 +39,11 @@ export default {
|
||||||
newValue = newValue != null && newValue > -1 ? this.values[newValue] : null;
|
newValue = newValue != null && newValue > -1 ? this.values[newValue] : null;
|
||||||
this.$emit("update:modelValue", newValue);
|
this.$emit("update:modelValue", newValue);
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async getNewValues(selectedYMMS) {
|
async options(selectedYMMS) {
|
||||||
const results = await this.updateValues();
|
const results = await this.updateValues();
|
||||||
this.values = results?.data;
|
this.values = results?.data;
|
||||||
if (this.values.length == 1) {
|
if (this.values.length == 1) {
|
||||||
|
|
@ -52,7 +53,12 @@ export default {
|
||||||
selectedYMMS != null ? this.values.indexOf(selectedYMMS) : null;
|
selectedYMMS != null ? this.values.indexOf(selectedYMMS) : null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// loadInitialData() {
|
||||||
|
// return baseMixin.methods.dispatchStoreAction(storeActions.GET_VEHICLE_YEARS, {});
|
||||||
|
// },
|
||||||
|
// initializeComponent(initialData) {
|
||||||
|
// this.values = initialData;
|
||||||
|
// },
|
||||||
clearValues() {
|
clearValues() {
|
||||||
this.values = [];
|
this.values = [];
|
||||||
this.selectedValue = null;
|
this.selectedValue = null;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
class="mb-2 mt-4"
|
class="mb-2 mt-4"
|
||||||
v-model="selectedYear"
|
v-model="selectedYear"
|
||||||
cmsWidgetName="VehicleYearQuestion"
|
cmsWidgetName="VehicleYearQuestion"
|
||||||
:updateValues="updateYearValues"
|
|
||||||
validationRules="year-required"
|
validationRules="year-required"
|
||||||
placeHolderText="Select year"
|
placeHolderText="Select year"
|
||||||
inputId="yearQuestionField" />
|
inputId="yearQuestionField" />
|
||||||
|
|
@ -101,10 +100,10 @@ export default {
|
||||||
name: "vehicle",
|
name: "vehicle",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedYear: null,
|
selectedYear: this.selectedYearfromStore,
|
||||||
selectedMake: null,
|
selectedMake: this.selectedMakefromStore,
|
||||||
selectedModel: null,
|
selectedModel: this.selectedModelfromStore,
|
||||||
selectedStyle: null,
|
selectedStyle: this.selectedStylefromStore,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -113,9 +112,9 @@ export default {
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
// mounted() {
|
||||||
this.$refs["vehicleYearQuestion"].getNewValues(this.selectedYearfromStore);
|
// this.$refs["vehicleYearQuestion"].getNewValues(this.selectedYearfromStore);
|
||||||
},
|
// },
|
||||||
|
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
|
|
@ -124,6 +123,7 @@ export default {
|
||||||
const experimentForLogging = store.getters.applicationUser.experiments.find(
|
const experimentForLogging = store.getters.applicationUser.experiments.find(
|
||||||
(e) => e.universeName === experimentUniverses.CONCEPT_FUNNEL
|
(e) => e.universeName === experimentUniverses.CONCEPT_FUNNEL
|
||||||
);
|
);
|
||||||
|
const yearQuestionInitialDataPromise = baseMixin.methods.dispatchStoreAction(storeActions.GET_VEHICLE_YEARS, {});
|
||||||
|
|
||||||
// If the concept funnel experiment is found, as it should be when coming from safelite.com, then log the experiment exposure.
|
// If the concept funnel experiment is found, as it should be when coming from safelite.com, then log the experiment exposure.
|
||||||
if (experimentForLogging !== undefined) {
|
if (experimentForLogging !== undefined) {
|
||||||
|
|
@ -146,6 +146,10 @@ export default {
|
||||||
resultKey: "cmsContent",
|
resultKey: "cmsContent",
|
||||||
promise: cmsContentPromise,
|
promise: cmsContentPromise,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
resultKey: "yearQuestionInitialData",
|
||||||
|
promise: yearQuestionInitialDataPromise,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let resultMap = await settleAllPromises(promiseResultMap);
|
let resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
@ -153,6 +157,7 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
//vm.$refs.vehicleQuestion.initializeComponent(resultMap.yearQuestionInitialData);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -161,7 +166,7 @@ export default {
|
||||||
const parsedYear = parseInt(year);
|
const parsedYear = parseInt(year);
|
||||||
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_YEAR, parsedYear);
|
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_YEAR, parsedYear);
|
||||||
if (year) {
|
if (year) {
|
||||||
this.$refs["vehicleMakeQuestion"].getNewValues(this.selectedMakefromStore);
|
this.$refs["vehicleMakeQuestion"].options(this.selectedMakefromStore);
|
||||||
} else {
|
} else {
|
||||||
this.$refs["vehicleMakeQuestion"].clearValues();
|
this.$refs["vehicleMakeQuestion"].clearValues();
|
||||||
}
|
}
|
||||||
|
|
@ -169,7 +174,7 @@ export default {
|
||||||
selectedMake(make) {
|
selectedMake(make) {
|
||||||
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_MAKE, make, false);
|
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_MAKE, make, false);
|
||||||
if (make) {
|
if (make) {
|
||||||
this.$refs["vehicleModelQuestion"].getNewValues(this.selectedModelfromStore);
|
this.$refs["vehicleModelQuestion"].options(this.selectedModelfromStore);
|
||||||
} else {
|
} else {
|
||||||
this.$refs["vehicleModelQuestion"].clearValues();
|
this.$refs["vehicleModelQuestion"].clearValues();
|
||||||
}
|
}
|
||||||
|
|
@ -177,7 +182,7 @@ export default {
|
||||||
selectedModel(model) {
|
selectedModel(model) {
|
||||||
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_MODEL, model, false);
|
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_MODEL, model, false);
|
||||||
if (model) {
|
if (model) {
|
||||||
this.$refs["vehicleStyleQuestion"].getNewValues(this.selectedStylefromStore);
|
this.$refs["vehicleStyleQuestion"].options(this.selectedStylefromStore);
|
||||||
} else {
|
} else {
|
||||||
this.$refs["vehicleStyleQuestion"].clearValues();
|
this.$refs["vehicleStyleQuestion"].clearValues();
|
||||||
}
|
}
|
||||||
|
|
@ -210,9 +215,9 @@ export default {
|
||||||
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateYearValues() {
|
// async updateYearValues() {
|
||||||
return await baseMixin.methods.dispatchStoreAction(storeActions.GET_VEHICLE_YEARS, {});
|
// return await baseMixin.methods.dispatchStoreAction(storeActions.GET_VEHICLE_YEARS, {});
|
||||||
},
|
// },
|
||||||
|
|
||||||
async updateMakeValues() {
|
async updateMakeValues() {
|
||||||
return await baseMixin.methods.dispatchStoreAction(storeActions.GET_VEHICLE_MAKES, {
|
return await baseMixin.methods.dispatchStoreAction(storeActions.GET_VEHICLE_MAKES, {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue