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