fix: dashboard carrier & complete register
This commit is contained in:
@@ -122,6 +122,8 @@ import Spiner from '../components/ui/Spiner.vue';
|
||||
///////////////////////////
|
||||
}
|
||||
|
||||
/// Falta el populate en la respuesta para completar el registro y luego de recargar la pagina
|
||||
|
||||
const handleBack = (val) => {
|
||||
step.value = val;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { useLoadsStore } from '../stores/loads';
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import Spiner from '../components/ui/Spiner.vue';
|
||||
import CardEmpty from '../components/CardEmpty.vue';
|
||||
import { useAuthStore } from '../stores/auth';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
@@ -33,7 +34,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const getData = async() => {
|
||||
loading.value = true;
|
||||
if(user.value?.permissions === "role_carrier") {
|
||||
@@ -52,10 +52,15 @@
|
||||
if(e?.load_status) {
|
||||
loadsData.value.push(e.load_status);
|
||||
}
|
||||
if( (user.value?.permissions === "role_shipper") && e?.categories) {
|
||||
if( e?.categories) {
|
||||
segmentsData.value.push(e?.categories[0].name)
|
||||
}
|
||||
if( (user.value?.permissions === "role_shipper" ) && e?.origin?.city) {
|
||||
|
||||
// if( (user.value?.permissions === "role_carrier") && e?.load?.categories) {
|
||||
// segmentsData.value.push(e?.load?.categories[0].name)
|
||||
// }
|
||||
|
||||
if( e?.origin?.city) {
|
||||
cities.value.push(e?.origin.city)
|
||||
}
|
||||
if(e?.origin?.state){
|
||||
@@ -70,10 +75,8 @@
|
||||
|
||||
<template>
|
||||
<h1 class="title my-4">Dashboard Administrativo</h1>
|
||||
<div class="container-dashboard">
|
||||
<div class="card-fixed"
|
||||
:class="[ ( user?.permissions === 'role_shipper') ? 'card-dashboard' : 'card-dashboard-carrier' ]"
|
||||
>
|
||||
<div class="container-dashboard" v-if="nOfLoads > 0">
|
||||
<div class="card-fixed card-dashboard">
|
||||
<h3>Total de cargas este mes</h3>
|
||||
<div class="main-info">
|
||||
{{ nOfLoads }}
|
||||
@@ -85,9 +88,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- <ChartLoad/> -->
|
||||
<div class="card-fixed"
|
||||
:class="[ ( user?.permissions === 'role_shipper') ? 'card-dashboard' : 'card-dashboard-carrier']"
|
||||
>
|
||||
<div class="card-fixed card-dashboard">
|
||||
<h3>Cargas activas</h3>
|
||||
<div class="card-chart">
|
||||
<Spiner v-if="loading"/>
|
||||
@@ -100,9 +101,7 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-fixed"
|
||||
:class="[ (user?.permissions === 'role_shipper') ? 'card-dashboard' : 'card-dashboard-carrier']"
|
||||
v-if="user?.permissions?.includes('role_shipper')">
|
||||
<div class="card-fixed card-dashboard">
|
||||
<h3>Segmentos más usados</h3>
|
||||
<div class="card-chart">
|
||||
<Spiner v-if="loading"/>
|
||||
@@ -114,11 +113,7 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div>
|
||||
<div class="container-dashboard"> -->
|
||||
<div class="card-fixed"
|
||||
:class="[ (user?.permissions === 'role_shipper') ? 'card-dashboard' : 'card-dashboard-carrier']"
|
||||
>
|
||||
<div class="card-fixed card-dashboard">
|
||||
<h3>Estados más usados</h3>
|
||||
<div class="card-chart">
|
||||
<Spiner v-if="loading"/>
|
||||
@@ -129,9 +124,7 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-fixed"
|
||||
:class="[ (user?.permissions === 'role_shipper') ? 'card-dashboard' : 'card-dashboard-carrier']"
|
||||
v-if="user?.permissions === 'role_shipper'">
|
||||
<div class="card-fixed card-dashboard">
|
||||
<h3>Ciudades más usadas</h3>
|
||||
<div class="card-chart">
|
||||
<Spiner v-if="loading"/>
|
||||
@@ -142,9 +135,7 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-fixed"
|
||||
:class="[ (user?.permissions === 'role_shipper') ? 'card-dashboard' : 'card-dashboard-carrier']"
|
||||
>
|
||||
<div class="card-fixed card-dashboard">
|
||||
<h3>Tipo de transporte más usados</h3>
|
||||
<div class="card-chart">
|
||||
<Spiner v-if="loading"/>
|
||||
@@ -156,6 +147,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<CardEmpty text="No hay suficientes datos para generar un analisis de cargas"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@@ -179,7 +173,7 @@
|
||||
.card-dashboard-carrier {
|
||||
width: 48%;
|
||||
min-height: 300px;
|
||||
max-height: 500px;
|
||||
/* max-height: 500px; */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@
|
||||
if( resp.data.user.company ) { // Registro completo
|
||||
localStorage.setItem('session', resp.data.session_token);
|
||||
localStorage.setItem('access', resp.data.accessToken);
|
||||
localStorage.setItem('id', resp.data.user.company);
|
||||
console.log('id', resp.data.user.company)
|
||||
localStorage.setItem('id', resp.data.user.company._id);
|
||||
router.push({name: 'home'});
|
||||
auth.$patch({
|
||||
sesion: resp.data.session_token,
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
import Spiner from '../components/ui/Spiner.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useNotificationsStore } from '../stores/notifications';
|
||||
import { useAuthStore } from '../stores/auth';
|
||||
|
||||
const router = useRouter();
|
||||
const notifications = useNotificationsStore()
|
||||
const auth = useAuthStore();
|
||||
|
||||
const form = reactive({
|
||||
email: '',
|
||||
@@ -84,11 +86,16 @@
|
||||
});
|
||||
clearMessages();
|
||||
notifications.$patch({
|
||||
text : 'Registro exitoso, Inicie sesión!',
|
||||
text : 'Registro exitoso, Complete su registro!',
|
||||
show : true,
|
||||
error: false
|
||||
});
|
||||
router.push({name: 'login'});
|
||||
auth.$patch({
|
||||
sesion: result.data.session_token,
|
||||
token: result.data.accessToken,
|
||||
user: result.data.user,
|
||||
})
|
||||
router.push({name: 'register-company'});
|
||||
} else {
|
||||
msgError.value = result.msg;
|
||||
clearMessages()
|
||||
|
||||
Reference in New Issue
Block a user