From 28b0ddfb0e6d134f4f53c5594320ed52cc98fa44 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Wed, 6 Mar 2024 07:36:16 -0500 Subject: [PATCH 01/13] Added Test environment to environments which display the log entries in the browser console. --- src/helpers/logger.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helpers/logger.js b/src/helpers/logger.js index 7e2a3d7c1..0a172fecb 100644 --- a/src/helpers/logger.js +++ b/src/helpers/logger.js @@ -42,7 +42,8 @@ export class Logger { // If running locally or in the Dev environment show the log entries in the console. if ( applicationConfig.CURRENT_ENVIRONMENT === "Localhost" || - applicationConfig.CURRENT_ENVIRONMENT === "Dev" + applicationConfig.CURRENT_ENVIRONMENT === "Dev" || + applicationConfig.CURRENT_ENVIRONMENT === "Test" ) { console.log(logEntry); } From 8c4984a9e86623bd3452541d395572c36d6de602 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 8 Mar 2024 08:01:40 -0500 Subject: [PATCH 02/13] Updated logger to fix env variable error and to add color coded log entries for the browser console --- src/constants/application-config.js | 1 - src/helpers/logger.js | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/constants/application-config.js b/src/constants/application-config.js index 6c4ecd387..b8a59a129 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -28,7 +28,6 @@ const applicationConfig = { YAHOO_CALENDAR: "https://calendar.yahoo.com/?v=60", OUTLOOK_CALENDAR: "https://outlook.office.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent", - FRONTEND_LOGGER_URL: process.env.VUE_APP_CONSUMER_CF_DISTRO + "/analytics/api/v1/logging", }; export { applicationConfig }; diff --git a/src/helpers/logger.js b/src/helpers/logger.js index 0a172fecb..48a098340 100644 --- a/src/helpers/logger.js +++ b/src/helpers/logger.js @@ -45,10 +45,25 @@ export class Logger { applicationConfig.CURRENT_ENVIRONMENT === "Dev" || applicationConfig.CURRENT_ENVIRONMENT === "Test" ) { - console.log(logEntry); + switch (endpoint) { + case "log-information": + console.info(logEntry); + break; + case "log-warning": + console.warn(logEntry); + break; + case "log-error": + console.error(logEntry); + break; + case "log-critical": + console.error(logEntry); + break; + default: + console.log(logEntry); + } } - const url = applicationConfig.FRONTEND_LOGGER_URL; + const url = applicationConfig.CONSUMER_CF_DISTRO + applicationConfig.FRONTEND_LOGGER_URL; const headers = { [headerKeys.EXPERIMENT]: JSON.stringify(store.getters.experimentSettings), }; From 537158eff508b189cb2df1a20c596634932f8989 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 8 Mar 2024 08:04:46 -0500 Subject: [PATCH 03/13] Changed app setting name for logging path --- src/constants/application-config.js | 1 + src/helpers/logger.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/constants/application-config.js b/src/constants/application-config.js index b8a59a129..25d24d5c8 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -28,6 +28,7 @@ const applicationConfig = { YAHOO_CALENDAR: "https://calendar.yahoo.com/?v=60", OUTLOOK_CALENDAR: "https://outlook.office.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent", + FRONTEND_LOGGER_PATH: "/analytics/api/v1/logging", }; export { applicationConfig }; diff --git a/src/helpers/logger.js b/src/helpers/logger.js index 48a098340..c8ff400ec 100644 --- a/src/helpers/logger.js +++ b/src/helpers/logger.js @@ -63,7 +63,7 @@ export class Logger { } } - const url = applicationConfig.CONSUMER_CF_DISTRO + applicationConfig.FRONTEND_LOGGER_URL; + const url = applicationConfig.CONSUMER_CF_DISTRO + applicationConfig.FRONTEND_LOGGER_PATH; const headers = { [headerKeys.EXPERIMENT]: JSON.stringify(store.getters.experimentSettings), }; From 45a2b5d022801666a5e60a07c47fda0e7bc709a5 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 8 Mar 2024 08:10:48 -0500 Subject: [PATCH 04/13] Prettified --- src/helpers/logger.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/helpers/logger.js b/src/helpers/logger.js index c8ff400ec..4c2e6d131 100644 --- a/src/helpers/logger.js +++ b/src/helpers/logger.js @@ -59,11 +59,12 @@ export class Logger { console.error(logEntry); break; default: - console.log(logEntry); + console.log(logEntry); } } - const url = applicationConfig.CONSUMER_CF_DISTRO + applicationConfig.FRONTEND_LOGGER_PATH; + const url = + applicationConfig.CONSUMER_CF_DISTRO + applicationConfig.FRONTEND_LOGGER_PATH; const headers = { [headerKeys.EXPERIMENT]: JSON.stringify(store.getters.experimentSettings), }; From c9702aa569968dc7ddf9298a967916ef7c16d343 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 8 Mar 2024 08:48:02 -0500 Subject: [PATCH 05/13] Changed check for environment to be 'SysTest' instead of 'Test --- src/helpers/logger.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/helpers/logger.js b/src/helpers/logger.js index 4c2e6d131..53c2cb808 100644 --- a/src/helpers/logger.js +++ b/src/helpers/logger.js @@ -43,19 +43,19 @@ export class Logger { if ( applicationConfig.CURRENT_ENVIRONMENT === "Localhost" || applicationConfig.CURRENT_ENVIRONMENT === "Dev" || - applicationConfig.CURRENT_ENVIRONMENT === "Test" + applicationConfig.CURRENT_ENVIRONMENT === "SysTest" ) { switch (endpoint) { - case "log-information": + case loggingEndpointMethods.LOG_INFORMATION: console.info(logEntry); break; - case "log-warning": + case loggingEndpointMethods.LOG_WARNING: console.warn(logEntry); break; - case "log-error": + case loggingEndpointMethods.LOG_ERROR: console.error(logEntry); break; - case "log-critical": + case loggingEndpointMethods.LOG_CRITICAL: console.error(logEntry); break; default: From 43c1b1c18b270fb9a142a2499f84fb2dc1b5bc65 Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:33:40 -0500 Subject: [PATCH 06/13] CSR-2005 CSR-2005 save parent account number before transition to heritage --- .../insurance-company/insurance-company.vue | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 9d4682622..66f0b4305 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -48,7 +48,6 @@ import baseMixin from "@/mixins/base-mixin.js"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import store from "@/store"; -import vinPagesMixin from "@/mixins/vin-pages-mixin"; import $ from "jquery"; // DEFINE VALIDATION RULES @@ -67,7 +66,6 @@ defineRule("vin-format", regex(/^[a-hA-Hj-nJ-NpPr-zR-Z0-9]{17}$/, errorMessages. export default { name: "insurance-company", - mixins: [vinPagesMixin], async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); @@ -99,6 +97,7 @@ export default { data() { return { insuranceCompanyList: [], + selectedParentAccount: "", }; }, computed: { @@ -120,15 +119,37 @@ export default { this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); }, forwardButtonAction() { + this.dispatchStoreAction( + this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER, + this.selectedParentAccount, + false + ); + navigateToHeritageFunnel({ shouldSaveSession: true, pageNameToLog: "insurance-company", loadingModal: this.$refs.loadingModal, }); }, + selectParentAccountNumber(parentAccountName) { + if (!this.insuranceCompanyList) { + console.error("No insurance companies found"); + return; + } + + var selectedItem = this.insuranceCompanyList.filter((item) => { + return item.accountName === parentAccountName; + }); + + if (selectedItem) { + this.selectedParentAccount = selectedItem[0].parentAccountNumber; + } else { + console.error("Error locating " + parentAccountName); + } + }, }, mounted() { - const select = this.handleAutocompleteSelect; + const select = this.selectParentAccountNumber; $("#autocomplete").autocomplete({ source: this.insuranceCompanyListTags, @@ -144,6 +165,9 @@ export default { w.html((i, html) => html.replace(re, "$1")); }, 5); }, + select: function (event, ui) { + select(ui.item.value); + }, }); }, watch: { From e2998e991bd8a7f04ef3b2f6cee2de1071e9ecec Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:49:32 -0500 Subject: [PATCH 07/13] CSR-2005 prettier --- src/layouts/insurance-company/insurance-company.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 66f0b4305..eb203ace2 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -140,7 +140,7 @@ export default { var selectedItem = this.insuranceCompanyList.filter((item) => { return item.accountName === parentAccountName; }); - + if (selectedItem) { this.selectedParentAccount = selectedItem[0].parentAccountNumber; } else { From 0403ad22d81671c478b074241c9f727758cd1bfd Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Mon, 11 Mar 2024 15:14:02 -0400 Subject: [PATCH 08/13] WIP --- .../insurance-company/insurance-company.vue | 107 +++++++++++++----- 1 file changed, 81 insertions(+), 26 deletions(-) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index da649eb3a..1b0ee15ab 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -109,17 +109,75 @@ export default { }, computed: { insuranceCompanyListTags() { + // return this.insuranceCompanyList.map((item) => { + // return item.accountName; + // }); + + const termMap = [ + { + term: "1st", + altTerm: "FIRST", + } + ]; + + const doTest = (testTerm) => { + return termMap.find((matchingTerm) => { + if (testTerm.includes(matchingTerm.term)) return matchingTerm.altTerm; + return; + }); + }; + + return this.insuranceCompanyList.map((item) => { - return item.accountName; + // return item.accountName; + return { + label: item.accountName, + altTerms: doTest(item.accountName) ? doTest(item.accountName) : "", + } }); + + + + + // return [ + // { + // "label": "1ST INSURANCE", + // "altTerms": "FIRST" + // }, + // { + // "label": "AAA INSURANCE", + // "altTerms": "AMERICAN AUTOMOTIVE AUTOMOBILE ASSOCIATION TRIPLE" + // }, + // { + // "label": "AMERICAN ROADS INSURANCE", + // "altTerms": "" + // }, + // { + // "label": "DONT USE US INSURANCE", + // "altTerms": "" + // }, + // { + // "label": "FIRST PIONEER INSURANCE", + // "altTerms": "1ST" + // }, + // ]; }, }, methods: { arePagePrerequisitesValid() { return store.getters.vehicle.carId !== null; }, - handleAutocompleteSelect(value) { - this.selectedQuery = value; + findMatches(request, response) { + const matches = []; + const term = request?.term?.toUpperCase(); + console.log(this.insuranceCompanyListTags); + this.insuranceCompanyListTags.forEach((tag, index) => { + if (tag.label.indexOf(term) !== -1 || tag.altTerms.indexOf(term) !== -1) { + matches.push(tag); + } + }); + + response(matches); }, backButtonAction() { // Go back to Quote page @@ -131,30 +189,25 @@ export default { }, }, mounted() { - const select = this.handleAutocompleteSelect; + setTimeout(() => { + $("#autocomplete").autocomplete({ + source: this.findMatches, + position: { + my: "left top+6", + }, + minLength: 0, // Necessary to display menu when clearing input - $("#autocomplete").autocomplete({ - source: this.insuranceCompanyListTags, - position: { - my: "left top+6", - }, - minLength: 0, // Necessary to display menu when clearing input - // Bold matching letters as you type in the input - search: function (event, ui) { - setTimeout(() => { - let w = $(this).autocomplete("widget").find("div"), - re = new RegExp("(" + this.value + ")", "i"); - w.html((i, html) => html.replace(re, "$1")); - }, 5); - }, - }); - }, - watch: { - selectedQuery(newValue, oldValue) { - if (oldValue.length > 0 && newValue.length === 0) { - $("#autocomplete").autocomplete("search", ""); - } - }, + // Bold matching letters as you type in the input + search: function (event, ui) { + setTimeout(() => { + 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")); + }, 5); + }, + }); + }, 5); }, components: { funnelHeader, @@ -176,6 +229,8 @@ ul { background: $white; border: 1px solid $gray; border-radius: 0.25rem; + height: 50%; + overflow: auto; li { &:hover, .ui-state-active { From 7057f6bf52531529adf7b301946aa8322eaebef3 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 11 Mar 2024 16:28:35 -0400 Subject: [PATCH 09/13] CSR-1891: use term mapping to update co list --- .../insurance-company/insurance-company.vue | 122 ++++++------------ 1 file changed, 36 insertions(+), 86 deletions(-) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 1b0ee15ab..94fa57001 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -41,35 +41,24 @@ import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { storeActions } from "@/constants/store-actions"; -import { errorMessages } from "@/constants/error-messages"; -import { - getDamageString, - getIsWindshieldOnly, - isGlassAvailableForCarId, -} from "@/helpers/damage-helper"; -import { required, regex } from "@/helpers/validation-rules"; import { Form, defineRule } from "vee-validate"; -import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper"; -import { routerParams } from "@/router/router-constants/router-params"; import baseMixin from "@/mixins/base-mixin.js"; import store from "@/store"; import vinPagesMixin from "@/mixins/vin-pages-mixin"; import $ from "jquery"; -// DEFINE VALIDATION RULES -defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); -defineRule("zip-format", regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT)); -defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED)); -defineRule( - "email-address-format", - regex( - /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9-]+)\.([a-zA-Z]{2,})$/, - errorMessages.EMAIL_ADDRESS_FORMAT - ) -); -defineRule("vin-required", required(errorMessages.VIN_REQUIRED)); -defineRule("vin-format", regex(/^[a-hA-Hj-nJ-NpPr-zR-Z0-9]{17}$/, errorMessages.VIN_FORMAT)); +// MAPPNG +const termMapping = [ + { + term: "1ST", + altTerm: "FIRST", + }, + { + term: "AAA", + altTerm: "American" + } +]; export default { name: "insurance-company", @@ -96,73 +85,36 @@ export default { ]; const resultMap = await settleAllPromises(promiseResultMap); + + const searchableInsuranceCompanyList = resultMap.insuranceCompanyList.map(( insuranceCompany ) => { + + insuranceCompany.altTerms = ""; + + termMapping.forEach((matchingTerm) => { + if (insuranceCompany.accountName.toUpperCase().includes(matchingTerm.term.toUpperCase())) { + insuranceCompany.altTerms = insuranceCompany.altTerms + matchingTerm.altTerm?.toUpperCase() + " "; + } + }); + + return insuranceCompany; + + }); + + console.log("searchableInsuranceCompanyList: ", searchableInsuranceCompanyList); + // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); - vm.insuranceCompanyList = resultMap.insuranceCompanyList; + vm.originalList = resultMap.insuranceCompanyList; + vm.searchableInsuranceCompanyList = searchableInsuranceCompanyList; }); }, data() { return { - insuranceCompanyList: [], + searchableInsuranceCompanyList: [], + originalList: [], }; }, - computed: { - insuranceCompanyListTags() { - // return this.insuranceCompanyList.map((item) => { - // return item.accountName; - // }); - - const termMap = [ - { - term: "1st", - altTerm: "FIRST", - } - ]; - - const doTest = (testTerm) => { - return termMap.find((matchingTerm) => { - if (testTerm.includes(matchingTerm.term)) return matchingTerm.altTerm; - return; - }); - }; - - - return this.insuranceCompanyList.map((item) => { - // return item.accountName; - return { - label: item.accountName, - altTerms: doTest(item.accountName) ? doTest(item.accountName) : "", - } - }); - - - - - // return [ - // { - // "label": "1ST INSURANCE", - // "altTerms": "FIRST" - // }, - // { - // "label": "AAA INSURANCE", - // "altTerms": "AMERICAN AUTOMOTIVE AUTOMOBILE ASSOCIATION TRIPLE" - // }, - // { - // "label": "AMERICAN ROADS INSURANCE", - // "altTerms": "" - // }, - // { - // "label": "DONT USE US INSURANCE", - // "altTerms": "" - // }, - // { - // "label": "FIRST PIONEER INSURANCE", - // "altTerms": "1ST" - // }, - // ]; - }, - }, methods: { arePagePrerequisitesValid() { return store.getters.vehicle.carId !== null; @@ -170,13 +122,11 @@ export default { findMatches(request, response) { const matches = []; const term = request?.term?.toUpperCase(); - console.log(this.insuranceCompanyListTags); - this.insuranceCompanyListTags.forEach((tag, index) => { - if (tag.label.indexOf(term) !== -1 || tag.altTerms.indexOf(term) !== -1) { - matches.push(tag); + this.originalList.forEach((company, index) => { + if (company.accountName.indexOf(term) !== -1 || company.altTerms.indexOf(term) !== -1) { + matches.push(company.accountName); } }); - response(matches); }, backButtonAction() { @@ -207,7 +157,7 @@ export default { }, 5); }, }); - }, 5); + }, 0); }, components: { funnelHeader, From 224fd66c0cd8c24406e3f2fc4ec4c62ba595099a Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Mon, 11 Mar 2024 16:32:58 -0400 Subject: [PATCH 10/13] WIP add names to mapping. --- src/layouts/insurance-company/insurance-company.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 94fa57001..00cfb97d0 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -54,6 +54,10 @@ const termMapping = [ term: "1ST", altTerm: "FIRST", }, + { + term: "FIRST", + altTerm: "1ST", + }, { term: "AAA", altTerm: "American" From 75c312e66e54e9711146706ee55159e850ed9fc0 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Tue, 12 Mar 2024 08:56:55 -0400 Subject: [PATCH 11/13] CSR-1891 set font weight to bold for matching characters --- src/layouts/insurance-company/insurance-company.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 00cfb97d0..fba35927f 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -157,7 +157,7 @@ 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); }, }); From f0687661d05dfad9d9ff487b25e6c6dd04cc1302 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Tue, 12 Mar 2024 09:09:15 -0400 Subject: [PATCH 12/13] Remove console.log. --- src/layouts/insurance-company/insurance-company.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index fba35927f..999ca41c1 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -104,8 +104,6 @@ export default { }); - console.log("searchableInsuranceCompanyList: ", searchableInsuranceCompanyList); - // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); From 8cb712c2ad46a544f50a9821853fc4cb589e0563 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Tue, 12 Mar 2024 09:56:45 -0400 Subject: [PATCH 13/13] CSR-1891 re-add select code, format. --- .../insurance-company/insurance-company.vue | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) 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); },