Skip to content

Commit

Permalink
fix report download & payments delete issue
Browse files Browse the repository at this point in the history
  • Loading branch information
raishvaria committed Jan 27, 2020
1 parent bc4e6a0 commit a7275aa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 24 deletions.
4 changes: 3 additions & 1 deletion resources/assets/js/store/modules/item/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export const fatchItemUnit = ({ commit, dispatch, state }, id) => {
export const deleteItemUnit = ({ commit, dispatch, state }, id) => {
return new Promise((resolve, reject) => {
window.axios.delete(`/api/units/${id}`).then((response) => {
commit(types.DELETE_ITEM_UNIT, id)
if (!response.data.error) {
commit(types.DELETE_ITEM_UNIT, id)
}
resolve(response)
}).catch((err) => {
reject(err)
Expand Down
4 changes: 3 additions & 1 deletion resources/assets/js/store/modules/payment/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ export const fetchPaymentMode = ({ commit, dispatch, state }, data) => {
export const deletePaymentMode = ({ commit, dispatch, state }, id) => {
return new Promise((resolve, reject) => {
window.axios.delete(`/api/payment-methods/${id}`).then((response) => {
commit(types.DELETE_PAYMENT_MODE, id)
if (!response.data.error) {
commit(types.DELETE_PAYMENT_MODE, id)
}
resolve(response)
}).catch((err) => {
reject(err)
Expand Down
8 changes: 3 additions & 5 deletions resources/assets/js/views/reports/ExpensesReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,9 @@ export default {
if (!this.getReports()) {
return false
}
if (navigator.appVersion.indexOf('Mac') !== -1) {
this.url += '&download=true'
} else {
window.open(this.getReportUrl + '&download=true')
}
window.open(this.getReportUrl + '&download=true')
setTimeout(() => {
this.url = `${this.siteURL}?from_date=${moment(this.formData.from_date).format('DD/MM/YYYY')}&to_date=${moment(this.formData.to_date).format('DD/MM/YYYY')}`
}, 200)
Expand Down
9 changes: 3 additions & 6 deletions resources/assets/js/views/reports/ProfitLossReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default {
this.loadProfitLossLink(this.url + '&download=true')
},
methods: {
...mapActions('profitLossReport',[
...mapActions('profitLossReport', [
'loadProfitLossLink'
]),
getThisDate (type, time) {
Expand Down Expand Up @@ -203,11 +203,8 @@ export default {
if (!this.getReports()) {
return false
}
if (navigator.appVersion.indexOf('Mac') !== -1) {
this.url += '&download=true'
} else {
window.open(this.getReportUrl + '&download=true')
}
window.open(this.getReportUrl + '&download=true')
setTimeout(() => {
this.url = `${this.siteURL}?from_date=${moment(this.formData.from_date).format('DD/MM/YYYY')}&to_date=${moment(this.formData.to_date).format('DD/MM/YYYY')}`
}, 200)
Expand Down
7 changes: 2 additions & 5 deletions resources/assets/js/views/reports/SalesReports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,8 @@ export default {
if (!this.getReports()) {
return false
}
if (navigator.appVersion.indexOf('Mac') !== -1) {
this.url += '&download=true'
} else {
window.open(this.getReportUrl + '&download=true')
}
window.open(this.getReportUrl + '&download=true')
setTimeout(() => {
if (this.selectedType === 'By Customer') {
this.url = `${this.customerSiteURL}?from_date=${moment(this.formData.from_date).format('DD/MM/YYYY')}&to_date=${moment(this.formData.to_date).format('DD/MM/YYYY')}`
Expand Down
11 changes: 5 additions & 6 deletions resources/assets/js/views/reports/TaxReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
<div class="col-sm-8 reports-tab-container">
<iframe :src="getReportUrl" class="reports-frame-style"/>
<a class="base-button btn btn-primary btn-lg report-view-button" @click="viewReportsPDF">
<font-awesome-icon icon="file-pdf" class="vue-icon icon-left svg-inline--fa fa-download fa-w-16 mr-2" /> <span>{{ $t('reports.view_pdf') }}</span>
<font-awesome-icon icon="file-pdf" class="vue-icon icon-left svg-inline--fa fa-download fa-w-16 mr-2" />
<span>{{ $t('reports.view_pdf') }}</span>
</a>
</div>
</div>
Expand Down Expand Up @@ -199,11 +200,9 @@ export default {
if (!this.getReports()) {
return false
}
if (navigator.appVersion.indexOf('Mac') !== -1) {
this.url += '&download=true'
} else {
window.open(this.url + '&download=true')
}
window.open(this.url + '&download=true')
setTimeout(() => {
this.url = `${this.siteURL}?from_date=${moment(this.formData.from_date).format('DD/MM/YYYY')}&to_date=${moment(this.formData.to_date).format('DD/MM/YYYY')}`
}, 200)
Expand Down

0 comments on commit a7275aa

Please sign in to comment.