csr-269 wip
This commit is contained in:
parent
c824402a4a
commit
e2bfed2b36
3 changed files with 94 additions and 60 deletions
|
|
@ -30,6 +30,9 @@ defineRule("replace-options-required", (value) => {
|
||||||
|
|
||||||
export default ({
|
export default ({
|
||||||
name: "replaceOptionsQuestion",
|
name: "replaceOptionsQuestion",
|
||||||
|
updated() {
|
||||||
|
console.log("ro:modelValue=>" + this.modelValue);
|
||||||
|
},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
questionText: String,
|
questionText: String,
|
||||||
|
|
@ -48,6 +51,7 @@ export default ({
|
||||||
this.questionText = cmsContent.QuestionText;
|
this.questionText = cmsContent.QuestionText;
|
||||||
this.answersFromCms = cmsContent.Answers;
|
this.answersFromCms = cmsContent.Answers;
|
||||||
this.replaceOptions = replaceOptions;
|
this.replaceOptions = replaceOptions;
|
||||||
|
console.log("ro:" + this.questionText);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -56,6 +60,7 @@ export default ({
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
set: function(newValue) {
|
set: function(newValue) {
|
||||||
|
console.log("ro:newVal=>" + newValue);
|
||||||
this.$emit("update:modelValue", newValue);
|
this.$emit("update:modelValue", newValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -64,7 +69,8 @@ export default ({
|
||||||
? this.answersFromCms.filter(ans =>
|
? this.answersFromCms.filter(ans =>
|
||||||
{
|
{
|
||||||
const name = ans.Name.split('-');
|
const name = ans.Name.split('-');
|
||||||
return this.filterByVehicleCategory ? name[0].toUpperCase() === store.getters.vehicle.category : name[0].toUpperCase() === store.getters.vehicle.category && this.replaceOptions.includes(name[1])
|
return this.filterByVehicleCategory ? name[0].toUpperCase() === store.getters.vehicle.category && this.replaceOptions.includes(name[1]) :
|
||||||
|
this.replaceOptions.includes(ans.Name)
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,12 @@
|
||||||
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage=false />
|
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage=false />
|
||||||
<funnelSubHeader ref="funnelSubHeader" />
|
<funnelSubHeader ref="funnelSubHeader" />
|
||||||
<damageLocationQuestion ref="damageLocation" v-model="selectedDamageLocations" groupName="DamageLocationQuestion" />
|
<damageLocationQuestion ref="damageLocation" v-model="selectedDamageLocations" groupName="DamageLocationQuestion" />
|
||||||
<replaceOptionsQuestion ref="driverSideOptions" isAvailable v-model="driverSideOptionsData" groupName="DriverSideReplaceOptionsQuestion" />
|
<replaceOptionsQuestion ref="driverSideOptions" isAvailable filterByVehicleCategory v-model="driverSideOptionsData" groupName="DriverSideReplaceOptionsQuestion" />
|
||||||
|
<windshieldOptions ref="windshieldOptions"
|
||||||
|
v-model="selectedWindshieldOptions"
|
||||||
|
:selectedDamageLocations="selectedDamageLocations"
|
||||||
|
/>
|
||||||
<funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" />
|
<funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" />
|
||||||
<windshieldOptions ref="windshieldOptions" v-model="selectedWindshieldOptions" :selectedDamageLocations="selectedDamageLocations" :selectedChipCount="selectedChipCount" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -18,7 +21,7 @@ import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
||||||
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
||||||
import replaceOptionsQuestion from"@/layouts/vehicle-damage/replace-options-question/replace-options-question";
|
import replaceOptionsQuestion from"@/layouts/vehicle-damage/replace-options-question/replace-options-question";
|
||||||
import damageLocationQuestion from"@/layouts/vehicle-damage/damage-location-question/damage-location-question";
|
import damageLocationQuestion from"@/layouts/vehicle-damage/damage-location-question/damage-location-question";
|
||||||
import windshieldOptions from"@/layouts/vehicle-damage/windshield-options/windshield-options";
|
import windshieldOptions from "@/layouts/vehicle-damage/windshield-options/windshield-options";
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
|
|
@ -30,8 +33,12 @@ import baseMixin from "@/mixins/base-mixin";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "vehicle-damage",
|
name: "vehicle-damage",
|
||||||
|
updated() {
|
||||||
|
console.log("vd:selectedWindshieldChipCount=>" + this.selectedWindshieldOptions.selectedWindshieldChipCount);
|
||||||
|
console.log("vd:selectedWindshieldDamageType=>" + this.selectedWindshieldOptions.selectedWindshieldDamageType);
|
||||||
|
console.log("vd:selectedWindshieldReplaceOptions=>" + this.selectedWindshieldOptions.selectedWindshieldReplaceOptions);
|
||||||
|
},
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
console.log("vd: beforeRoute");
|
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
const damageOptionsPromise =
|
const damageOptionsPromise =
|
||||||
|
|
@ -52,12 +59,10 @@ export default {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
console.log("vd: before settle");
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
console.log("vd: after settle");
|
|
||||||
// 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) => {
|
||||||
console.log("vd: next");
|
|
||||||
vm.$refs.funnelHeader.initializeComponent(
|
vm.$refs.funnelHeader.initializeComponent(
|
||||||
resultMap.cmsContent.FunnelHeaderWidget
|
resultMap.cmsContent.FunnelHeaderWidget
|
||||||
);
|
);
|
||||||
|
|
@ -73,13 +78,12 @@ export default {
|
||||||
vm.$refs.damageLocation.initializeComponent(
|
vm.$refs.damageLocation.initializeComponent(
|
||||||
resultMap.cmsContent.DamageLocationQuestion, resultMap.damageOptions
|
resultMap.cmsContent.DamageLocationQuestion, resultMap.damageOptions
|
||||||
);
|
);
|
||||||
vm.$refs.funnelFooter.initializeComponent(
|
|
||||||
resultMap.cmsContent.FunnelFooterWidget
|
|
||||||
);
|
|
||||||
console.log("vd: initialize wo");
|
|
||||||
vm.$refs.windshieldOptions.initializeComponent(
|
vm.$refs.windshieldOptions.initializeComponent(
|
||||||
resultMap.cmsContent.WindshieldDamageTypeQuestion, resultMap.cmsContent.WindshieldChipCountQuestion,
|
resultMap.cmsContent.WindshieldDamageTypeQuestion, resultMap.cmsContent.WindshieldChipCountQuestion,
|
||||||
resultMap.cmsContent.WindshieldReplaceOptionsQuestion
|
resultMap.cmsContent.WindshieldReplaceOptionsQuestion, resultMap.damageOptions.windshieldOptions.availableReplacementOptions
|
||||||
|
);
|
||||||
|
vm.$refs.funnelFooter.initializeComponent(
|
||||||
|
resultMap.cmsContent.FunnelFooterWidget
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -87,8 +91,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
selectedDamageLocations: [],
|
selectedDamageLocations: [],
|
||||||
driverSideOptionsData: [],
|
driverSideOptionsData: [],
|
||||||
selectedWindshieldOptions: [],
|
selectedWindshieldOptions: []
|
||||||
selectedChipCount: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -107,15 +110,6 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
//computed: {
|
|
||||||
// selectedWindshieldDamageType(){
|
|
||||||
// return this.modelValue.some(selectedDamages =>
|
|
||||||
// {
|
|
||||||
// const categoryAndGlass = selectedDamages.split('-'); //ie: model looks like "Suv-Windshield" so this Splits the answers into [0]"Suv" [1]"Windshield"
|
|
||||||
// return Boolean(categoryAndGlass[1].toUpperCase() === "WINDSHIELD");
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
//},
|
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
funnelFooter,
|
funnelFooter,
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,42 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<div class="windshield-options">
|
<div class="windshield-options" aria-live="polite">
|
||||||
<!-- <windshieldDamageTypeQuestion ref="windshieldDamageTypeQuestion"
|
<windshieldDamageTypeQuestion ref="windshieldDamageTypeQuestion"
|
||||||
v-if="isWindshieldDamageLocation"
|
v-if="isWindshieldDamageLocation"
|
||||||
:questionText="questionText"
|
:questionText="questionText"
|
||||||
:answersFromCms="answersFromCms"
|
:answersFromCms="answersFromCms"
|
||||||
|
:suppressError="suppressError"
|
||||||
groupName="WindshieldDamageTypeQuestion"
|
groupName="WindshieldDamageTypeQuestion"
|
||||||
v-model="selectedValues"
|
v-model="selectedWindshieldDamageTypeValues"
|
||||||
/>
|
/>
|
||||||
<windshieldChipCountQuestion ref="windshieldChipCountQuestion"
|
<windshieldChipCountQuestion ref="windshieldChipCountQuestion"
|
||||||
v-if="isWindshieldDamageLocation && isRepairOptionSelected"
|
v-if="isWindshieldDamageLocation && isRepairOptionSelected"
|
||||||
:questionText="chipCountQuestionText"
|
:questionText="chipCountQuestionText"
|
||||||
:answersFromCms="chipCountAnswersFromCms"
|
:answersFromCms="chipCountAnswersFromCms"
|
||||||
groupName="WindshieldChipCountQuestion"
|
groupName="WindshieldChipCountQuestion"
|
||||||
v-model="selectedChipCountValues"
|
v-model="selectedWindshieldChipCountValues"
|
||||||
/> -->
|
/>
|
||||||
<replaceOptionsQuestion :ref="replaceOptionsQuestion"
|
<replaceOptionsQuestion ref="replaceOptionsQuestion"
|
||||||
v-if="isWindshieldDamageLocation"
|
|
||||||
isAvailable
|
isAvailable
|
||||||
:questionText="replaceOptionsQuestionText"
|
groupName="WindshieldReplaceOptions"
|
||||||
:answersFromCms="replaceOptionsAnswersFromCms"
|
v-model="selectedWindshieldReplaceOptionsValues"
|
||||||
groupName="WindshieldChipCountQuestion"
|
|
||||||
v-model="selectedReplaceOptions"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import windshieldDamageTypeQuestion from "@/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question";
|
import windshieldDamageTypeQuestion from"@/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question";
|
||||||
import windshieldChipCountQuestion from "@/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question";
|
import windshieldChipCountQuestion from"@/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question";
|
||||||
import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-question/replace-options-question";
|
import replaceOptionsQuestion from"@/layouts/vehicle-damage/replace-options-question/replace-options-question";
|
||||||
export default ({
|
export default ({
|
||||||
name: "windshieldOptions",
|
name: "windshieldOptions",
|
||||||
|
updated() {
|
||||||
|
console.log("wo:isWindshieldDamageLocation=>" + this.isWindshieldDamageLocation);
|
||||||
|
console.log("wo:selectedWindshieldDamageTypeValues=>" + this.selectedWindshieldDamageTypeValues);
|
||||||
|
// if (this.isReplaceOptionSelected)
|
||||||
|
// this.$options.components.replaceOptionsQuestion.methods.initializeComponent(this.wsrFromCms, this.wsrOptions);
|
||||||
|
},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
questionText: String,
|
questionText: String,
|
||||||
|
|
@ -41,6 +45,14 @@ export default ({
|
||||||
chipCountAnswersFromCms: Array,
|
chipCountAnswersFromCms: Array,
|
||||||
replaceOptionsQuestionText: String,
|
replaceOptionsQuestionText: String,
|
||||||
replaceOptionsAnswersFromCms: Array,
|
replaceOptionsAnswersFromCms: Array,
|
||||||
|
availableReplacementOptions: Array,
|
||||||
|
// wsrFromCms: Array,
|
||||||
|
// wsrOptions: Array,
|
||||||
|
sro:[],
|
||||||
|
|
||||||
|
selectedWindshieldDamageType: null,
|
||||||
|
selectedWindshieldChipCount: null,
|
||||||
|
selectedWindshieldReplaceOptions: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -48,16 +60,13 @@ export default ({
|
||||||
modelValue: Array,
|
modelValue: Array,
|
||||||
selectedDamageLocations: Array,
|
selectedDamageLocations: Array,
|
||||||
selectedChipCount: Array,
|
selectedChipCount: Array,
|
||||||
selectedReplaceOptions: Array
|
selectedReplaceOptions: Array,
|
||||||
|
suppressError: Boolean
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
|
|
||||||
|
|
||||||
console.log(this);
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
initializeComponent(windshieldDamageTypeQuestionFromCms, windshieldChipCountQuestionFromCms,
|
initializeComponent(windshieldDamageTypeQuestionFromCms, windshieldChipCountQuestionFromCms,
|
||||||
windshieldReplaceOptionsQuestionFromCms){
|
windshieldReplaceOptionsQuestionFromCms, windshieldAvailableReplacementOptions){
|
||||||
this.questionText = windshieldDamageTypeQuestionFromCms.QuestionText;
|
this.questionText = windshieldDamageTypeQuestionFromCms.QuestionText;
|
||||||
this.answersFromCms = windshieldDamageTypeQuestionFromCms.Answers;
|
this.answersFromCms = windshieldDamageTypeQuestionFromCms.Answers;
|
||||||
|
|
||||||
|
|
@ -67,11 +76,19 @@ console.log(this);
|
||||||
this.replaceOptionsQuestionText = windshieldReplaceOptionsQuestionFromCms.QuestionText;
|
this.replaceOptionsQuestionText = windshieldReplaceOptionsQuestionFromCms.QuestionText;
|
||||||
this.replaceOptionsAnswersFromCms = windshieldReplaceOptionsQuestionFromCms.Answers;
|
this.replaceOptionsAnswersFromCms = windshieldReplaceOptionsQuestionFromCms.Answers;
|
||||||
|
|
||||||
//console.log(this.$refs.replaceOptionsQuestion);
|
this.wsrFromCms = windshieldReplaceOptionsQuestionFromCms;
|
||||||
|
this.wsrOptions = windshieldAvailableReplacementOptions;
|
||||||
|
|
||||||
//this.$refs.windshieldDamageTypeQuestion.initializeComponent(this.questionText, this.answersFromCms);
|
//this.$refs.windshieldDamageTypeQuestion.initializeComponent(this.questionText, this.answersFromCms);
|
||||||
// this.$refs.replaceOptionsQuestion.initializeComponent(windshieldReplaceOptionsQuestionFromCms.QuestionText, windshieldReplaceOptionsQuestionFromCms.Answers)
|
this.$options.components.replaceOptionsQuestion.methods.initializeComponent(windshieldReplaceOptionsQuestionFromCms, windshieldAvailableReplacementOptions);
|
||||||
}
|
},
|
||||||
|
getWindshieldOptions(selectedWindshieldDamageType, selectedWindshieldChipCount, selectedWindshieldReplaceOptions){
|
||||||
|
return {
|
||||||
|
selectedWindshieldDamageType: selectedWindshieldDamageType,
|
||||||
|
selectedWindshieldChipCount: selectedWindshieldChipCount,
|
||||||
|
selectedWindshieldReplaceOptions: selectedWindshieldReplaceOptions
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
selectedValues: {
|
selectedValues: {
|
||||||
|
|
@ -79,35 +96,54 @@ console.log(this);
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
set: function(newValue) {
|
set: function(newValue) {
|
||||||
|
//console.log("oldval=>" + this.modelValue);
|
||||||
this.$emit("update:modelValue", newValue);
|
this.$emit("update:modelValue", newValue);
|
||||||
|
// this.$options.components.replaceOptionsQuestion2.methods.initializeComponent(this.wsrFromCms, this.wsrOptions);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectedChipCountValues: {
|
selectedWindshieldDamageTypeValues:{
|
||||||
get: function() {
|
get: function() {
|
||||||
return this.selectedChipCount;
|
return this.selectedValues.selectedWindshieldDamageType;
|
||||||
},
|
},
|
||||||
set: function(newValue) {
|
set: function(newValue) {
|
||||||
this.$emit("update:selectedChipCount", newValue);
|
this.selectedValues = this.getWindshieldOptions(newValue, this.selectedWindshieldChipCountValues, this.selectedWindshieldReplaceOptionsValues);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectedReplaceOptionsValues: {
|
selectedWindshieldChipCountValues: {
|
||||||
get: function() {
|
get: function() {
|
||||||
return this.selectedReplaceOptions;
|
return this.selectedValues.selectedChipCount;
|
||||||
},
|
},
|
||||||
set: function(newValue) {
|
set: function(newValue) {
|
||||||
this.$emit("update:selectedReplaceOptions", newValue);
|
this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValues, newValue, this.selectedWindshieldReplaceOptionsValues);
|
||||||
|
//console.log("here=>" + newValue);
|
||||||
|
//this.$emit("update:selectedChipCount", newValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isWindshieldDamageLocation(){
|
selectedWindshieldReplaceOptionsValues: {
|
||||||
|
get: function() {
|
||||||
|
return this.selectedValues.selectedWindshieldReplaceOptions;
|
||||||
|
},
|
||||||
|
set: function(newValue) {
|
||||||
|
this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValues, this.selectedWindshieldChipCountValues, newValue);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isWindshieldDamageLocation() {
|
||||||
return this.selectedDamageLocations.some(selectedDamages =>
|
return this.selectedDamageLocations.some(selectedDamages =>
|
||||||
{
|
{
|
||||||
const categoryAndGlass = selectedDamages.split('-'); //ie: selectedDamageLocations looks like "Suv-Windshield" so this Splits the answers into [0]"Suv" [1]"Windshield"
|
const categoryAndGlass = selectedDamages.split('-'); //ie: "Suv-Windshield" Splits the answers into [0]"Suv" [1]"Windshield"
|
||||||
return Boolean(categoryAndGlass[1].toUpperCase() === "WINDSHIELD");
|
return Boolean(categoryAndGlass[1].toUpperCase() === "WINDSHIELD");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
isRepairOptionSelected(){
|
isRepairOptionSelected(){
|
||||||
return this.modelValue.some(val => val.toUpperCase() === "REPAIR");
|
if (this.selectedWindshieldDamageTypeValues === undefined) return false;
|
||||||
|
|
||||||
|
return this.selectedWindshieldDamageTypeValues.some(val => val.toUpperCase() === "REPAIR");
|
||||||
},
|
},
|
||||||
|
// isReplaceOptionSelected(){
|
||||||
|
// if (this.selectedWindshieldDamageTypeValues === undefined) return false;
|
||||||
|
|
||||||
|
// return this.selectedWindshieldDamageTypeValues.some(val => val.toUpperCase() === "REPLACE");
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
windshieldDamageTypeQuestion,
|
windshieldDamageTypeQuestion,
|
||||||
|
|
@ -115,6 +151,4 @@ console.log(this);
|
||||||
replaceOptionsQuestion
|
replaceOptionsQuestion
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
suppressError: Boolean,
|
|
||||||
Loading…
Reference in a new issue