Vehicle question
This commit is contained in:
parent
ad5f5310e3
commit
e29445bb83
6 changed files with 3 additions and 341 deletions
|
|
@ -60,9 +60,6 @@ export default {
|
|||
const results = await this.updateValues();
|
||||
this.values = results?.data;
|
||||
},
|
||||
initializeComponent(initialData) {
|
||||
this.values = initialData;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
<template>
|
||||
<dropdownQuestion
|
||||
cmsWidgetName="VehicleMakeQuestion"
|
||||
ref="makeQuestion"
|
||||
:options="makeOptions"
|
||||
disableAutoFill
|
||||
placeHolderText="Select an option"
|
||||
validationRules="make-required"
|
||||
inputId="makeQuestionField"
|
||||
v-model="selectedValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
|
||||
|
||||
import { errorMessages } from "@/constants/error-messages";
|
||||
import { required } from "@/helpers/validation-rules";
|
||||
import { defineRule } from "vee-validate";
|
||||
|
||||
defineRule("make-required", required(errorMessages.MAKE_REQUIRED));
|
||||
|
||||
export default {
|
||||
name: "make-question",
|
||||
data() {
|
||||
return {
|
||||
values: [],
|
||||
};
|
||||
},
|
||||
props: {
|
||||
modelValue: String,
|
||||
cmsWidgetName: String,
|
||||
validationRules: String,
|
||||
updateValues: Function,
|
||||
},
|
||||
components: {
|
||||
dropdownQuestion
|
||||
},
|
||||
computed: {
|
||||
questionText(){
|
||||
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
|
||||
},
|
||||
selectedValue: {
|
||||
get: function() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set: function(newValue) {
|
||||
this.$emit("update:modelValue",newValue);
|
||||
}
|
||||
},
|
||||
makeOptions() {
|
||||
const makeAnswers = this.values;
|
||||
const makeAnswersObj ={};
|
||||
if(makeAnswers)
|
||||
{
|
||||
for (let answer of Object.values(makeAnswers)) {
|
||||
if (answer) {
|
||||
makeAnswersObj[answer] = answer;
|
||||
}
|
||||
}
|
||||
}
|
||||
return makeAnswersObj
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async getNewValues() {
|
||||
const results = await this.updateValues();
|
||||
this.values = results?.data;
|
||||
},
|
||||
initializeComponent(initialData) {
|
||||
this.values = initialData;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
<template>
|
||||
<dropdownQuestion
|
||||
cmsWidgetName="VehicleModelQuestion"
|
||||
ref="modelQuestion"
|
||||
:options="modelOptions"
|
||||
disableAutoFill
|
||||
placeHolderText="Select an option"
|
||||
validationRules="model-required"
|
||||
inputId="modelQuestionField"
|
||||
v-model="selectedValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
|
||||
|
||||
import { errorMessages } from "@/constants/error-messages";
|
||||
import { required } from "@/helpers/validation-rules";
|
||||
import { defineRule } from "vee-validate";
|
||||
|
||||
defineRule("model-required", required(errorMessages.MODEL_REQUIRED));
|
||||
|
||||
|
||||
export default {
|
||||
name: "model-question",
|
||||
data() {
|
||||
return {
|
||||
values: Array,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
modelValue: String,
|
||||
cmsWidgetName: String,
|
||||
validationRules: String,
|
||||
updateValues: Function,
|
||||
},
|
||||
components: {
|
||||
dropdownQuestion
|
||||
},
|
||||
computed: {
|
||||
questionText(){
|
||||
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
|
||||
},
|
||||
modelOptions() {
|
||||
const modelAnswers = this.values;
|
||||
const modelAnswersObj ={};
|
||||
if(modelAnswers)
|
||||
{
|
||||
for (let answer of Object.values(modelAnswers)) {
|
||||
if (answer) {
|
||||
modelAnswersObj[answer] = answer;
|
||||
}
|
||||
}
|
||||
}
|
||||
return modelAnswersObj
|
||||
},
|
||||
selectedValue: {
|
||||
get: function() {
|
||||
return this.modelValue
|
||||
},
|
||||
set: function(newValue) {
|
||||
this.$emit("update:modelValue", newValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getNewValues() {
|
||||
const results = await this.updateValues();
|
||||
this.values = results?.data;
|
||||
},
|
||||
initializeComponent(initialData) {
|
||||
this.values = initialData;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
<template>
|
||||
<dropdownQuestion
|
||||
cmsWidgetName="VehicleStyleQuestion"
|
||||
ref="styleQuestion"
|
||||
:options="styleOptions"
|
||||
disableAutoFill
|
||||
placeHolderText="Select an option"
|
||||
validationRules="style-required"
|
||||
inputId="styleQuestionField"
|
||||
v-model="selectedValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
|
||||
import { errorMessages } from "@/constants/error-messages";
|
||||
import { required } from "@/helpers/validation-rules";
|
||||
import { defineRule } from "vee-validate";
|
||||
|
||||
defineRule("style-required", required(errorMessages.STYLE_REQUIRED));
|
||||
|
||||
|
||||
export default {
|
||||
name: "style-question",
|
||||
data() {
|
||||
return {
|
||||
values: [],
|
||||
};
|
||||
},
|
||||
props: {
|
||||
modelValue: String,
|
||||
cmsWidgetName: String,
|
||||
validationRules: String,
|
||||
updateValues: Function,
|
||||
},
|
||||
components: {
|
||||
dropdownQuestion
|
||||
},
|
||||
computed: {
|
||||
questionText(){
|
||||
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
|
||||
},
|
||||
styleOptions() {
|
||||
const styleAnswers = this.values;
|
||||
const styleAnswersObj ={};
|
||||
if(styleAnswers)
|
||||
{
|
||||
for (let answer of Object.values(styleAnswers)) {
|
||||
if (answer) {
|
||||
styleAnswersObj[answer] = answer;
|
||||
}
|
||||
}
|
||||
}
|
||||
return styleAnswersObj
|
||||
},
|
||||
selectedValue: {
|
||||
get: function() {
|
||||
return this.modelValue
|
||||
},
|
||||
set: function(newValue) {
|
||||
this.$emit("update:modelValue", newValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getNewValues() {
|
||||
const results = await this.updateValues();
|
||||
this.values = results?.data;
|
||||
},
|
||||
initializeComponent(initialData) {
|
||||
this.values = initialData;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -9,10 +9,6 @@
|
|||
<div class="col">
|
||||
<div class="select-car-form rounded">
|
||||
<siteSubHeader cmsWidgetName="SiteSubHeaderWidget" class="mt-5" />
|
||||
<!-- <yearQuestion class="px-4 mb-2 mt-4" v-model="selectedYear" ref="yearQuestion" />
|
||||
<makeQuestion class="px-4 mb-2 mt-4" v-model="selectedMake" :updateValues="updateMakeValues" ref="makeQuestion"/>
|
||||
<modelQuestion v-model="selectedModel" :updateValues="updateModelValues" ref="modelQuestion" class="px-4 mb-2 mt-4"/>
|
||||
<styleQuestion v-model="selectedStyle" :updateValues="updateStyleValues" ref="styleQuestion" class="px-4 mb-2 mt-4"/> -->
|
||||
<VehicleQuestion class="px-4 mb-2 mt-4" v-model="selectedYear" ref="VehicleyearQuestion" cmsWidgetName="VehicleYearQuestion" :options="years" validationRules="year-required" inputId="yearQuestionField"/>
|
||||
<VehicleQuestion class="px-4 mb-2 mt-4" v-model="selectedMake" ref="VehiclemakeQuestion" :updateValues="updateMakeValues" cmsWidgetName="VehicleMakeQuestion" validationRules="make-required" inputId="makeQuestionField"/>
|
||||
<VehicleQuestion class="px-4 mb-2 mt-4" v-model="selectedModel" ref="VehiclemodelQuestion" cmsWidgetName="VehicleModelQuestion" :updateValues="updateModelValues" validationRules="model-required" inputId="modelQuestionField"/>
|
||||
|
|
@ -42,10 +38,6 @@ import siteFooter from "@/iss-components/site-footer/site-footer";
|
|||
import siteSubHeader from "@/iss-components/site-sub-header/site-sub-header";
|
||||
import vehicleBanner from "@/iss-components/vehicle-banner/vehicle-banner";
|
||||
import VehicleQuestion from "@/iss-components/vehicle-question/vehicle-question";
|
||||
// import yearQuestion from "@/layouts/vehicle-selection/year-question/year-question";
|
||||
// import makeQuestion from "@/layouts/vehicle-selection/make-question/make-question";
|
||||
// import modelQuestion from "@/layouts/vehicle-selection/model-question/model-question";
|
||||
// import styleQuestion from "@/layouts/vehicle-selection/style-question/style-question";
|
||||
|
||||
// Supporting files
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
|
|
@ -81,9 +73,6 @@ props:{
|
|||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
const yearQuestionInitialDataPromise = VehicleQuestion.methods.loadInitialData();
|
||||
// const makeQuestionInitialDataPromise = makeQuestion.methods.getNewValues();
|
||||
// const modelQuestionInitialDataPromise = modelQuestion.methods.getNewValues();
|
||||
// const styleQuestionInitialDataPromise = styleQuestion.methods.getNewValues();
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
|
|
@ -95,18 +84,6 @@ props:{
|
|||
resultKey: "yearQuestionInitialData",
|
||||
promise: yearQuestionInitialDataPromise,
|
||||
},
|
||||
// {
|
||||
// resultKey: "makeQuestionInitialData",
|
||||
// promise: makeQuestionInitialDataPromise,
|
||||
// },
|
||||
// {
|
||||
// resultKey: "modelQuestionInitialData",
|
||||
// promise: modelQuestionInitialDataPromise,
|
||||
// },
|
||||
// {
|
||||
// resultKey: "styleQuestionInitialData",
|
||||
// promise: styleQuestionInitialDataPromise,
|
||||
// },
|
||||
|
||||
];
|
||||
|
||||
|
|
@ -116,19 +93,6 @@ props:{
|
|||
next((vm) => {
|
||||
vm.years = resultMap.yearQuestionInitialData;
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
// vm.$refs.VehicleQuestion.initializeComponent(
|
||||
// resultMap.yearQuestionInitialData
|
||||
// );
|
||||
// vm.$refs.makeQuestion.initializeComponent(
|
||||
// resultMap.makeQuestionInitialData
|
||||
// );
|
||||
|
||||
// vm.$refs.modelQuestion.initializeComponent(
|
||||
// resultMap.modelQuestionInitialData
|
||||
// );
|
||||
// vm.$refs.styleQuestion.initializeComponent(
|
||||
// resultMap.styleQuestionInitialData
|
||||
// );
|
||||
});
|
||||
|
||||
},
|
||||
|
|
@ -137,18 +101,16 @@ props:{
|
|||
const parsedYearIndex = parseInt(yearIndex);
|
||||
this.mainStore.updateVehicleYear( this.years[parsedYearIndex] );
|
||||
|
||||
this.$refs["VehicleQuestion"].getNewValues();
|
||||
this.$refs["VehiclemakeQuestion"].getNewValues();
|
||||
|
||||
},
|
||||
selectedMake(make) {
|
||||
this.mainStore.updateVehicleMake( make );
|
||||
this.$refs["VehicleQuestion"].getNewValues();
|
||||
//this.$refs["modelQuestion"].getNewValues();
|
||||
this.$refs["VehiclemodelQuestion"].getNewValues();
|
||||
},
|
||||
selectedModel(model) {
|
||||
this.mainStore.updateVehicleModel( model );
|
||||
this.$refs["VehicleQuestion"].getNewValues();
|
||||
//this.$refs["styleQuestion"].getNewValues();
|
||||
this.$refs["VehiclestyleQuestion"].getNewValues();
|
||||
},
|
||||
selectedStyle(style) {
|
||||
this.mainStore.updateVehicleStyle( style );
|
||||
|
|
@ -157,7 +119,6 @@ props:{
|
|||
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
|
||||
return true;
|
||||
},
|
||||
backButtonAction() {
|
||||
|
|
@ -186,16 +147,12 @@ props:{
|
|||
},
|
||||
},
|
||||
components: {
|
||||
// yearQuestion,
|
||||
// makeQuestion,
|
||||
// modelQuestion,
|
||||
siteHeader,
|
||||
siteSubHeader,
|
||||
vehicleBanner,
|
||||
siteFooter,
|
||||
Form,
|
||||
VehicleQuestion
|
||||
//styleQuestion,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
<template>
|
||||
<dropdownQuestion
|
||||
cmsWidgetName="VehicleYearQuestion"
|
||||
ref="yearQuestion"
|
||||
:options="years"
|
||||
disableAutoFill
|
||||
inputId="yearQuestionField"
|
||||
placeHolderText="Select an option"
|
||||
validationRules="year-required"
|
||||
v-model="selectedValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { useMainStore } from '@/store';
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
|
||||
|
||||
import { errorMessages } from "@/constants/error-messages";
|
||||
import { required } from "@/helpers/validation-rules";
|
||||
import { defineRule } from "vee-validate";
|
||||
|
||||
defineRule("year-required", required(errorMessages.YEAR_REQUIRED));
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: "year-question",
|
||||
data() {
|
||||
return {
|
||||
years : Array,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
modelValue: Number,
|
||||
cmsWidgetName: String,
|
||||
},
|
||||
components: {
|
||||
dropdownQuestion
|
||||
},
|
||||
computed: {
|
||||
questionText(){
|
||||
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
|
||||
},
|
||||
selectedValue: {
|
||||
get: function() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set: function(newValue) {
|
||||
this.$emit("update:modelValue",newValue);
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadInitialData() {
|
||||
return useMainStore().getVehicleYears();
|
||||
},
|
||||
initializeComponent(initialData) {
|
||||
this.years = initialData;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Loading…
Reference in a new issue