CSR-1891 WIP fix functionality where ins co name is

displayed but ins co number is saved.
This commit is contained in:
Bryan Mauger 2024-03-20 11:47:12 -04:00
parent f8e1e70dbf
commit ca05fbb361
2 changed files with 30 additions and 30 deletions

View file

@ -1,6 +1,6 @@
<template>
<textboxQuestion
v-model="parentAccountNumber"
v-model="selectedAccountNumber"
customInputId="autocomplete"
class="mb-4 mt-5"
cmsWidgetName="InsuranceCoQuestionWidget"
@ -40,15 +40,28 @@ export default {
name: "insurance-company-question",
props: {
originalList: Array,
modelValue: String,
},
data() {
return {
selectedAccountName: "",
}
},
// data() {
// return {
// searchableInsuranceCompanyList: [],
// }
// },
computed: {
selectedAccountNumber: {
get: function () {
if (this.selectedAccountName.length > 0) {
return this.selectedAccountName;
} else {
return this.modelValue?.toString();
}
},
set: function (newValue) {
console.log("SET ", newValue);
this.$emit("update:modelValue", newValue);
},
},
searchableInsuranceCompanyList() {
return this.originalList.map(
(insuranceCompany) => {
insuranceCompany.altTerms = "";
@ -63,7 +76,6 @@ export default {
insuranceCompany.altTerms + matchingTerm.altTerm?.toUpperCase() + " ";
}
});
return insuranceCompany;
}
);
@ -85,17 +97,18 @@ export default {
response(matches);
},
selectParentAccountNumber(parentAccountName) {
if (!this.insuranceCompanyList) {
if (!this.searchableInsuranceCompanyList) {
console.error("No insurance companies found");
return;
}
var selectedItem = this.insuranceCompanyList.filter((item) => {
const selectedItem = this.searchableInsuranceCompanyList.filter((item) => {
return item.accountName === parentAccountName;
});
if (selectedItem) {
this.selectedParentAccount = selectedItem[0].parentAccountNumber;
this.selectedAccountName = parentAccountName;
this.selectedAccountNumber = selectedItem[0].parentAccountNumber;
} else {
console.error("Error locating " + parentAccountName);
}
@ -109,7 +122,7 @@ export default {
position: {
my: "left top+6",
},
minLength: 0, // Necessary to display menu when clearing input
minLength: 0, // Necessary to display fmenu when clearing input
// Bold matching letters as you type in the input
search: function (event, ui) {
@ -127,8 +140,6 @@ export default {
},
});
}, 0);
console.log("searchableInsuranceCompanyList: ", this.searchableInsuranceCompanyList);
},
components: {
textboxQuestion,

View file

@ -12,15 +12,8 @@
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" class="mt-4" />
<insurance-company-question
v-model="parentAccountNumber"
:originalList="originalList" />
<!--
<insurance-company-question
v-model="parentAccountNumber"
:searchableInsuranceCompanyList="searchableInsuranceCompanyList"
:originalList="originalList" />
-->
v-model="parentAccountNumber"
:originalList="originalList" />
<navbar
cmsWidgetName="FunnelFooterWidget"
@ -76,7 +69,6 @@ export default {
];
const resultMap = await settleAllPromises(promiseResultMap);
console.log("originalList: ", resultMap.insuranceCompanyList);
@ -86,16 +78,14 @@ export default {
vm.originalList = resultMap.insuranceCompanyList;
});
},
//Added
data() {
return {
parentAccountNumber: this.selectedParentAccountNumber(),
searchableInsuranceCompanyList: [],
parentAccountNumber: this.parentAccountNumberFromStore(),
originalList: [],
}
},
methods: {
selectedParentAccountNumber() {
parentAccountNumberFromStore() {
return store?.order?.payment?.parentAccountNumber;
},
arePagePrerequisitesValid() {
@ -108,10 +98,9 @@ export default {
forwardButtonAction() {
this.dispatchStoreAction(
this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
this.selectedParentAccount,
this.parentAccountNumber,
false
);
navigateToHeritageFunnel({
shouldSaveSession: true,
pageNameToLog: "insurance-company",