Merge branch 'fix-view-issue' into 'master'

fix invoice & estimate view issue

See merge request mohit.panjvani/crater-web!129
This commit is contained in:
Mohit Panjwani
2019-12-09 05:59:44 +00:00
5 changed files with 36 additions and 12 deletions

View File

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

View File

@ -154,6 +154,7 @@ export default {
id: null, id: null,
count: null, count: null,
invoices: [], invoices: [],
invoice: null,
currency: null, currency: null,
searchData: { searchData: {
orderBy: null, orderBy: null,
@ -167,9 +168,7 @@ export default {
} }
}, },
computed: { computed: {
invoice () {
return this.$store.getters['invoice/getInvoice'](this.$route.params.id)
},
getOrderBy () { getOrderBy () {
if (this.searchData.orderBy === 'asc' || this.searchData.orderBy == null) { if (this.searchData.orderBy === 'asc' || this.searchData.orderBy == null) {
return true return true
@ -180,8 +179,14 @@ export default {
return `/invoices/pdf/${this.invoice.unique_hash}` return `/invoices/pdf/${this.invoice.unique_hash}`
} }
}, },
watch: {
$route (to, from) {
this.loadInvoice()
}
},
created () { created () {
this.loadInvoices() this.loadInvoices()
this.loadInvoice()
this.onSearch = _.debounce(this.onSearch, 500) this.onSearch = _.debounce(this.onSearch, 500)
}, },
methods: { methods: {
@ -192,7 +197,8 @@ export default {
'markAsSent', 'markAsSent',
'sendEmail', 'sendEmail',
'deleteInvoice', 'deleteInvoice',
'selectInvoice' 'selectInvoice',
'fetchViewInvoice'
]), ]),
async loadInvoices () { async loadInvoices () {
let response = await this.fetchInvoices() let response = await this.fetchInvoices()
@ -200,6 +206,13 @@ export default {
this.invoices = response.data.invoices.data 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 () { async onSearch () {
let data = '' let data = ''
if (this.searchData.searchText !== '' && this.searchData.searchText !== null && this.searchData.searchText !== undefined) { if (this.searchData.searchText !== '' && this.searchData.searchText !== null && this.searchData.searchText !== undefined) {

View File

@ -410,7 +410,7 @@
<div class="bill-address-container"> <div class="bill-address-container">
@include('app.pdf.estimate.partials.billing-address') @include('app.pdf.estimate.partials.billing-address')
</div> </div>
@if($estimate->user->billingaddress->name || $estimate->user->billingaddress->address_street_1 || $estimate->user->billingaddress->address_street_2 || $estimate->user->billingaddress->country || $estimate->user->billingaddress->state || $estimate->user->billingaddress->city || $estimate->user->billingaddress->zip || $estimate->user->billingaddress->phone) @if($estimate->user->billingaddress && ($estimate->user->billingaddress->name || $estimate->user->billingaddress->address_street_1 || $estimate->user->billingaddress->address_street_2 || $estimate->user->billingaddress->country || $estimate->user->billingaddress->state || $estimate->user->billingaddress->city || $estimate->user->billingaddress->zip || $estimate->user->billingaddress->phone))
<div class="ship-address-container"> <div class="ship-address-container">
@else @else
<div class="ship-address-container " style="float:left;padding-left:0px;"> <div class="ship-address-container " style="float:left;padding-left:0px;">

View File

@ -421,7 +421,7 @@
<div class="ship-address-container"> <div class="ship-address-container">
@include('app.pdf.estimate.partials.shipping-address') @include('app.pdf.estimate.partials.shipping-address')
</div> </div>
@if($estimate->user->shippingaddress->name || $estimate->user->shippingaddress->address_street_1 || $estimate->user->shippingaddress->address_street_2 || $estimate->user->shippingaddress->country || $estimate->user->shippingaddress->state || $estimate->user->shippingaddress->city || $estimate->user->shippingaddress->zip || $estimate->user->phone) @if($estimate->user->shippingaddress && ($estimate->user->shippingaddress->name || $estimate->user->shippingaddress->address_street_1 || $estimate->user->shippingaddress->address_street_2 || $estimate->user->shippingaddress->country || $estimate->user->shippingaddress->state || $estimate->user->shippingaddress->city || $estimate->user->shippingaddress->zip || $estimate->user->phone))
<div class="bill-address-container"> <div class="bill-address-container">
@else @else
<div class="bill-address-container" style="float:right;padding-right:0px;"> <div class="bill-address-container" style="float:right;padding-right:0px;">

View File

@ -426,7 +426,7 @@
<div style="float:left;"> <div style="float:left;">
@include('app.pdf.estimate.partials.billing-address') @include('app.pdf.estimate.partials.billing-address')
</div> </div>
@if($estimate->user->billingaddress->name || $estimate->user->billingaddress->address_street_1 || $estimate->user->billingaddress->address_street_2 || $estimate->user->billingaddress->country || $estimate->user->billingaddress->state || $estimate->user->billingaddress->city || $estimate->user->billingaddress->zip || $estimate->user->billingaddress->phone) @if($estimate->user->billingaddress && ($estimate->user->billingaddress->name || $estimate->user->billingaddress->address_street_1 || $estimate->user->billingaddress->address_street_2 || $estimate->user->billingaddress->country || $estimate->user->billingaddress->state || $estimate->user->billingaddress->city || $estimate->user->billingaddress->zip || $estimate->user->billingaddress->phone))
<div style="float:right;"> <div style="float:right;">
@else @else
<div style="float:left;"> <div style="float:left;">