CASH-2844 save fields need for work order submission

CASH-2844 save fields need for work order submission
This commit is contained in:
Carl Nation 2026-06-09 20:43:56 -04:00
parent af1cd602a3
commit 212b51bace
13 changed files with 120 additions and 66 deletions

View file

@ -3,29 +3,48 @@ import store from "@/store";
import { dynamicStrings } from "@/constants/dynamic-strings";
export function fetchCmsContentForPage(fmgPage) {
return store.dispatch(storeActions.GET_PAGE_DATA, { pageName: fmgPage }).then((response) => {
const pageDataFromCms = {};
return store
.dispatch(storeActions.GET_PAGE_DATA, { pageName: fmgPage })
.then((response) => {
const pageDataFromCms = {};
response.data.Result.forEach((widget) => {
let widgetWithReplacements = findAndReplaceGlobalStateValues(widget.Model, widget.Name);
response.data.Result.forEach((widget) => {
let widgetWithReplacements = findAndReplaceGlobalStateValues(
widget.Model,
widget.Name
);
// If we already have this widget, push it on the collection
if (widgetWithReplacements.Name in pageDataFromCms) {
pageDataFromCms[widgetWithReplacements.Name].push(widgetWithReplacements.Model);
return;
// If we already have this widget, push it on the collection
if (widgetWithReplacements.Name in pageDataFromCms) {
pageDataFromCms[widgetWithReplacements.Name].push(widgetWithReplacements.Model);
return;
}
pageDataFromCms[widgetWithReplacements.Name] = [widgetWithReplacements.Model];
});
Object.keys(pageDataFromCms).forEach((key) => {
if (pageDataFromCms[key].length === 1) {
pageDataFromCms[key] = pageDataFromCms[key][0];
}
});
return pageDataFromCms;
})
.catch((error) => {
// Client-specific config pages are optional. When one doesn't exist
// the CMS returns a 404 - treat that as "no overrides" instead of an
// error so callers receive an empty config object.
const isClientConfigPage = typeof fmgPage === "string" && fmgPage.startsWith("client_");
const status = error?.status ?? error?.response?.status;
const isNotFound = status == 404;
if (isClientConfigPage && isNotFound) {
return {};
}
pageDataFromCms[widgetWithReplacements.Name] = [widgetWithReplacements.Model];
return Promise.reject(error);
});
Object.keys(pageDataFromCms).forEach((key) => {
if (pageDataFromCms[key].length === 1) {
pageDataFromCms[key] = pageDataFromCms[key][0];
}
});
return pageDataFromCms;
});
}
// Function to convert a string, into a matching global state item.

View file

@ -127,7 +127,7 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
debugLog(
`coverage-statement clientConfig::${clientConfigPageName}`,
JSON.stringify(vm.clientConfig)
@ -182,7 +182,7 @@ export default {
return this.clientConfig?.ClientLogoWidget?.Image || "";
},
deductibleAmount() {
return this.$store.getters.order.policy.currentDeductible;
return Number(this.$store.getters.order.policy.currentDeductible);
},
cashPrice() {
const lineItems = this.$store.getters.order.lineItems;

View file

@ -94,7 +94,7 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
debugLog(
`duplicate-check clientConfig::${clientConfigPageName}`,
JSON.stringify(vm.clientConfig)

View file

@ -90,7 +90,7 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
debugLog(
`endorsements clientConfig::${clientConfigPageName}`,
JSON.stringify(vm.clientConfig)

View file

@ -80,8 +80,8 @@
isRequired
class="mb-4"
cmsWidgetName="ApartmentWidget"
v-model="apartment"
inputId="apartment" />
v-model="streetAddress2"
inputId="streetAddress2" />
<textboxQuestion
isRequired
@ -148,7 +148,11 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper";
import { stateOptions } from "@/constants/state-options";
import { regex } from "@/helpers/validation-rules";
import { NON_MANAGED_SHOW_CLAIM_NUMBER_PARENTS } from "@/constants/insurance";
import {
NON_MANAGED_SHOW_CLAIM_NUMBER_PARENTS,
coverageStatus,
coverageStatusEnum,
} from "@/constants/insurance";
import saveProgressModalQuestion from "@/fmg-components/save-progress-modal-question/save-progress-modal-question";
// DEFINE VALIDATION RULES
@ -175,7 +179,7 @@ export default {
dateOfLoss: this.getDateOfLossFromStore(),
damageCause: this.getDamageCauseFromStore(),
streetAddress: this.getStreetAddressFromStore(),
apartment: this.getApartmentFromStore(),
streetAddress2: this.getStreetAddress2FromStore(),
city: this.getCityFromStore(),
policyState: this.getPolicyStateFromStore(),
policyZip: this.getPolicyZipFromStore(),
@ -256,19 +260,19 @@ export default {
return store.getters.order.damage.damageCause ?? "";
},
getStreetAddressFromStore() {
return store.getters.order.policy.streetAddress ?? "";
return store.getters.order.policy.policyAddress.streetAddress ?? "";
},
getApartmentFromStore() {
return store.getters.order.policy.apartment ?? "";
getStreetAddress2FromStore() {
return store.getters.order.policy.policyAddress.streetAddress2 ?? "";
},
getCityFromStore() {
return store.getters.order.policy.city ?? "";
return store.getters.order.policy.policyAddress.city ?? "";
},
getPolicyStateFromStore() {
return store.getters.order.policy.state ?? "";
return store.getters.order.policy.policyAddress.state ?? "";
},
getPolicyZipFromStore() {
return store.getters.order.policy.zipCode ?? "";
return store.getters.order.policy.policyAddress.zipCode ?? "";
},
getClaimNumberFromStore() {
return store.getters.order.policy.claimNumber ?? "";
@ -285,11 +289,15 @@ export default {
{
policyNumber: this.policyNumber,
streetAddress: this.streetAddress,
apartment: this.apartment,
streetAddress2: this.streetAddress2,
city: this.city,
state: this.policyState,
zipCode: this.policyZip,
claimNumber: this.claimNumber,
currentDeductible: 7777,
originalDeductible: 7777,
coverageStatus: coverageStatusEnum(coverageStatus.PENDING),
coverageSubStatus: "",
},
false
);

View file

@ -81,7 +81,7 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
debugLog(
`policy-driver clientConfig::${clientConfigPageName}`,
JSON.stringify(vm.clientConfig)

View file

@ -78,7 +78,7 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
debugLog(
`policy-info-submitted clientConfig::${clientConfigPageName}`,
JSON.stringify(vm.clientConfig)

View file

@ -410,7 +410,7 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
debugLog(
`policy-infoclientConfig::${clientConfigPageName}`,
JSON.stringify(vm.clientConfig)

View file

@ -83,7 +83,7 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
debugLog(
`policy-vehicle clientConfig::${clientConfigPageName}`,
JSON.stringify(vm.clientConfig)

View file

@ -96,7 +96,7 @@ export default {
const showSaveProgressModal = !(emailFromStore?.length > 0);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
vm.showSaveProgressModal = showSaveProgressModal;
vm.recalibrationInfoDesktopImage = vm.getCmsContent("AdasInfoDesktopWidget", "Image");
vm.recalibrationInfoMobileImage = vm.getCmsContent("AdasInfoMobileWidget", "Image");

View file

@ -138,7 +138,7 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.clientConfig = resultMap.clientConfig;
vm.clientConfig = resultMap.clientConfig ?? {};
debugLog(
`verify-details clientConfig::${clientConfigPageName}`,
JSON.stringify(vm.clientConfig)

View file

@ -264,6 +264,7 @@ export default {
sessionData.coverageSubStatus = order?.payment?.insuranceCoverage?.coverageSubStatus;
sessionData.isNoComp = order?.policy?.isNoComp;
sessionData.isItac = order?.policy?.isItac;
sessionData.isClaimAndCoverage = order.payment.isClaimAndCoverage;
sessionData.subTotalPrice = getSubTotal(order?.lineItems);
sessionData.totalPrice = getAmountDue(order?.lineItems, true);
sessionData.userAgent = navigator.userAgent;

View file

@ -178,11 +178,13 @@ const getDefaultState = () => {
insuranceCompanyName: null,
phoneNumber: null,
phoneExtension: null,
streetAddress: null,
apartment: null,
city: null,
state: null,
zipCode: null,
policyAddress: {
streetAddress: null,
streetAddress2: null,
city: null,
state: null,
zipCode: null,
},
dateOfBirth: null,
lossTime: null,
lossLocation: null,
@ -361,19 +363,19 @@ export const mutations = {
state.order.policy.phoneExtension = phoneExtension;
},
updateStreetAddress(state, streetAddress) {
state.order.policy.streetAddress = streetAddress;
state.order.policy.policyAddress.streetAddress = streetAddress;
},
updateApartment(state, apartment) {
state.order.policy.apartment = apartment;
updateStreetAddress2(state, streetAddress2) {
state.order.policy.policyAddress.streetAddress2 = streetAddress2;
},
updateCity(state, city) {
state.order.policy.city = city;
state.order.policy.policyAddress.city = city;
},
updateState(state, stateValue) {
state.order.policy.state = stateValue;
state.order.policy.policyAddress.state = stateValue;
},
updateZipCode(state, zipCode) {
state.order.policy.zipCode = zipCode;
state.order.policy.policyAddress.zipCode = zipCode;
},
updateClaimNumber(state, claimNumber) {
state.order.policy.claimNumber = claimNumber;
@ -405,11 +407,11 @@ export const mutations = {
state.order.policy.policyNumber = null;
state.order.policy.claimNumber = null;
state.order.policy.insuranceCompanyName = null;
state.order.policy.streetAddress = null;
state.order.policy.apartment = null;
state.order.policy.city = null;
state.order.policy.state = null;
state.order.policy.zipCode = null;
state.order.policy.policyAddress.streetAddress = null;
state.order.policy.policyAddress.streetAddress2 = null;
state.order.policy.policyAddress.city = null;
state.order.policy.policyAddress.state = null;
state.order.policy.policyAddress.zipCode = null;
state.order.damage.dateOfLoss = null;
state.order.damage.damageCause = null;
},
@ -563,11 +565,11 @@ export const mutations = {
updateInsuranceDetails(state, insuranceDetails) {
if (insuranceDetails) {
state.order.policy.policyNumber = insuranceDetails.policyNumber;
state.order.policy.streetAddress = insuranceDetails.streetAddress;
state.order.policy.apartment = insuranceDetails.apartment;
state.order.policy.city = insuranceDetails.city;
state.order.policy.state = insuranceDetails.state;
state.order.policy.zipCode = insuranceDetails.zipCode;
state.order.policy.policyAddress.streetAddress = insuranceDetails.streetAddress;
state.order.policy.policyAddress.streetAddress2 = insuranceDetails.streetAddress2;
state.order.policy.policyAddress.city = insuranceDetails.city;
state.order.policy.policyAddress.state = insuranceDetails.state;
state.order.policy.policyAddress.zipCode = insuranceDetails.zipCode;
state.order.policy.claimNumber = insuranceDetails.claimNumber;
state.order.policy.phoneNumber = insuranceDetails.phoneNumber;
state.order.policy.phoneExtension = insuranceDetails.phoneExtension;
@ -577,8 +579,15 @@ export const mutations = {
state.order.policy.lastName = insuranceDetails.lastName;
state.order.policy.lossLocation = insuranceDetails.lossLocation;
state.order.policy.subrogation = insuranceDetails.subrogation;
state.order.policy.streetAddress = insuranceDetails.streetAddress;
state.order.policy.currentDeductible = insuranceDetails.currentDeductible;
state.order.policy.originalDeductible = insuranceDetails.originalDeductible;
state.order.payment.insuranceCoverage.coverageStatus = coverageStatusValue(
insuranceDetails.coverageStatus
);
state.order.payment.insuranceCoverage.coverageSubStatus =
insuranceDetails.coverageSubStatus;
}
console.log("::::" + state.order.payment.insuranceCoverage.coverageStatus);
},
updateDamageDetails(state, damageDetails) {
if (damageDetails) {
@ -976,13 +985,17 @@ export const mutations = {
? true
: false;
state.order.policy.policyNumber = sessionInformation.order.policy?.policyNumber;
state.order.policy.claimNumber = sessionInformation.order.policy?.claimNumber;
state.order.policy.insuranceCompanyName =
sessionInformation.order.policy?.insuranceCompanyName;
//state.order.policy.streetAddress = sessionInformation.order.policy?.streetAddress;
//state.order.policy.apartment = sessionInformation.order.policy?.apartment;
//state.order.policy.city = sessionInformation.order.policy?.city;
//state.order.policy.state = sessionInformation.order.policy?.state;
//state.order.policy.zipCode = sessionInformation.order.policy?.zipCode;
state.order.policy.policyAddress.streetAddress =
sessionInformation.order.policy?.address?.streetAddress;
state.order.policy.address.streetAddress2 =
sessionInformation.order.policy?.address?.streetAddress2;
state.order.policy.policyAddress.city = sessionInformation.order.policy?.address?.city;
state.order.policy.policyAddress.state = sessionInformation.order.policy?.address?.state;
state.order.policy.policyAddress.zipCode =
sessionInformation.order.policy?.address?.zipCode;
state.order.policy.isNoComp =
coverageTypeValue(sessionInformation?.order.insuranceCoverage.coverageType) ===
coverageType.NOCOMP
@ -1818,6 +1831,7 @@ export const actions = {
coverageSubStatus,
isNoComp,
isItac,
isClaimAndCoverage,
subTotalPrice,
totalPrice,
userAgent,
@ -1868,6 +1882,7 @@ export const actions = {
deductible: deductible,
isNoComp: isNoComp,
isItac: isItac,
isClaimAndCoverage: isClaimAndCoverage,
subTotalPrice: subTotalPrice,
totalPrice: totalPrice,
userAgent: userAgent,
@ -2648,6 +2663,8 @@ export const actions = {
moldingQuestionAnswers: order.damage.moldingQuestionAnswers,
capabilityQuestionAnswers: order.damage.capabilityQuestionAnswers,
installOemGlass: order.damage.installOemGlass,
dateOfLoss: order.damage.dateOfLoss,
damageCause: order.damage.damageCause,
},
lineItems: {
glassParts: lineItems.glassParts,
@ -2699,6 +2716,15 @@ export const actions = {
isNoComp: order.policy?.isNoComp,
currentDeductible: order.policy?.currentDeductible,
originalDeductible: order.policy?.originalDeductible,
policyAddress: {
streetAddress: order.policy?.policyAddress?.streetAddress,
streetAddress2: order.policy?.policyAddress?.streetAddress2,
city: order.policy?.policyAddress?.city,
state: order.policy?.policyAddress?.state,
zipCode: order.policy?.policyAddress?.zipCode,
},
policyNumber: order.policy?.policyNumber,
claimNumber: order.policy?.claimNumber,
},
serviceLocation: {
streetAddress: order.serviceLocation.address,