fix search issues

This commit is contained in:
Mohit Panjwani
2022-02-15 11:32:30 +05:30
parent 84f5890294
commit 9e23f9b9b1
5 changed files with 29 additions and 21 deletions

View File

@ -145,7 +145,7 @@
truncate
"
/>
<BaseText
v-if="customer.contact_name"
:text="customer.contact_name"
@ -170,12 +170,12 @@
</div>
<div class="flex justify-center p-4 items-center">
<LoadingIcon
v-if="isFetching"
v-if="isFetching || isSearching"
class="h-6 m-1 animate-spin text-primary-400"
/>
</div>
<p
v-if="!customerStore.customers.length && !isFetching"
v-if="!customerStore.customers.length && !isFetching && !isSearching"
class="flex justify-center px-4 mt-5 text-sm text-gray-600"
>
{{ $t('customers.no_matching_customers') }}

View File

@ -246,11 +246,14 @@
</div>
</router-link>
</div>
<div v-if="isLoading" class="flex justify-center p-4 items-center">
<div
v-if="isLoading || isSearching"
class="flex justify-center p-4 items-center"
>
<LoadingIcon class="h-6 m-1 animate-spin text-primary-400" />
</div>
<p
v-if="!estimateStore.estimates.length && !isLoading"
v-if="!estimateList.length && !isLoading && !isSearching"
class="flex justify-center px-4 mt-5 text-sm text-gray-600"
>
{{ $t('estimates.no_matching_estimates') }}
@ -453,7 +456,7 @@ async function onSearched() {
let response = await estimateStore.searchEstimate(data)
isSearching.value = false
if (response.data) {
estimateStore.estimates = response.data.data
estimateList.value = response.data.data
}
}

View File

@ -125,9 +125,7 @@ async function loadInvoices(params, fromScrollListener = false) {
currentPageNumber.value = params ? params.page : 1
lastPageNumber.value = response.data.meta.last_page
let invoiceFound = invoiceList.value.find(
(inv) => inv.id == route.params.id
)
let invoiceFound = invoiceList.value.find((inv) => inv.id == route.params.id)
if (
fromScrollListener == false &&
@ -199,7 +197,7 @@ async function onSearched() {
let response = await invoiceStore.searchInvoice(data)
isSearching.value = false
if (response.data) {
invoiceStore.invoices = response.data.data
invoiceList.value = response.data.data
}
}
@ -480,11 +478,14 @@ onSearched = debounce(onSearched, 500)
</div>
</router-link>
</div>
<div v-if="isLoading" class="flex justify-center p-4 items-center">
<div
v-if="isLoading || isSearching"
class="flex justify-center p-4 items-center"
>
<LoadingIcon class="h-6 m-1 animate-spin text-primary-400" />
</div>
<p
v-if="!invoiceStore.invoices.length && !isLoading"
v-if="!invoiceList?.length && !isLoading && !isSearching"
class="flex justify-center px-4 mt-5 text-sm text-gray-600"
>
{{ $t('invoices.no_matching_invoices') }}

View File

@ -222,11 +222,14 @@
</div>
</router-link>
</div>
<div v-if="isLoading" class="flex justify-center p-4 items-center">
<div
v-if="isLoading || isSearching"
class="flex justify-center p-4 items-center"
>
<LoadingIcon class="h-6 m-1 animate-spin text-primary-400" />
</div>
<p
v-if="!paymentStore?.payments?.length && !isLoading"
v-if="!paymentList?.length && !isLoading && !isSearching"
class="flex justify-center px-4 mt-5 text-sm text-gray-600"
>
{{ $t('payments.no_matching_payments') }}
@ -438,7 +441,7 @@ async function onSearch() {
isSearching.value = false
if (response.data.data) {
paymentStore.payments = response.data.data
paymentList.value = response.data.data
}
} catch (error) {
isSearching.value = false

View File

@ -52,9 +52,7 @@ async function loadRecurringInvoices(params, fromScrollListener = false) {
currentPageNumber.value = params ? params.page : 1
lastPageNumber.value = response.data.meta.last_page
let invoiceFound = invoiceList.value.find(
(inv) => inv.id == route.params.id
)
let invoiceFound = invoiceList.value.find((inv) => inv.id == route.params.id)
if (
fromScrollListener == false &&
@ -119,7 +117,7 @@ async function onSearched() {
let response = await recurringInvoiceStore.searchRecurringInvoice(data)
isSearching.value = false
if (response.data) {
recurringInvoiceStore.recurringInvoices = response.data.data
invoiceList.value = response.data.data
}
}
@ -329,11 +327,14 @@ onSearched = debounce(onSearched, 500)
</div>
</router-link>
</div>
<div v-if="isLoading" class="flex justify-center p-4 items-center">
<div
v-if="isLoading || isSearching"
class="flex justify-center p-4 items-center"
>
<LoadingIcon class="h-6 m-1 animate-spin text-primary-400" />
</div>
<p
v-if="!recurringInvoiceStore.recurringInvoices.length && !isLoading"
v-if="!invoiceList?.length && !isLoading && !isSearching"
class="flex justify-center px-4 mt-5 text-sm text-gray-600"
>
{{ $t('invoices.no_matching_invoices') }}