better saving/loading in contracts and med feeds, handlers for adding med feed
This commit is contained in:
parent
43ab44794c
commit
64fcfff373
2 changed files with 20 additions and 12 deletions
|
@ -69,9 +69,11 @@
|
|||
<v-card-actions>
|
||||
<v-btn v-if="!contract.isNew" color="red-darken-1"
|
||||
variant="text"
|
||||
:loading="saving"
|
||||
@click="saveContract(selected_contract)">Save</v-btn>
|
||||
<v-btn v-if="contract.isNew" color="red-darken-1"
|
||||
variant="text"
|
||||
:loading="saving"
|
||||
@click="saveContract(selected_contract)">Add</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue-darken-1"
|
||||
|
@ -167,7 +169,6 @@ export default {
|
|||
}).then(resp => {
|
||||
console.log("Saved Contract : " + JSON.stringify(resp.data))
|
||||
this.saving = false
|
||||
if (resp.data == true) {
|
||||
let stat = resp.data
|
||||
if (stat.status == true ) {
|
||||
if (this.contract.isNew) {
|
||||
|
@ -175,9 +176,6 @@ export default {
|
|||
} else {
|
||||
this.$emit('contractupdate', resp.data)
|
||||
}
|
||||
} else {
|
||||
this.errors.push("Error Saving... ")
|
||||
}
|
||||
} else {
|
||||
this.errors.push("Contract not saved.")
|
||||
console.log("Not Saved")
|
||||
|
|
|
@ -55,9 +55,11 @@
|
|||
<v-card-actions>
|
||||
<v-btn v-if="!mf.isNew" color="red-darken-1"
|
||||
variant="text"
|
||||
:loading="saving"
|
||||
@click="saveMedFeed(mf)">Save</v-btn>
|
||||
<v-btn v-if="mf.isNew" color="red-darken-1"
|
||||
variant="text"
|
||||
:loading="saving"
|
||||
@click="saveMedFeed(mf)">Add</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue-darken-1"
|
||||
|
@ -109,7 +111,8 @@ export default {
|
|||
products: [],
|
||||
search: [],
|
||||
searching: {},
|
||||
errors: []
|
||||
errors: [],
|
||||
saving: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -128,7 +131,11 @@ export default {
|
|||
},
|
||||
saveMedFeed(medfeed) {
|
||||
this.errors = []
|
||||
this.saving = true
|
||||
let url = this.$api_url + "/customers/medicated-feeds/" + this.mf.id + "/save"
|
||||
if (this.contract.isNew) {
|
||||
url = this.$api_url + "/customers/medicated-feeds/add"
|
||||
}
|
||||
console.log("Saving Med Feed...")
|
||||
axios.put(url,{
|
||||
medfeed: medfeed
|
||||
|
@ -144,6 +151,9 @@ export default {
|
|||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
.finally(()=>{
|
||||
this.saving = false
|
||||
})
|
||||
},
|
||||
showCustomerSearch(){
|
||||
this.search[0] = true
|
||||
|
|
Loading…
Reference in a new issue