persist data and refactor navigation
This commit is contained in:
parent
355c41f8e3
commit
cbda03beba
2 changed files with 38 additions and 13 deletions
|
|
@ -47,6 +47,7 @@ import { required } from "@/helpers/validation-rules";
|
|||
import { errorMessages } from "@/constants/error-messages";
|
||||
import buttonQuestion from "@/digital-components/button-question/button-question";
|
||||
import contentGroupModal from "@/iss-components/content-group-modal/content-group-modal";
|
||||
import { issPageValues } from "@/router/router-constants/issPage-values";
|
||||
|
||||
// Import Component
|
||||
import baseFormMixin from "@/mixins/base-form-mixin";
|
||||
|
|
@ -61,6 +62,7 @@ import shopPreferenceModal from "@/layouts/provider-preference/shop-preference-m
|
|||
|
||||
// DEFINE VALIDATION RULES
|
||||
defineRule('option-required', required(errorMessages.OPTION_REQUIRED));
|
||||
const options = { SAFELITE: 'SafeliteOption', TPA: 'TPAOption' };
|
||||
|
||||
export default {
|
||||
name: "provider-preference",
|
||||
|
|
@ -81,7 +83,8 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
selectedProvider : null,
|
||||
showSteeringLink: false
|
||||
showSteeringLink: false,
|
||||
tpaAcknowledgement: false,
|
||||
};
|
||||
},
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
|
|
@ -105,10 +108,10 @@ export default {
|
|||
prefAnswers() {
|
||||
const cmsAnswersContent = [
|
||||
{
|
||||
cmsWidgetName: 'SafeliteOption'
|
||||
cmsWidgetName: options.SAFELITE
|
||||
},
|
||||
{
|
||||
cmsWidgetName: 'TPAOption'
|
||||
cmsWidgetName: options.TPA
|
||||
}
|
||||
];
|
||||
//if cms content has not yet loaded, skip
|
||||
|
|
@ -149,14 +152,29 @@ export default {
|
|||
backButtonAction() {
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||
},
|
||||
navigateForward(scenario){
|
||||
this.$router.navigate(scenario, this.$route);
|
||||
},
|
||||
forwardButtonAction() {
|
||||
if(this.selectedProvider.toLowerCase() == "safeliteoption")
|
||||
{
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE, this.$route);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_TPA, this.$route);
|
||||
if(this.selectedProvider) {
|
||||
switch (this.selectedProvider) {
|
||||
case options.SAFELITE:
|
||||
this.navigateForward(this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE);
|
||||
break;
|
||||
case options.TPA:
|
||||
if(this.mainStore.hasRecalibrationPart)
|
||||
{
|
||||
//open tpa adas modal here, else save selection and navigate forward
|
||||
console.log('add tpa modal code');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.navigateForward(this.navigationScenarios.CLICKED_FORWARD_WITH_TPA);
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.mainStore.saveProviderPreferenceData({selectedProvider: this.selectedProvider, tpaAcknowledgement: this.tpaAcknowledgement});
|
||||
}
|
||||
},
|
||||
openStateSteeringModal() {
|
||||
|
|
@ -164,17 +182,21 @@ export default {
|
|||
},
|
||||
setShowSteeringLink() {
|
||||
const bodyText = this.$refs["StateSteeringModal"]?.ModalBodyText;
|
||||
console.log(bodyText)
|
||||
console.log(!!bodyText)
|
||||
this.showSteeringLink = !!bodyText;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
setupModalLinks(this);
|
||||
this.setShowSteeringLink();
|
||||
|
||||
const pageData = this.mainStore.pageData(issPageValues.PROVIDER_PREFERENCE);
|
||||
this.selectedProvider = pageData?.selectedProvider ? pageData.selectedProvider : null;
|
||||
this.tpaAcknowledgement = pageData?.tpaAcknowledgement ? pageData.tpaAcknowledgement : false;
|
||||
|
||||
if(this.showSteeringLink) {
|
||||
this.openStateSteeringModal();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ const getDefaultState = () => {
|
|||
}
|
||||
},
|
||||
referralNumber: null,
|
||||
referralDate: null
|
||||
referralDate: null,
|
||||
},
|
||||
applicationUser: {
|
||||
experiments: [],
|
||||
|
|
@ -939,6 +939,9 @@ export const useMainStore = defineStore({
|
|||
saveVaps(vaps) {
|
||||
this.order.lineItems.vaps = vaps;
|
||||
},
|
||||
saveProviderPreferenceData(data){
|
||||
this.updatePageData({ page: issPageValues.PROVIDER_PREFERENCE, data: data});
|
||||
},
|
||||
addEventToBus (event) {
|
||||
this.applicationUser.eventBus.push(event);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue