fix invoice & estimate view issue

This commit is contained in:
raishvaria
2019-12-09 11:19:57 +05:30
parent f4a4c05b61
commit 1cd654b0cc
5 changed files with 36 additions and 12 deletions

View File

@ -151,6 +151,7 @@ export default {
id: null,
count: null,
estimates: [],
estimate: null,
currency: null,
searchData: {
orderBy: null,
@ -165,10 +166,6 @@ export default {
}
},
computed: {
estimate () {
return this.$store.getters['estimate/getEstimate'](this.$route.params.id)
},
getOrderBy () {
if (this.searchData.orderBy === 'asc' || this.searchData.orderBy == null) {
return true
@ -180,8 +177,14 @@ export default {
return `/estimates/pdf/${this.estimate.unique_hash}`
}
},
watch: {
$route (to, from) {
this.loadEstimate()
}
},
created () {
this.loadEstimates()
this.loadEstimate()
this.onSearched = _.debounce(this.onSearched, 500)
},
methods: {
@ -192,7 +195,8 @@ export default {
'markAsSent',
'sendEmail',
'deleteEstimate',
'selectEstimate'
'selectEstimate',
'fetchViewEstimate'
]),
async loadEstimates () {
let response = await this.fetchEstimates()
@ -200,6 +204,13 @@ export default {
this.estimates = response.data.estimates.data
}
},
async loadEstimate () {
let response = await this.fetchViewEstimate(this.$route.params.id)
if (response.data) {
this.estimate = response.data.estimate
}
},
async onSearched () {
let data = ''
if (this.searchData.searchText !== '' && this.searchData.searchText !== null && this.searchData.searchText !== undefined) {