fix: dashboard services & clear data cache
This commit is contained in:
@@ -213,8 +213,8 @@
|
||||
}
|
||||
|
||||
.company-name {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 900;
|
||||
font-size: 1.2rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.logo {
|
||||
|
||||
@@ -82,7 +82,8 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
token.value = '';
|
||||
user.value = null;
|
||||
checking.value = false;
|
||||
authStatus.value = 'checking'
|
||||
authStatus.value = 'checking';
|
||||
isAuthenticated.value = false;
|
||||
loadStore.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
budgetsCurrentPage.value = 0;
|
||||
locations.value = [];
|
||||
locationsLoad.value = [];
|
||||
locationsDowload.value = [];
|
||||
locationsTotal.value = 0;
|
||||
locationsCurrentPage.value = 0;
|
||||
proposals.value = [];
|
||||
|
||||
@@ -20,7 +20,7 @@ export const useLoadsStore = defineStore('load', () => {
|
||||
const companyid = localStorage.getItem('id');
|
||||
if(loadsDashboard.value.length <= 0 || reload) {
|
||||
try {
|
||||
const endpoint = `/v1/loads/find?company=${companyid}`;
|
||||
const endpoint = `/v1/loads/find?company=${companyid}&elements=10000`;
|
||||
const {data} = await api.get(endpoint);
|
||||
loadsDashboard.value = data.data;
|
||||
} catch (error) {
|
||||
@@ -33,7 +33,7 @@ export const useLoadsStore = defineStore('load', () => {
|
||||
const companyId = localStorage.getItem('id');
|
||||
try {
|
||||
if(loadsDashboard.value.length <= 0 || reload) {
|
||||
const endpoint = `/v1/proposals/find?carrier=${companyId}&elements=100`;
|
||||
const endpoint = `/v1/proposals/find?carrier=${companyId}&elements=10000`;
|
||||
const {data} = await api.get(endpoint);
|
||||
loadsDashboard.value = data.data.map( (e) => e.load);
|
||||
}
|
||||
@@ -176,6 +176,7 @@ export const useLoadsStore = defineStore('load', () => {
|
||||
openModalEdit.value = false;
|
||||
openAttachmentsModal.value = false;
|
||||
openProposalsModal.value = false;
|
||||
openCarrierInfoModal.value = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,11 +10,14 @@
|
||||
import { useAuthStore } from '../../stores/auth';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import useCalendar from '../../composables/useCalendar';
|
||||
import { formatOnlyDate } from '../../helpers/date_formats';
|
||||
|
||||
|
||||
const auth = useAuthStore();
|
||||
const { user } = storeToRefs(auth);
|
||||
const loads = useLoadsStore();
|
||||
const { getCalendarDate, loading: loadingResults, loads: loadsResult } = useCalendar();
|
||||
const loading = ref(false);
|
||||
const loadsData = ref([]);
|
||||
const segmentsData = ref([]);
|
||||
@@ -39,12 +42,15 @@
|
||||
const getData = async() => {
|
||||
loading.value = true;
|
||||
try {
|
||||
if(user.value?.permissions === "role_carrier") {
|
||||
await loads.getProposalCompanyAll();
|
||||
} else {
|
||||
await loads.getLoadsAll();
|
||||
}
|
||||
dataMap();
|
||||
const currentDate = new Date();
|
||||
const year = currentDate.getFullYear();
|
||||
const month = currentDate.getMonth();
|
||||
const startDateTemp = new Date(year, month, 1);
|
||||
const endDateTemp = new Date(year, month + 1, 0);
|
||||
const startDate = formatOnlyDate(startDateTemp);
|
||||
const endDate = formatOnlyDate(endDateTemp);
|
||||
await getCalendarDate(startDate, endDate, 0);
|
||||
dataMap(loadsResult.value);
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
@@ -52,9 +58,9 @@
|
||||
}
|
||||
|
||||
|
||||
const dataMap = () => {
|
||||
nOfLoads.value = loads.loadsDashboard.length;
|
||||
loads.loadsDashboard.map((e) => {
|
||||
const dataMap = (loads) => {
|
||||
nOfLoads.value = loads.length;
|
||||
loads.map((e) => {
|
||||
if(e?.load_status) {
|
||||
loadsData.value.push(e.load_status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user