token expire, remove console

This commit is contained in:
2021-08-24 20:08:42 -05:00
parent 3b2a06b043
commit a55f45cafd
10 changed files with 279 additions and 179 deletions

View File

@@ -1,32 +1,43 @@
<template>
<div>
<h1>Resumen mensual</h1>
<div class="row">
<Badge type="primary" class="col-3 p-4 rounded-pill"
>Total Ingresos: <br /><b>{{ formatMoneda(ingresos) }}</b></Badge
>
<Badge type="info" class="col-3 p-4 offset-md-1 rounded-pill"
>Total Compras: <br /><b>{{ formatMoneda(compras) }}</b></Badge
>
</div>
<h1>Resumen Mensual</h1>
<card>
<div class="chart-area" style="height: 300px">
<highchart style="height: 100%" v-if="isMounted" :options="comprasChart"/>
</div>
<div class="chart-area" style="height: 300px">
<highchart style="height: 100%" v-if="isMounted" :options="metodosChart"/>
</div>
<div class="row">
<Badge type="info" class="col-6 p-1 rounded-pill"
>Total Ingresos: <br /><b>{{ formatMoneda(ingresos) }}</b></Badge
>
<Badge type="primary" class="col-6 p-1 rounded-pill"
>Total Gastos: <br /><b>{{ formatMoneda(compras) }}</b></Badge
>
</div>
<div class="chart-area" style="height: 300px">
<highchart
style="height: 100%"
v-if="isMounted"
:options="ingresosVscompras"
/>
</div>
</card>
<card>
<div class="chart-area" style="height: 300px">
<highchart
style="height: 100%"
v-if="isMounted"
:options="comprasChart"
/>
</div>
</card>
<card>
<div class="chart-area">
<highchart
style="height: 100%"
v-if="isMounted"
:options="metodosChart"
/>
</div>
</card>
</div>
</template>
@@ -38,42 +49,41 @@ import config from "@/config";
export default {
name: "dashboard",
middleware: "authenticated",
data() {
return {
isMounted: false,
comprasChart:{
...configPlot.chartOptions,
title: {
text: 'Compras por categorías'
},
series: [{
name: '',
data: [],
color: "#e14eca"
},],
comprasChart: {
...configPlot.chartOptions,
title: {
text: "Gastos por categoría",
},
series: [],
},
},
ingresosVscompras: {
...configPlot.ingresosvscomprasOptions,
},
metodosChart:{
...configPlot.pieOptions,
title: {
text: 'Métodos de pago'
},
series: [{
data: [],
},],
},
metodosChart: {
...configPlot.pieOptions,
title: {
text: "Métodos de pago",
},
series: [
{
data: [],
},
],
},
ingresos: 1000,
compras: 1000,
};
},
methods: {
methods: {
formatMoneda(dato) {
var num = dato;
if (!isNaN(num)) {
@@ -99,8 +109,9 @@ metodosChart:{
this.$axios
.get("/resumen_compras", axiosHeader)
.then((res) => {
console.log(res.data.data);
//console.log(res.data.data);
this.compras = res.data.data;
this.ingresosVscompras.series[1].data[0] = this.compras;
})
.catch((e) => console.log(e));
},
@@ -115,13 +126,19 @@ metodosChart:{
this.$axios
.get("/resumen_ingresos", axiosHeader)
.then((res) => {
console.log(res.data.data);
// console.log(res.data.data);
this.ingresos = res.data.data;
this.ingresosVscompras.series[0].data[0] = this.ingresos;
if (this.compras / this.ingresos > 0.8) {
this.ingresosVscompras.chart.backgroundColor = "rgba(150,0,0,0.4)";
} else {
this.ingresosVscompras.chart.backgroundColor = "rgba(0,0,0,0)";
}
})
.catch((e) => console.log(e));
},
async getResumenCategorias() {
async getResumenCategorias() {
const axiosHeader = {
headers: {
token: this.$store.state.auth.token,
@@ -132,22 +149,15 @@ metodosChart:{
.get("/resumen_categorias", axiosHeader)
.then((res) => {
let categorias = res.data.labels;
let valores = res.data.datos;
let valores = res.data.datos;
this.comprasChart.xAxis.categories =categorias;
this.comprasChart.series =[{name: '',
data: valores,
}]
this.comprasChart.xAxis.categories = categorias;
this.comprasChart.series = [{ name: "", data: valores }];
})
.catch((e) => console.log(e));
},
async getResumenMetodos() {
async getResumenMetodos() {
const axiosHeader = {
headers: {
token: this.$store.state.auth.token,
@@ -158,36 +168,30 @@ metodosChart:{
.get("/resumen_metodos", axiosHeader)
.then((res) => {
let metodos = res.data.labels;
let valores = res.data.datos;
let valores = res.data.datos;
//this.metodosChart.xAxis.categories =metodos;
var series =[];
for (var i=0;i< metodos.length;i++){
var serie={
name:metodos[i],
y:valores[i]
}
series.push(serie)
}
console.log(series)
this.metodosChart.series = [{name: '',
data: series,
}];
//this.metodosChart.xAxis.categories =metodos;
var series = [];
for (var i = 0; i < metodos.length; i++) {
var serie = {
name: metodos[i],
y: valores[i],
};
series.push(serie);
}
//console.log(series);
this.metodosChart.series = [{ name: "", data: series }];
})
.catch((e) => console.log(e));
},
},
async mounted() {
await this.getCompras();
await this.getIngresos();
await this.getResumenCategorias();
await this.getResumenMetodos();
await this.getCompras();
await this.getIngresos();
await this.getResumenCategorias();
await this.getResumenMetodos();
this.isMounted = true;
},
};