From 2acb73802a572071df8a682775aff2bad7792c15 Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Fri, 24 Mar 2023 12:05:37 +0000 Subject: [PATCH] better meds search --- src/components/MedSearch.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/MedSearch.vue b/src/components/MedSearch.vue index 300d89b..13fd35f 100644 --- a/src/components/MedSearch.vue +++ b/src/components/MedSearch.vue @@ -6,13 +6,14 @@ {{ item.med_code }} : {{ item.name }} + {{ item }} @@ -35,10 +36,21 @@ export default { created() { this.allMeds() }, + computed: { + filteredMeds() { + let q = this.med_search.toLowerCase() + if (q == ""){ return this.meds } + let ms = this.meds.filter(m => + m.name.toLowerCase().includes(q) || + m.med_code.toLowerCase().includes(q) + ) + return ms + } + }, methods: { allMeds(){ this.meds_loading = true - console.log("Searching for " + this.med_search) + console.log("All Meds...") let url = this.$api_url + "/meds/list" axios.get(url) .then(resp => {