From 4d78134649e61269eb9b3732da2eeb29414b5b89 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Mon, 6 May 2024 13:37:59 -0400 Subject: [PATCH 1/2] CSR-2072 fix insurance search dropdown after API was updated and case mismatch caused issues. --- .../insurance-company-question.vue | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/layouts/insurance-company/insurance-company-question.vue b/src/layouts/insurance-company/insurance-company-question.vue index 378d4f4b5..1943dd435 100644 --- a/src/layouts/insurance-company/insurance-company-question.vue +++ b/src/layouts/insurance-company/insurance-company-question.vue @@ -96,15 +96,28 @@ export default { findMatches(request, response) { const matches = []; const term = request?.term?.toUpperCase(); + const nonPriorityMatches = []; + this.searchableInsuranceCompanyList.forEach((company, index) => { if ( - company.accountName.indexOf(term) !== -1 || - company.altTerms.indexOf(term) !== -1 + company.accountName.toUpperCase().indexOf(term) !== -1 || + company.altTerms.toUpperCase().indexOf(term) !== -1 ) { matches.push(company.accountName); } }); - response(matches); + + const priorityMatches = matches.filter((companyName, index) => { + if (companyName.toUpperCase().indexOf(term) === 0) { + return companyName; + } else { + nonPriorityMatches.push(companyName); + } + }); + + const prioritizedMatches = [...priorityMatches, ...nonPriorityMatches]; + + response(prioritizedMatches); }, selectInsuranceCompany(parentAccountName) { // this runs upon user selection within jQueryUI Autocomplete From 644cd5a67ba0bb70e4a1b3722215f4b93fc85319 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Mon, 6 May 2024 13:42:00 -0400 Subject: [PATCH 2/2] Add comment. --- src/layouts/insurance-company/insurance-company-question.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/layouts/insurance-company/insurance-company-question.vue b/src/layouts/insurance-company/insurance-company-question.vue index 1943dd435..ecbb6876d 100644 --- a/src/layouts/insurance-company/insurance-company-question.vue +++ b/src/layouts/insurance-company/insurance-company-question.vue @@ -107,6 +107,7 @@ export default { } }); + // Prioritize matched typed entries to top of list const priorityMatches = matches.filter((companyName, index) => { if (companyName.toUpperCase().indexOf(term) === 0) { return companyName;