diff --git a/src/layouts/insurance-company/insurance-company-question.spec.js b/src/layouts/insurance-company/insurance-company-question.spec.js new file mode 100644 index 000000000..e69de29bb diff --git a/src/layouts/insurance-company/insurance-company-question.vue b/src/layouts/insurance-company/insurance-company-question.vue new file mode 100644 index 000000000..c69cac280 --- /dev/null +++ b/src/layouts/insurance-company/insurance-company-question.vue @@ -0,0 +1,184 @@ + + + + + diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index e880b1534..643845e88 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -10,12 +10,17 @@
- + + + + { - insuranceCompany.altTerms = ""; - - termMapping.forEach((matchingTerm) => { - if ( - insuranceCompany.accountName - .toUpperCase() - .includes(matchingTerm.term.toUpperCase()) - ) { - insuranceCompany.altTerms = - insuranceCompany.altTerms + matchingTerm.altTerm?.toUpperCase() + " "; - } - }); - - return insuranceCompany; - } - ); + + console.log("originalList: ", resultMap.insuranceCompanyList); // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); vm.originalList = resultMap.insuranceCompanyList; - vm.searchableInsuranceCompanyList = searchableInsuranceCompanyList; }); }, + //Added data() { return { + parentAccountNumber: this.selectedParentAccountNumber(), searchableInsuranceCompanyList: [], originalList: [], - }; + } }, methods: { + selectedParentAccountNumber() { + return store?.order?.payment?.parentAccountNumber; + }, arePagePrerequisitesValid() { return store.getters.vehicle.carId !== null; }, - findMatches(request, response) { - const matches = []; - const term = request?.term?.toUpperCase(); - this.originalList.forEach((company, index) => { - if ( - company.accountName.indexOf(term) !== -1 || - company.altTerms.indexOf(term) !== -1 - ) { - matches.push(company.accountName); - } - }); - response(matches); - }, backButtonAction() { // Go back to Quote page this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); @@ -155,102 +118,14 @@ export default { 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.selectParentAccountNumber; - setTimeout(() => { - $("#autocomplete").autocomplete({ - source: this.findMatches, - 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"); - let regExpString = "(" + this.value + ")"; - let re = new RegExp(regExpString, "i"); - w.html((i, html) => - html.replace(re, "$1") - ); - }, 5); - }, - select: function (event, ui) { - select(ui.item.value); - }, - }); - }, 0); }, components: { funnelHeader, navbar, funnelSubHeader, - textboxQuestion, Form, loadingModal, + insuranceCompanyQuestion, }, }; -