CSR-726 | Create cashOrInsuranceQuestion component
This commit is contained in:
parent
63ec72c1ac
commit
c2c5f17ef7
3 changed files with 60 additions and 45 deletions
|
|
@ -0,0 +1,45 @@
|
||||||
|
<template>
|
||||||
|
<div class="cash-or-insurance-question">
|
||||||
|
<buttonQuestion
|
||||||
|
:answers="answersFromCms"
|
||||||
|
:groupName="groupName"
|
||||||
|
buttonType="listButtonHorizontal"
|
||||||
|
v-model="selectedValues"
|
||||||
|
isCashOrInsurance
|
||||||
|
isRequired
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import buttonQuestion from "@/common-components/button-question/button-question";
|
||||||
|
|
||||||
|
export default ({
|
||||||
|
name: "cashOrInsuranceQuestion",
|
||||||
|
props: {
|
||||||
|
modelValue: String,
|
||||||
|
groupName: String,
|
||||||
|
cmsWidgetName: String,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
answersFromCms(){
|
||||||
|
return this.getCmsContent(this.cmsWidgetName, 'Answers');
|
||||||
|
},
|
||||||
|
selectedValues: {
|
||||||
|
get: function() {
|
||||||
|
// Convert to CMS answer name from bool
|
||||||
|
var cmsAnswerValue = this.modelValue ? "InsuranceAnswer" : "CashAnswer";
|
||||||
|
// list-button-horizontal expects an array of values
|
||||||
|
return [cmsAnswerValue];
|
||||||
|
},
|
||||||
|
set: function(newValue) {
|
||||||
|
// Convert back to bool for parent component
|
||||||
|
this.$emit("update:modelValue", newValue === "InsuranceAnswer");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
buttonQuestion,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -11,22 +11,12 @@
|
||||||
<vehicleBanner cmsWidgetName="VehicleBannerWidget" :displayGenericVehicleImage=false />
|
<vehicleBanner cmsWidgetName="VehicleBannerWidget" :displayGenericVehicleImage=false />
|
||||||
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
||||||
<div class="fade-on-route-transition sub-container make-tall">
|
<div class="fade-on-route-transition sub-container make-tall">
|
||||||
<buttonQuestion
|
<cashOrInsuranceQuestion
|
||||||
:answers="years"
|
ref="cashOrInsurance"
|
||||||
text-position="text-start"
|
cmsWidgetName="CashOrInsuranceQuestionWidget"
|
||||||
questionText="List Button as Radio"
|
v-model="isInsurance"
|
||||||
groupName="years"
|
groupName="CashOrInsuranceQuestion"
|
||||||
/>
|
/>
|
||||||
<buttonQuestion
|
|
||||||
questionText="CASH OR INSURANCE"
|
|
||||||
:answers="answersFromCms"
|
|
||||||
groupName="cash-or-insurance"
|
|
||||||
buttonType="listButtonHorizontal"
|
|
||||||
useTextForValue
|
|
||||||
isCashOrInsurance
|
|
||||||
isRequired
|
|
||||||
/>
|
|
||||||
<radio/>
|
|
||||||
<funnel-footer
|
<funnel-footer
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
|
|
@ -41,24 +31,15 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
import buttonQuestion from "@/common-components/button-question/button-question";
|
|
||||||
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
||||||
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
|
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
|
||||||
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
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 cashOrInsuranceQuestion from "./cash-or-insurance-question/cash-or-insurance-question";
|
||||||
|
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { Form } from "vee-validate";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
|
||||||
import { Form, defineRule } from "vee-validate";
|
|
||||||
import { required } from "@/helpers/validation-rules";
|
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
|
||||||
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
|
|
||||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
|
||||||
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
|
||||||
|
|
||||||
import store from "@/store";
|
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "quote",
|
name: "quote",
|
||||||
|
|
@ -71,34 +52,23 @@ export default {
|
||||||
vm.setCmsContent(cmsContent);
|
vm.setCmsContent(cmsContent);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
isInsurance: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() { // Need to learn more about how this functions
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
years() {
|
|
||||||
return ["2011", "2012"];
|
|
||||||
},
|
|
||||||
answersFromCms() {
|
|
||||||
return ["Pay on my own", "Pay with insurance"];
|
|
||||||
},
|
|
||||||
selectedChipCountValues: {
|
|
||||||
get: function() {
|
|
||||||
return this.modelValue;
|
|
||||||
},
|
|
||||||
set: function(newValue) {
|
|
||||||
this.$emit("update:modelValue", newValue);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
funnelFooter,
|
funnelFooter,
|
||||||
vehicleBanner,
|
vehicleBanner,
|
||||||
funnelSubHeader,
|
funnelSubHeader,
|
||||||
Form,
|
Form,
|
||||||
buttonQuestion
|
cashOrInsuranceQuestion
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue