From d56230a9a9c52f5a64d0ea040e8130d3873a41d2 Mon Sep 17 00:00:00 2001 From: Alexandro Uc Santos Date: Sat, 9 Nov 2024 16:34:47 -0600 Subject: [PATCH] fixes: loads search & locations load --- src/composables/userSearchLoads.js | 2 ++ src/stores/company.js | 6 +++--- src/views/HomeView.vue | 7 +++---- src/views/SearchLoadsView.vue | 8 ++++---- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/composables/userSearchLoads.js b/src/composables/userSearchLoads.js index d6a782d..5bac474 100644 --- a/src/composables/userSearchLoads.js +++ b/src/composables/userSearchLoads.js @@ -17,7 +17,9 @@ export default function useSearchLoads() { } try { const endpoint = `/v1/loads/find${filterStr}&$sort[createdAt]=-1`; + console.log(endpoint); const {data} = await api.get(endpoint); + console.log(data); total.value = data.total; loads.value = data.data; } catch (error) { diff --git a/src/stores/company.js b/src/stores/company.js index 4889d96..8344683 100644 --- a/src/stores/company.js +++ b/src/stores/company.js @@ -302,11 +302,11 @@ export const useCompanyStore = defineStore('company', () => { } const getLocationsLoads = async(type) => { - console.log(type); + // console.log(type); let locationsType = (type === 'loading') ? locationsLoad.value : locationsDowload.value; - console.log(locationsType); + // console.log(locationsType); if(locationsType.length <= 0) { - const filterStr = "?company="+ localStorage.getItem('id') + '&$limit=100'; + const filterStr = "?company="+ localStorage.getItem('id') + '&elements=100'; const respBoth = await getLocations(filterStr + '&type=' + 'both'); const resp = await getLocations(filterStr + '&type=' + type); if(resp !== null && resp.total > 0) { diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 4da2a30..2ed0908 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -80,13 +80,12 @@

{{ t('dashboard.totalLoads') }}

-
+
{{ nOfLoads }} -
+ 23% -
+
-->
diff --git a/src/views/SearchLoadsView.vue b/src/views/SearchLoadsView.vue index b9527f6..a700ec5 100644 --- a/src/views/SearchLoadsView.vue +++ b/src/views/SearchLoadsView.vue @@ -44,7 +44,7 @@ watch(selectedState, () => { if(selectedState.value != null){ setFilterUnlimited() - filterQuery.value.state = "origin.state[$in][]="+ selectedState.value.state_name; + filterQuery.value.state = "state="+ selectedState.value.state_name; getLoadsPublished(filterQuery.value); } }); @@ -52,7 +52,7 @@ watch(selectedCities, () => { if(selectedCities.value != null){ setFilterUnlimited() - filterQuery.value.city = "origin.city[$regex]="+ selectedCities.value.city_name; + filterQuery.value.city = "city="+ selectedCities.value.city_name; getLoadsPublished(filterQuery.value); } }); @@ -60,7 +60,7 @@ watch(selectedCategory, () => { if(selectedCategory.value != null){ setFilterUnlimited() - filterQuery.value.category = "categories[$in][]=" + selectedCategory.value._id; + filterQuery.value.category = "categories=" + selectedCategory.value._id; getLoadsPublished(filterQuery.value); } }); @@ -68,7 +68,7 @@ watch(selectedTruckType, () => { if(selectedTruckType.value != null){ setFilterUnlimited() - filterQuery.value.truck_type = "truck_type[$in][]="+ selectedTruckType.value.meta_value; + filterQuery.value.truck_type = "truck_type="+ selectedTruckType.value.meta_value; getLoadsPublished(filterQuery.value); } });