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

View file

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