mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-28 04:01:10 -04:00 
			
		
		
		
	fix search issues
This commit is contained in:
		| @ -170,12 +170,12 @@ | |||||||
|       </div> |       </div> | ||||||
|       <div class="flex justify-center p-4 items-center"> |       <div class="flex justify-center p-4 items-center"> | ||||||
|         <LoadingIcon |         <LoadingIcon | ||||||
|           v-if="isFetching" |           v-if="isFetching || isSearching" | ||||||
|           class="h-6 m-1 animate-spin text-primary-400" |           class="h-6 m-1 animate-spin text-primary-400" | ||||||
|         /> |         /> | ||||||
|       </div> |       </div> | ||||||
|       <p |       <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" |         class="flex justify-center px-4 mt-5 text-sm text-gray-600" | ||||||
|       > |       > | ||||||
|         {{ $t('customers.no_matching_customers') }} |         {{ $t('customers.no_matching_customers') }} | ||||||
|  | |||||||
| @ -246,11 +246,14 @@ | |||||||
|             </div> |             </div> | ||||||
|           </router-link> |           </router-link> | ||||||
|         </div> |         </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" /> |           <LoadingIcon class="h-6 m-1 animate-spin text-primary-400" /> | ||||||
|         </div> |         </div> | ||||||
|         <p |         <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" |           class="flex justify-center px-4 mt-5 text-sm text-gray-600" | ||||||
|         > |         > | ||||||
|           {{ $t('estimates.no_matching_estimates') }} |           {{ $t('estimates.no_matching_estimates') }} | ||||||
| @ -453,7 +456,7 @@ async function onSearched() { | |||||||
|   let response = await estimateStore.searchEstimate(data) |   let response = await estimateStore.searchEstimate(data) | ||||||
|   isSearching.value = false |   isSearching.value = false | ||||||
|   if (response.data) { |   if (response.data) { | ||||||
|     estimateStore.estimates = response.data.data |     estimateList.value = response.data.data | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -125,9 +125,7 @@ async function loadInvoices(params, fromScrollListener = false) { | |||||||
|  |  | ||||||
|   currentPageNumber.value = params ? params.page : 1 |   currentPageNumber.value = params ? params.page : 1 | ||||||
|   lastPageNumber.value = response.data.meta.last_page |   lastPageNumber.value = response.data.meta.last_page | ||||||
|   let invoiceFound = invoiceList.value.find( |   let invoiceFound = invoiceList.value.find((inv) => inv.id == route.params.id) | ||||||
|     (inv) => inv.id == route.params.id |  | ||||||
|   ) |  | ||||||
|  |  | ||||||
|   if ( |   if ( | ||||||
|     fromScrollListener == false && |     fromScrollListener == false && | ||||||
| @ -199,7 +197,7 @@ async function onSearched() { | |||||||
|   let response = await invoiceStore.searchInvoice(data) |   let response = await invoiceStore.searchInvoice(data) | ||||||
|   isSearching.value = false |   isSearching.value = false | ||||||
|   if (response.data) { |   if (response.data) { | ||||||
|     invoiceStore.invoices = response.data.data |     invoiceList.value = response.data.data | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| @ -480,11 +478,14 @@ onSearched = debounce(onSearched, 500) | |||||||
|             </div> |             </div> | ||||||
|           </router-link> |           </router-link> | ||||||
|         </div> |         </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" /> |           <LoadingIcon class="h-6 m-1 animate-spin text-primary-400" /> | ||||||
|         </div> |         </div> | ||||||
|         <p |         <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" |           class="flex justify-center px-4 mt-5 text-sm text-gray-600" | ||||||
|         > |         > | ||||||
|           {{ $t('invoices.no_matching_invoices') }} |           {{ $t('invoices.no_matching_invoices') }} | ||||||
|  | |||||||
| @ -222,11 +222,14 @@ | |||||||
|             </div> |             </div> | ||||||
|           </router-link> |           </router-link> | ||||||
|         </div> |         </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" /> |           <LoadingIcon class="h-6 m-1 animate-spin text-primary-400" /> | ||||||
|         </div> |         </div> | ||||||
|         <p |         <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" |           class="flex justify-center px-4 mt-5 text-sm text-gray-600" | ||||||
|         > |         > | ||||||
|           {{ $t('payments.no_matching_payments') }} |           {{ $t('payments.no_matching_payments') }} | ||||||
| @ -438,7 +441,7 @@ async function onSearch() { | |||||||
|     isSearching.value = false |     isSearching.value = false | ||||||
|  |  | ||||||
|     if (response.data.data) { |     if (response.data.data) { | ||||||
|       paymentStore.payments = response.data.data |       paymentList.value = response.data.data | ||||||
|     } |     } | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     isSearching.value = false |     isSearching.value = false | ||||||
|  | |||||||
| @ -52,9 +52,7 @@ async function loadRecurringInvoices(params, fromScrollListener = false) { | |||||||
|  |  | ||||||
|   currentPageNumber.value = params ? params.page : 1 |   currentPageNumber.value = params ? params.page : 1 | ||||||
|   lastPageNumber.value = response.data.meta.last_page |   lastPageNumber.value = response.data.meta.last_page | ||||||
|   let invoiceFound = invoiceList.value.find( |   let invoiceFound = invoiceList.value.find((inv) => inv.id == route.params.id) | ||||||
|     (inv) => inv.id == route.params.id |  | ||||||
|   ) |  | ||||||
|  |  | ||||||
|   if ( |   if ( | ||||||
|     fromScrollListener == false && |     fromScrollListener == false && | ||||||
| @ -119,7 +117,7 @@ async function onSearched() { | |||||||
|   let response = await recurringInvoiceStore.searchRecurringInvoice(data) |   let response = await recurringInvoiceStore.searchRecurringInvoice(data) | ||||||
|   isSearching.value = false |   isSearching.value = false | ||||||
|   if (response.data) { |   if (response.data) { | ||||||
|     recurringInvoiceStore.recurringInvoices = response.data.data |     invoiceList.value = response.data.data | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| @ -329,11 +327,14 @@ onSearched = debounce(onSearched, 500) | |||||||
|           </div> |           </div> | ||||||
|         </router-link> |         </router-link> | ||||||
|       </div> |       </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" /> |         <LoadingIcon class="h-6 m-1 animate-spin text-primary-400" /> | ||||||
|       </div> |       </div> | ||||||
|       <p |       <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" |         class="flex justify-center px-4 mt-5 text-sm text-gray-600" | ||||||
|       > |       > | ||||||
|         {{ $t('invoices.no_matching_invoices') }} |         {{ $t('invoices.no_matching_invoices') }} | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user