fixes: loads search & locations load

This commit is contained in:
Alexandro Uc Santos
2024-11-09 16:34:47 -06:00
parent 23e691c2e3
commit d56230a9a9
4 changed files with 12 additions and 11 deletions

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -80,13 +80,12 @@
<div class="container-dashboard" v-if="nOfLoads > 0">
<div class="card-fixed card-dashboard">
<h3>{{ t('dashboard.totalLoads') }}</h3>
<div class="main-info">
<div class="main-info" style="color: green;">
{{ nOfLoads }}
<div class="indicator-text" style="color: green;">
<!-- <div class="indicator-text" style="color: green;">
<i class="fa-solid fa-arrow-up"></i>
<!-- <i class="fa-solid fa-arrow-down"></i> -->
23%
</div>
</div> -->
</div>
</div>
<!-- <ChartLoad/> -->

View File

@@ -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);
}
});