This commit is contained in:
Kulbhushan Kaushik 2023-01-18 07:36:19 -05:00
parent 87bd5205fe
commit 9b470eb959
2 changed files with 39 additions and 10 deletions

View file

@ -145,6 +145,7 @@
import { required, regex } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages";
import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { useMainStore } from '@/store';
//define validation rules
defineRule("loss-date-required", required(errorMessages.LOSS_DATE_REQUIRED));
@ -177,7 +178,6 @@
data() {
return {
policyNumber: "",
policyZipCode: "",
dateOfLoss: "",
damageCause: "",
damageState: "",
@ -187,6 +187,10 @@
email: ""
};
},
setup() {
const mainStore = useMainStore();
return { mainStore };
},
async beforeRouteEnter(to, from, next)
{
// Call APIs
@ -210,6 +214,18 @@
methods:
{
async forwardButtonAction() {
const welcomePageModel = JSON.stringify({
PolicyNumber: this.policyNumber,
DateOfLoss: this.dateOfLoss,
DamageCause: this.damageCause,
DamageState: this.damageState,
DamageCity: this.damageCity,
IsDamageGlassOnly: this.isDamageGlassOnly,
PhoneNumber: this.phoneNumber,
Email: this.email
});
this.mainStore.updatePolicyData(welcomePageModel);
return this.navigateForward();
},
@ -299,14 +315,6 @@
};
},
},
welcomePageModel: {
get: function () {
return this.modelValue;
},
set: function (newValue) {
this.$emit("update:modelValue", newValue);
},
},
},
components: {
siteHeader,

View file

@ -41,6 +41,16 @@ const getDefaultState = () => {
moldingQuestionAnswers: null,
capabilityQuestionAnswers: null,
},
policy:{
policyNumber: null,
dateOfLoss: null,
damageCause: null,
damageState: null,
damageCity: null,
isDamageGlassOnly: null,
phoneNumber: null,
email: null,
},
serviceLocation: {
address: null,
city: null,
@ -541,7 +551,18 @@ export const useMainStore = defineStore({
updatePageData(pageData) {
this.applicationUser.pageData[pageData.page] = pageData.data;
},
updatePolicyData(welcomePageModel)
{
const welcomePageData = JSON.parse(welcomePageModel);
this.order.policy.policyNumber = welcomePageData.PolicyNumber;
this.order.policy.dateOfLoss = welcomePageData.DateOfLoss;
this.order.policy.damageCause = welcomePageData.DamageCause;
this.order.policy.damageState = welcomePageData.DamageState;
this.order.policy.damageCity = welcomePageData.DamageCity;
this.order.policy.isDamageGlassOnly = welcomePageData.IsDamageGlassOnly;
this.order.policy.phoneNumber = welcomePageData.PhoneNumber;
this.order.policy.email = welcomePageData.Email;
},
savePartQuestionAnswers(partQuestionAnswersArray) {
// if part question answers have changed, reset subsequent question answers
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(