diff --git a/resources/assets/js/views/estimates/View.vue b/resources/assets/js/views/estimates/View.vue index de92043a..6c6c3879 100644 --- a/resources/assets/js/views/estimates/View.vue +++ b/resources/assets/js/views/estimates/View.vue @@ -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) { diff --git a/resources/assets/js/views/invoices/View.vue b/resources/assets/js/views/invoices/View.vue index be415123..0bb594de 100644 --- a/resources/assets/js/views/invoices/View.vue +++ b/resources/assets/js/views/invoices/View.vue @@ -154,6 +154,7 @@ export default { id: null, count: null, invoices: [], + invoice: null, currency: null, searchData: { orderBy: null, @@ -167,9 +168,7 @@ export default { } }, computed: { - invoice () { - return this.$store.getters['invoice/getInvoice'](this.$route.params.id) - }, + getOrderBy () { if (this.searchData.orderBy === 'asc' || this.searchData.orderBy == null) { return true @@ -180,8 +179,14 @@ export default { return `/invoices/pdf/${this.invoice.unique_hash}` } }, + watch: { + $route (to, from) { + this.loadInvoice() + } + }, created () { this.loadInvoices() + this.loadInvoice() this.onSearch = _.debounce(this.onSearch, 500) }, methods: { @@ -192,7 +197,8 @@ export default { 'markAsSent', 'sendEmail', 'deleteInvoice', - 'selectInvoice' + 'selectInvoice', + 'fetchViewInvoice' ]), async loadInvoices () { let response = await this.fetchInvoices() @@ -200,6 +206,13 @@ export default { this.invoices = response.data.invoices.data } }, + async loadInvoice () { + let response = await this.fetchViewInvoice(this.$route.params.id) + + if (response.data) { + this.invoice = response.data.invoice + } + }, async onSearch () { let data = '' if (this.searchData.searchText !== '' && this.searchData.searchText !== null && this.searchData.searchText !== undefined) { diff --git a/resources/views/app/pdf/estimate/estimate1.blade.php b/resources/views/app/pdf/estimate/estimate1.blade.php index 2be69f21..7fc1668a 100644 --- a/resources/views/app/pdf/estimate/estimate1.blade.php +++ b/resources/views/app/pdf/estimate/estimate1.blade.php @@ -410,7 +410,7 @@