contracts and med feeds by acc_no

This commit is contained in:
Paul Wilde 2023-03-21 15:06:42 +00:00
parent 623b107f65
commit a46eebe5d3
5 changed files with 41 additions and 14 deletions

View file

@ -27,8 +27,9 @@ export default {
methods: { methods: {
saveComment() { saveComment() {
this.saving = true this.saving = true
let url = this.$api_url + "/customers/" + this.customer.acc_no + "/comments" let url = this.$api_url + "/customers/comments"
axios.put(url, { axios.put(url, {
acc_no: this.customer.acc_no,
comment: this.comment comment: this.comment
}) })
.then(resp => { .then(resp => {

View file

@ -39,11 +39,21 @@ const routes = [
name: 'contractlist', name: 'contractlist',
component: ContractList component: ContractList
}, },
{
path: '/customers/contracts/list/:id',
name: 'contractlistid',
component: ContractList
},
{ {
path: '/customers/medicated-feeds/list', path: '/customers/medicated-feeds/list',
name: 'medfeedslist', name: 'medfeedslist',
component: MedFeedsList component: MedFeedsList
}, },
{
path: '/customers/medicated-feeds/list/:id',
name: 'medfeedslistid',
component: MedFeedsList
},
{ {
path: '/customers/complaints/list', path: '/customers/complaints/list',
name: 'complaintslist', name: 'complaintslist',

View file

@ -1,5 +1,5 @@
<template> <template>
<h3>Contracts</h3> <h3>Contracts {{ $route.params.id }}</h3>
<v-tabs v-model="tab" class="my-2"> <v-tabs v-model="tab" class="my-2">
<v-tab value="list">List</v-tab> <v-tab value="list">List</v-tab>
<v-tab value="edit" v-if="edit">Edit</v-tab> <v-tab value="edit" v-if="edit">Edit</v-tab>
@ -199,11 +199,13 @@ export default {
async getContractsList() { async getContractsList() {
this.loading = true this.loading = true
let url = this.$api_url + "/customers/contracts/list" let url = this.$api_url + "/customers/contracts/list"
console.log("Getting Contracts list...") let acc_no = this.$route.params.id || ""
console.log("Getting Contracts list..." + acc_no)
axios.get(url, { axios.get(url, {
params: { params: {
limit: this.limit, limit: this.limit,
query: this.searchQuery query: this.searchQuery,
acc_no: acc_no
} }
}) })
.then(resp => { .then(resp => {

View file

@ -19,16 +19,18 @@
key-field="acc_no" key-field="acc_no"
v-slot="{ item }" v-slot="{ item }"
> >
<v-list-item @click="getCustomerComments(item)"> <v-list-item >
<template v-slot:title> <template v-slot:title >
<v-card @click="getCustomerComments(item)">
{{ item.acc_no }} - {{ item.name }}: {{ item.acc_no }} - {{ item.name }}:
<span class="text-caption">{{ item.address.line_1 }}, {{ item.address.line_2 }}, <br/> <span class="text-caption">{{ item.address.line_1 }}, {{ item.address.line_2 }}, <br/>
{{ item.address.city }}, {{ item.address.county}}, {{ item.address.postcode }}, {{ item.address.city }}, {{ item.address.county}}, {{ item.address.postcode }},
</span> </span>
</v-card>
</template> </template>
<template v-slot:append> <template v-slot:append>
<v-btn color="info">Contracts</v-btn> <v-btn @click.prevent="goToContracts(item)" color="info">Contracts</v-btn>
<v-btn color="warning">Med Feeds</v-btn> <v-btn @click.prevent="goToMedFeeds(item)" color="warning">Med Feeds</v-btn>
</template> </template>
</v-list-item> </v-list-item>
</RecycleScroller> </RecycleScroller>
@ -97,7 +99,13 @@ export default {
}, },
}, },
methods: { methods: {
showAddNote(){ goToContracts(c){
this.$router.push('/customers/contracts/list/' + c.acc_no)
},
goToMedFeeds(c){
this.$router.push('/customers/medicated-feeds/list/' + c.acc_no)
},
showAddNote() {
this.dialog[0] = true this.dialog[0] = true
}, },
closeAddNote(e){ closeAddNote(e){
@ -109,8 +117,12 @@ export default {
getCustomerComments(cust){ getCustomerComments(cust){
this.selected_cust = cust this.selected_cust = cust
this.comments_loading = true this.comments_loading = true
let url = this.$api_url + "/customers/" + cust.acc_no + "/comments" let url = this.$api_url + "/customers/comments"
axios.get(url) axios.get(url,{
params: {
acc_no: cust.acc_no
}
})
.then(resp => { .then(resp => {
this.comments = resp.data this.comments = resp.data
}) })

View file

@ -1,5 +1,5 @@
<template> <template>
<h3>Medicated Feeds</h3> <h3>Medicated Feeds {{ $route.params.id }}</h3>
<v-tabs v-model="tab"> <v-tabs v-model="tab">
<v-tab value="list" >List</v-tab> <v-tab value="list" >List</v-tab>
<v-tab value="edit" v-if="edit">Edit</v-tab> <v-tab value="edit" v-if="edit">Edit</v-tab>
@ -127,11 +127,13 @@ export default {
async getMedFeedsList(){ async getMedFeedsList(){
this.loading = true this.loading = true
let url = this.$api_url + "/customers/medicated-feeds/list" let url = this.$api_url + "/customers/medicated-feeds/list"
console.log("Getting Medicated Feeds list...") let acc_no = this.$route.params.id || ""
console.log("Getting Medicated Feeds list..." + acc_no)
axios.get(url,{ axios.get(url,{
params: { params: {
limit: this.limit, limit: this.limit,
query: this.searchQuery query: this.searchQuery,
acc_no: acc_no
} }
}).then(resp => { }).then(resp => {
this.list = resp.data this.list = resp.data