better meds search

This commit is contained in:
Paul Wilde 2023-03-24 12:05:37 +00:00
parent 9e77272535
commit 2acb73802a

View file

@ -6,13 +6,14 @@
</v-progress-linear>
<v-list>
<RecycleScroller class="scroller"
:items="meds"
:items="filteredMeds"
:item-size="50"
v-slot="{ item }"
key-field="id"
>
<v-list-item @click="setMed(item)">
{{ item.med_code }} : {{ item.name }}
{{ item }}
</v-list-item>
</RecycleScroller>
</v-list>
@ -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 => {