fixes: loads search & locations load
This commit is contained in:
@@ -17,7 +17,9 @@ export default function useSearchLoads() {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const endpoint = `/v1/loads/find${filterStr}&$sort[createdAt]=-1`;
|
const endpoint = `/v1/loads/find${filterStr}&$sort[createdAt]=-1`;
|
||||||
|
console.log(endpoint);
|
||||||
const {data} = await api.get(endpoint);
|
const {data} = await api.get(endpoint);
|
||||||
|
console.log(data);
|
||||||
total.value = data.total;
|
total.value = data.total;
|
||||||
loads.value = data.data;
|
loads.value = data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -302,11 +302,11 @@ export const useCompanyStore = defineStore('company', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getLocationsLoads = async(type) => {
|
const getLocationsLoads = async(type) => {
|
||||||
console.log(type);
|
// console.log(type);
|
||||||
let locationsType = (type === 'loading') ? locationsLoad.value : locationsDowload.value;
|
let locationsType = (type === 'loading') ? locationsLoad.value : locationsDowload.value;
|
||||||
console.log(locationsType);
|
// console.log(locationsType);
|
||||||
if(locationsType.length <= 0) {
|
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 respBoth = await getLocations(filterStr + '&type=' + 'both');
|
||||||
const resp = await getLocations(filterStr + '&type=' + type);
|
const resp = await getLocations(filterStr + '&type=' + type);
|
||||||
if(resp !== null && resp.total > 0) {
|
if(resp !== null && resp.total > 0) {
|
||||||
|
|||||||
@@ -80,13 +80,12 @@
|
|||||||
<div class="container-dashboard" v-if="nOfLoads > 0">
|
<div class="container-dashboard" v-if="nOfLoads > 0">
|
||||||
<div class="card-fixed card-dashboard">
|
<div class="card-fixed card-dashboard">
|
||||||
<h3>{{ t('dashboard.totalLoads') }}</h3>
|
<h3>{{ t('dashboard.totalLoads') }}</h3>
|
||||||
<div class="main-info">
|
<div class="main-info" style="color: green;">
|
||||||
{{ nOfLoads }}
|
{{ 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-up"></i>
|
||||||
<!-- <i class="fa-solid fa-arrow-down"></i> -->
|
|
||||||
23%
|
23%
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <ChartLoad/> -->
|
<!-- <ChartLoad/> -->
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
watch(selectedState, () => {
|
watch(selectedState, () => {
|
||||||
if(selectedState.value != null){
|
if(selectedState.value != null){
|
||||||
setFilterUnlimited()
|
setFilterUnlimited()
|
||||||
filterQuery.value.state = "origin.state[$in][]="+ selectedState.value.state_name;
|
filterQuery.value.state = "state="+ selectedState.value.state_name;
|
||||||
getLoadsPublished(filterQuery.value);
|
getLoadsPublished(filterQuery.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
watch(selectedCities, () => {
|
watch(selectedCities, () => {
|
||||||
if(selectedCities.value != null){
|
if(selectedCities.value != null){
|
||||||
setFilterUnlimited()
|
setFilterUnlimited()
|
||||||
filterQuery.value.city = "origin.city[$regex]="+ selectedCities.value.city_name;
|
filterQuery.value.city = "city="+ selectedCities.value.city_name;
|
||||||
getLoadsPublished(filterQuery.value);
|
getLoadsPublished(filterQuery.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
watch(selectedCategory, () => {
|
watch(selectedCategory, () => {
|
||||||
if(selectedCategory.value != null){
|
if(selectedCategory.value != null){
|
||||||
setFilterUnlimited()
|
setFilterUnlimited()
|
||||||
filterQuery.value.category = "categories[$in][]=" + selectedCategory.value._id;
|
filterQuery.value.category = "categories=" + selectedCategory.value._id;
|
||||||
getLoadsPublished(filterQuery.value);
|
getLoadsPublished(filterQuery.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
watch(selectedTruckType, () => {
|
watch(selectedTruckType, () => {
|
||||||
if(selectedTruckType.value != null){
|
if(selectedTruckType.value != null){
|
||||||
setFilterUnlimited()
|
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);
|
getLoadsPublished(filterQuery.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user