Searching mobile frontend

This commit is contained in:
Peter Papp
2021-04-22 10:10:26 +02:00
parent 3774a05edd
commit 90f91c47ce
5 changed files with 38 additions and 31 deletions

View File

@@ -7,6 +7,29 @@ import axios from 'axios'
const Helpers = {
install(Vue) {
Vue.prototype.$searchInvoices = debounce(function (value) {
if (value !== '' && typeof value !== 'undefined') {
if (['regular-invoice', 'advance-invoice'].includes(this.$store.getters.currentFolder.location)) {
this.$store.dispatch('getSearchResultForInvoices', value)
} else {
this.$store.dispatch('getSearchResultForClients', value)
}
} else if (typeof value !== 'undefined') {
let locations = {
'regular-invoice': 'getRegularInvoices',
'advance-invoice': 'getAdvanceInvoices',
'clients': 'getClients',
}
this.$store.dispatch(locations[this.$store.getters.currentFolder.location])
this.$store.commit('CHANGE_SEARCHING_STATE', false)
}
}, 300)
Vue.prototype.$searchFiles = debounce(function (value) {
if (value !== '' && typeof value !== 'undefined') {