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