- invoice fixes

- optimization for new invoicing module
This commit is contained in:
Peter Papp
2021-05-24 16:47:21 +02:00
parent 26636dffab
commit 8a2af11f6a
9 changed files with 224 additions and 88 deletions
+5 -12
View File
@@ -117,29 +117,22 @@
methods: {
goTo(location) {
let routes = {
'regular-invoice': 'getRegularInvoices',
'advance-invoice': 'getAdvanceInvoices',
'clients': 'getClients',
'regular-invoice': ['getInvoices', 'regular-invoice'],
'advance-invoice': ['getInvoices', 'advance-invoice'],
'clients': ['getClients'],
}
if (this.$route.name !== 'InvoicesList') {
this.$router.push({name: 'InvoicesList'})
}
this.$store.dispatch(routes[location])
this.$store.dispatch(...routes[location])
},
},
mounted() {
if (! this.currentFolder) {
this.$store.commit('STORE_CURRENT_FOLDER', {
name: this.$t('in.nav.invoices'),
id: undefined,
location: 'regular-invoice',
})
this.$store.dispatch('getRegularInvoices')
this.$store.dispatch('getInvoices', 'regular-invoice')
}
events.$on('mobile-menu:show', () => this.isScaledDown = true)
@@ -516,6 +516,12 @@
},
'invoice.client_ico': function (val) {
this.getCompanyDetails(val)
},
'isDiscount': function (val) {
if (!val) {
this.invoice.discount_type = undefined
this.invoice.discount_rate = undefined
}
}
},
data() {
@@ -636,10 +642,7 @@
})
// Reload invoices and go to invoice page
this.$store.dispatch({
'regular-invoice': 'getRegularInvoices',
'advance-invoice': 'getAdvanceInvoices',
}[this.invoice.invoice_type])
this.$store.dispatch('getInvoices', this.invoice.invoice_type)
this.$router.push({name: 'InvoicesList'})
})
@@ -416,6 +416,14 @@
return total
}
},
watch: {
'isDiscount': function (val) {
if (!val) {
this.invoice.discount_type = undefined
this.invoice.discount_rate = undefined
}
}
},
data() {
return {
fullDetails: undefined,
@@ -498,10 +506,7 @@
.put(`/api/v1/invoicing/invoices/${this.$route.params.id}`, this.invoice)
.then(() => {
this.$store.dispatch({
'regular-invoice': 'getRegularInvoices',
'advance-invoice': 'getAdvanceInvoices',
}[this.invoice.invoice_type])
this.$store.dispatch('getInvoices', this.invoice.invoice_type)
this.$router.push({name: 'InvoicesList'})
@@ -35,11 +35,11 @@ export default {
methods: {
showLocation(location) {
let routes = {
'regular-invoice': 'getRegularInvoices',
'advance-invoice': 'getAdvanceInvoices',
'clients': 'getClients',
'regular-invoice': ['getInvoices', 'regular-invoice'],
'advance-invoice': ['getInvoices', 'advance-invoice'],
'clients': ['getClients'],
}
this.$store.dispatch(routes[location])
this.$store.dispatch(...routes[location])
}
}
}