added vet and med search

This commit is contained in:
Paul Wilde 2023-03-23 17:05:16 +00:00
parent 8799da8440
commit 342bbfc9bc
8 changed files with 249 additions and 102 deletions

View file

@ -11,8 +11,7 @@
v-slot="{ item }" v-slot="{ item }"
key-field="acc_no" key-field="acc_no"
> >
<v-list-item> <v-list-item @click="selectCustomer(item)">
<v-btn icon="mdi-arrow-right" title="select" @click="selectCustomer(item)" size="small" color="success"></v-btn>
{{ item.acc_no }} - {{ item.name }} {{ item.acc_no }} - {{ item.name }}
</v-list-item> </v-list-item>
</RecycleScroller> </RecycleScroller>

View file

@ -0,0 +1,81 @@
<template>
<v-card title="Med Search">
<v-card-text>
<v-text-field label="Search" v-model="med_search" append-icon="mdi-magnify" @click:append="searchMeds" @keyup.enter.prevent="searchMeds"></v-text-field>
<v-progress-linear indeterminate :active="meds_loading">
</v-progress-linear>
<v-list>
<RecycleScroller class="scroller"
:items="meds"
:item-size="50"
v-slot="{ item }"
key-field="id"
>
<v-list-item @click="setMed(item)">
{{ item.med_code }} : {{ item.name }}
</v-list-item>
</RecycleScroller>
</v-list>
</v-card-text>
</v-card>
</template>
<script>
import axios from 'axios'
export default {
props:{
},
data() {
return {
med_search: "",
meds: [],
meds_loading: null
}
},
emits: ['returnMed'],
created() {
this.allMeds()
},
methods: {
allMeds(){
this.meds_loading = true
console.log("Searching for " + this.med_search)
let url = this.$api_url + "/meds/list"
axios.get(url)
.then(resp => {
this.meds = resp.data
})
.catch(err => {
console.log(err)
})
.finally(() => {
this.meds_loading = false
})
},
searchMeds() {
this.meds_loading = true
console.log("Searching for " & this.med_search)
let url = this.$api_url + "/meds/search/" + this.med_search
axios.get(url)
.then(resp => {
console.log(resp)
this.meds = resp.data
})
.catch(err => {
console.log(err)
})
.finally(() => {
this.meds_loading = false
})
},
setMed(p){
this.$emit('returnMed',p)
}
}
}
</script>
<style scoped>
.scroller {
height:500px;
}
</style>

View file

@ -11,8 +11,8 @@
v-slot="{ item }" v-slot="{ item }"
key-field="code" key-field="code"
> >
<v-list-item> <v-list-item @click="setProduct(item)">
<v-btn icon="mdi-arrow-right" title="select" @click="setProduct(item)" size="small" color="success"></v-btn>
{{ item.code }} - {{ item.name }} {{ item.code }} - {{ item.name }}
</v-list-item> </v-list-item>
</RecycleScroller> </RecycleScroller>

View file

@ -0,0 +1,73 @@
<template>
<v-card title="Vet Search">
<v-card-text>
<v-text-field label="Search" v-model="vet_search" append-icon="mdi-magnify" @click:append="searchVets" @keyup.enter.prevent="searchVets"></v-text-field>
<v-progress-linear indeterminate :active="vets_loading">
</v-progress-linear>
<v-list>
<RecycleScroller class="scroller"
:items="vets"
:item-size="50"
v-slot="{ item }"
key-field="id"
>
<v-list-item @click="setVet(item)">
{{ item.practice }}
<v-tooltip activator="parent"
location="end">
{{ item.practice }}
<template v-for="(c,index) in item.contacts" :key="index">
<template v-if="c != ''">
{{ c }}<br/>
</template>
</template>
</v-tooltip>
</v-list-item>
</RecycleScroller>
</v-list>
</v-card-text>
</v-card>
</template>
<script>
import axios from 'axios'
export default {
props:{
},
data() {
return {
vet_search: "",
vets: [],
vets_loading: null
}
},
emits: ['returnVet'],
methods: {
searchVets() {
this.vets_loading = true
console.log("Searching for " & this.vet_search)
let url = this.$api_url + "/vets/search/" + this.vet_search
axios.get(url)
.then(resp => {
console.log(resp)
this.vets = resp.data
})
.catch(err => {
console.log(err)
})
.finally(() => {
this.vets_loading = false
})
},
setVet(p){
this.$emit('returnVet',p)
}
}
}
</script>
<style scoped>
.scroller {
height:500px;
}
</style>

View file

@ -4,10 +4,9 @@
<v-container> <v-container>
<v-row> <v-row>
<v-col cols="6"> <v-col cols="6">
<v-text-field readonly="true" variant="none" prepend-icon="mdi-magnify" @click:prepend="showCustomerSearch"> <v-text-field readonly variant="solo" prepend-icon="mdi-magnify" @click:prepend="showCustomerSearch" label="Customer" :model-value="contract.customer.acc_no + ' - ' + contract.customer.name">
{{ contract.customer.acc_no }} - {{ contract.customer.name }}
</v-text-field> </v-text-field>
<v-text-field type="number" variant="outlined" label="Tonnage Per Month" v-model="contract.tonnage_per_month"></v-text-field> <v-text-field type="number" variant="solo" label="Tonnage Per Month" v-model="contract.tonnage_per_month"></v-text-field>
</v-col> </v-col>
<v-col cols="6"> <v-col cols="6">
<label> <label>
@ -44,7 +43,7 @@
{{ p.code }} - {{ p.name }} {{ p.code }} - {{ p.name }}
</td> </td>
<td> <td>
<v-text-field type="number" density="compact" variant="outlined" v-model="p.price"></v-text-field> <v-text-field type="number" density="compact" variant="underlined" v-model="p.price"></v-text-field>
</td> </td>
<td> <td>
<v-btn size="small" color="error" title="Remove" variant="plain" @click="removeProduct(p.code)" icon="mdi-minus"></v-btn> <v-btn size="small" color="error" title="Remove" variant="plain" @click="removeProduct(p.code)" icon="mdi-minus"></v-btn>
@ -65,8 +64,8 @@
</label> </label>
</v-col> </v-col>
<v-col cols="12"> <v-col cols="12">
<v-textarea rows=3 label="Comments" v-model="contract.comments"></v-textarea> <v-textarea rows=3 label="Comments" variant="outlined" v-model="contract.comments"></v-textarea>
<v-textarea rows=3 label="Office Comments" v-model="contract.office_comments"></v-textarea> <v-textarea rows=3 label="Office Comments" variant="outlined" v-model="contract.office_comments"></v-textarea>
</v-col> </v-col>
</v-row> </v-row>
<ErrorBanner :errors="errors" /> <ErrorBanner :errors="errors" />
@ -140,6 +139,7 @@ export default {
} }
} }
}, },
emits: ['closetab','contractupdate'],
methods: { methods: {
close() { close() {
this.$emit('closetab','list') this.$emit('closetab','list')

View file

@ -122,7 +122,7 @@ export default {
</script> </script>
<style> <style>
.scroller { .scroller {
height: 600px; height: 300px;
} }
.scroller.small { .scroller.small {
height: 200px; height: 200px;

View file

@ -1,53 +1,20 @@
<template> <template>
<v-card :title="title"> <v-card :title="title" :subtitle="'Medicated Feed : ' + mf.id">
<v-card-subtitle>
Medicated Feed :
<template v-if="mf.isNew">New</template>
<template v-else>{{ mf.id }} - {{ mf.customer.name }}</template>
</v-card-subtitle>
<v-card-text> <v-card-text>
<v-container> <v-container>
<v-row> <v-row>
<v-col cols="6"> <v-col cols="6">
<v-text-field readonly="true" variant="none" prepend-icon="mdi-magnify" @click:prepend="showCustomerSearch"> <v-text-field label="Customer" readonly variant="outlined" prepend-icon="mdi-magnify" @click:prepend="showCustomerSearch" :model-value="mf.customer.acc_no + ' - ' + mf.customer.name">
{{ mf.customer.acc_no }} - {{ mf.customer.name }} </v-text-field>
<v-text-field label="Vet" readonly variant="outlined" prepend-icon="mdi-magnify" @click:prepend="showVetSearch" :model-value="mf.vet.practice">
</v-text-field> </v-text-field>
</v-col>
<v-col cols="6">
<v-autocomplete label="Vet"
:items="vets"
v-model="mf.vet.practice"
v-model:search="search[2]"
:loading="searching[2]"
append-icon="mdi-magnify"
item-title="practice"
item-value="id"
@keyup.enter="searchVets()"
@click:append="searchVets()"
no-data-text="No results (press Enter to search)"
></v-autocomplete>
</v-col>
<v-col cols="6">
<v-autocomplete label="Medication"
:items="medications"
v-model="mf.medication.name"
v-model:search="search[3]"
:loading="searching[3]"
append-icon="mdi-magnify"
item-title="name"
item-value="id"
@keyup.enter="searchMeds()"
no-data-text="No results (press Enter to search)"
@click:append="searchMeds()"
></v-autocomplete>
</v-col> </v-col>
<v-col cols="6"> <v-col cols="6">
<v-card title="Medication :"> <v-card title="Medication :">
<v-card-subtitle>
Name : {{ mf.medication.name }}<br/>
</v-card-subtitle>
<v-card-text> <v-card-text>
<v-text-field label="Medication" readonly variant="outlined" prepend-icon="mdi-magnify" @click:prepend="showMedSearch" :model-value="mf.medication.name">
</v-text-field>
<template v-for="(i, idx) in mf.medication.info" :key="idx" > <template v-for="(i, idx) in mf.medication.info" :key="idx" >
<template v-if="i != ''"> <template v-if="i != ''">
{{ i }}<br/> {{ i }}<br/>
@ -61,8 +28,7 @@
</v-row> </v-row>
<v-row> <v-row>
<v-col cols="12"> <v-col cols="12">
<v-text-field readonly="true" variant="none" prepend-icon="mdi-magnify" @click:prepend="showProductSearch"> <v-text-field label="Product" readonly variant="outlined" prepend-icon="mdi-magnify" @click:prepend="showProductSearch" :model-value="mf.product.code + ' - ' + mf.product.name">
{{ mf.product.code }} - {{ mf.product.name }}
</v-text-field> </v-text-field>
</v-col> </v-col>
<v-col cols="6"> <v-col cols="6">
@ -80,7 +46,7 @@
<v-switch color="blue" label="Repeat prescription" v-model="mf.repeat"></v-switch> <v-switch color="blue" label="Repeat prescription" v-model="mf.repeat"></v-switch>
</v-col> </v-col>
<v-col cols="6"> <v-col cols="6">
<v-textarea :disabled="!mf.repeat" label="Repeat Message" v-model="mf.repeat_message"></v-textarea> <v-textarea :disabled="!mf.repeat" label="Repeat Message" v-model="mf.repeat_message" variant="outlined"></v-textarea>
</v-col> </v-col>
</v-row> </v-row>
</v-container> </v-container>
@ -104,12 +70,20 @@
<v-dialog v-model="search[1]"> <v-dialog v-model="search[1]">
<ProductSearch @returnProduct="setProduct"></ProductSearch> <ProductSearch @returnProduct="setProduct"></ProductSearch>
</v-dialog> </v-dialog>
<v-dialog v-model="search[2]">
<VetSearch @returnVet="setVet"></VetSearch>
</v-dialog>
<v-dialog v-model="search[3]">
<MedSearch @returnMed="setMed"></MedSearch>
</v-dialog>
</template> </template>
<script> <script>
import DatePicker from '@vuepic/vue-datepicker' import DatePicker from '@vuepic/vue-datepicker'
import axios from 'axios'; import axios from 'axios';
import CustomerSearch from '@/components/CustomerSearch.vue' import CustomerSearch from '@/components/CustomerSearch.vue'
import ProductSearch from '@/components/ProductSearch.vue' import ProductSearch from '@/components/ProductSearch.vue'
import VetSearch from '@/components/VetSearch.vue'
import MedSearch from '@/components/MedSearch.vue'
export default { export default {
props:{ props:{
set_mf: {} set_mf: {}
@ -117,7 +91,9 @@ export default {
components: { components: {
DatePicker, DatePicker,
CustomerSearch, CustomerSearch,
ProductSearch ProductSearch,
VetSearch,
MedSearch
}, },
watch: { watch: {
set_mf(newval) { set_mf(newval) {
@ -143,6 +119,7 @@ export default {
} }
} }
}, },
emits: ['closetab','medfeedupdated'],
methods: { methods: {
close() { close() {
this.$emit('closetab','list') this.$emit('closetab','list')
@ -154,6 +131,7 @@ export default {
}) })
.then(resp => { .then(resp => {
console.log(resp) console.log(resp)
this.$emit('medfeedupdated')
}) })
.catch(err => { .catch(err => {
console.log(err) console.log(err)
@ -172,7 +150,21 @@ export default {
setProduct(p) { setProduct(p) {
this.mf.product = p this.mf.product = p
this.search[1] = false this.search[1] = false
} },
showVetSearch() {
this.search[2] = true
},
setVet(v) {
this.mf.vet = v
this.search[2] = false
},
showMedSearch() {
this.search[3] = true
},
setMed(med) {
this.mf.medication = med
this.search[3] = false
},
}, },
} }
</script> </script>

View file

@ -24,10 +24,9 @@
<v-progress-linear indeterminate color="blue" :active="loading"></v-progress-linear> <v-progress-linear indeterminate color="blue" :active="loading"></v-progress-linear>
<RecycleScroller class="scroller" <RecycleScroller class="scroller"
:items="filteredMedFeeds" :items="filteredMedFeeds"
:item-size="130" :item-size="108"
v-slot="{ item }" v-slot="{ item }"
key-field="id" key-field="id">
>
<v-row class="item" :class="{ at_risk : item.customer.at_risk }"> <v-row class="item" :class="{ at_risk : item.customer.at_risk }">
<v-col cols="4"> <v-col cols="4">
Medicated Feed : {{ item.id }}<br/> Medicated Feed : {{ item.id }}<br/>
@ -68,7 +67,7 @@
</v-row> </v-row>
</v-window-item> </v-window-item>
<v-window-item value="edit"> <v-window-item value="edit">
<MedFeedsEdit :set_mf="selected_mf" @closetab="tab = 'list'" @medfeedupdate="medfeedUpdated" /> <MedFeedsEdit :set_mf="selected_mf" @closetab="tab = 'list'" @medfeedupdated="medfeedUpdated" />
</v-window-item> </v-window-item>
<v-window-item value="scriptreq"> <v-window-item value="scriptreq">
<ScriptReq :mf="selected_mf" :user="user_info"></ScriptReq> <ScriptReq :mf="selected_mf" :user="user_info"></ScriptReq>
@ -175,6 +174,9 @@ export default {
} }
this.edit = true this.edit = true
this.tab = "edit" this.tab = "edit"
},
medfeedUpdated(){
this.getMedFeedsList()
} }
} }
} }
@ -185,9 +187,9 @@ export default {
} }
.item { .item {
height: 138px; height: 100px;
overflow-y:hidden; overflow-y:hidden;
padding: 0 12px; padding: 0 1em;
margin-bottom:2px; margin-bottom:2px;
display: flex; display: flex;
align-items: center; align-items: center;