diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 065432c90..e880b1534 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -60,8 +60,8 @@ const termMapping = [ }, { term: "AAA", - altTerm: "American" - } + altTerm: "American", + }, ]; export default { @@ -89,19 +89,24 @@ export default { const resultMap = await settleAllPromises(promiseResultMap); - const searchableInsuranceCompanyList = resultMap.insuranceCompanyList.map(( insuranceCompany ) => { + const searchableInsuranceCompanyList = resultMap.insuranceCompanyList.map( + (insuranceCompany) => { + insuranceCompany.altTerms = ""; - insuranceCompany.altTerms = ""; + termMapping.forEach((matchingTerm) => { + if ( + insuranceCompany.accountName + .toUpperCase() + .includes(matchingTerm.term.toUpperCase()) + ) { + insuranceCompany.altTerms = + insuranceCompany.altTerms + matchingTerm.altTerm?.toUpperCase() + " "; + } + }); - termMapping.forEach((matchingTerm) => { - if (insuranceCompany.accountName.toUpperCase().includes(matchingTerm.term.toUpperCase())) { - insuranceCompany.altTerms = insuranceCompany.altTerms + matchingTerm.altTerm?.toUpperCase() + " "; - } - }); - - return insuranceCompany; - - }); + return insuranceCompany; + } + ); // Call the "next" function to complete the transition to this page. next((vm) => { @@ -124,7 +129,10 @@ export default { const matches = []; const term = request?.term?.toUpperCase(); this.originalList.forEach((company, index) => { - if (company.accountName.indexOf(term) !== -1 || company.altTerms.indexOf(term) !== -1) { + if ( + company.accountName.indexOf(term) !== -1 || + company.altTerms.indexOf(term) !== -1 + ) { matches.push(company.accountName); } }); @@ -165,6 +173,7 @@ export default { }, }, mounted() { + const select = this.selectParentAccountNumber; setTimeout(() => { $("#autocomplete").autocomplete({ source: this.findMatches, @@ -179,9 +188,14 @@ export default { let w = $(this).autocomplete("widget").find("div"); let regExpString = "(" + this.value + ")"; let re = new RegExp(regExpString, "i"); - w.html((i, html) => html.replace(re, "$1")); + w.html((i, html) => + html.replace(re, "$1") + ); }, 5); }, + select: function (event, ui) { + select(ui.item.value); + }, }); }, 0); },