token expire, remove console
This commit is contained in:
@@ -60,7 +60,7 @@ export var pieOptions={
|
||||
chart: {
|
||||
renderTo: "container",
|
||||
defaultSeriesType: "pie",
|
||||
backgroundColor: "rgba(0,0,0,0)"
|
||||
//backgroundColor: "rgba(255,0,0,)"
|
||||
},
|
||||
xAxis: {
|
||||
categories: [],
|
||||
@@ -81,3 +81,111 @@ export var pieOptions={
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export var ingresosvscomprasOptions = {
|
||||
chart: {
|
||||
renderTo: "container",
|
||||
defaultSeriesType: "bar",
|
||||
backgroundColor: "rgba(0,0,0,0)"
|
||||
},
|
||||
title: {
|
||||
text: "Gastos Vs Ingresos"
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
grouping: false,
|
||||
shadow: false,
|
||||
borderWidth: 0.5
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
shadow: true
|
||||
},
|
||||
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
xAxis: {
|
||||
categories: [""],
|
||||
crosshair: false
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
min: 0,
|
||||
title: {
|
||||
text: "Pesos"
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "Ingresos",
|
||||
|
||||
color: "rgba(0,80,200,.5)",
|
||||
data: [150],
|
||||
pointPadding: 0.25,
|
||||
pointPlacement: -0.2
|
||||
},
|
||||
{
|
||||
name: "Gastos",
|
||||
color: "rgba(165,0,217,1)",
|
||||
data: [120],
|
||||
pointPadding: 0.3,
|
||||
pointPlacement: -0.2
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export var ingresosvsegresosOptions = {
|
||||
chart: {
|
||||
renderTo: "container",
|
||||
defaultSeriesType: "bar",
|
||||
backgroundColor: "rgba(0,0,0,0)"
|
||||
},
|
||||
title: {
|
||||
text: ""
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
grouping: false,
|
||||
shadow: false,
|
||||
borderWidth: 0.5
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
shadow: false
|
||||
},
|
||||
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
xAxis: {
|
||||
categories: [""],
|
||||
crosshair: false
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
min: 0,
|
||||
title: {
|
||||
text: "Pesos"
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "Ingresos",
|
||||
|
||||
color: "rgba(0,80,200,.5)",
|
||||
data: [],
|
||||
pointPadding: 0.25,
|
||||
pointPlacement: -0.2
|
||||
},
|
||||
{
|
||||
name: "Egresos",
|
||||
color: "rgba(165,0,217,1)",
|
||||
data: [],
|
||||
pointPadding: 0.3,
|
||||
pointPlacement: -0.2
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -60,9 +60,9 @@ export default {
|
||||
|
||||
// Axios module configuration (https://go.nuxtjs.dev/config-axios)
|
||||
axios: {
|
||||
//baseURL: "http://192.168.1.111:4000/api"
|
||||
baseURL:"http://localhost:4000/api"
|
||||
//baseURL:"https://finanzasm.herokuapp.com/api"
|
||||
//baseURL: "http://192.168.1.111:4000/api"
|
||||
//baseURL:"http://localhost:4000/api"
|
||||
// baseURL:"https://finanzasm.herokuapp.com/api"
|
||||
},
|
||||
|
||||
/*
|
||||
|
||||
@@ -136,7 +136,6 @@ export default {
|
||||
this.$axios
|
||||
.get("/compras", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data.data);
|
||||
this.compras = res.data.data;
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
@@ -151,12 +150,11 @@ export default {
|
||||
},
|
||||
};
|
||||
const toSend = this.newCompra;
|
||||
console.log(axiosHeader.data);
|
||||
|
||||
this.$axios
|
||||
.post("/compra", toSend, axiosHeader)
|
||||
.then((res) => {
|
||||
this.clearFormCompra();
|
||||
console.log(res.data.status);
|
||||
this.getCompras();
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
@@ -168,12 +166,10 @@ export default {
|
||||
},
|
||||
};
|
||||
const toSend = this.newCompra;
|
||||
console.log(axiosHeader.data);
|
||||
this.$axios
|
||||
.put("/compra", toSend, axiosHeader)
|
||||
.then((res) => {
|
||||
this.clearFormCompra();
|
||||
console.log(res.data.status);
|
||||
this.getCompras();
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
@@ -183,7 +179,7 @@ export default {
|
||||
var reg_edit = this.compras.filter((ic) => ic._id===id)[0];
|
||||
this.newCompra = JSON.parse(JSON.stringify(reg_edit));
|
||||
this.openForm = true;
|
||||
console.log(reg_edit)
|
||||
|
||||
},
|
||||
|
||||
deleteCompra(id) {
|
||||
@@ -198,7 +194,6 @@ export default {
|
||||
this.$axios
|
||||
.delete("/compra", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
this.getCompras();
|
||||
this.clearFormCompra();
|
||||
})
|
||||
@@ -214,7 +209,6 @@ export default {
|
||||
},
|
||||
getIcon(row, column, cellValue, index) {
|
||||
const found = this.$store.state.categorias.filter((ic) => ic.name === cellValue)[0];
|
||||
//console.log(found);
|
||||
return `<i class="${found.icon}"></i>${cellValue}`
|
||||
},
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<card title='Filtro general'>
|
||||
<card title="Filtro general">
|
||||
<base-input label="Filtro de fechas" v-model="filtro.fechas"></base-input>
|
||||
<base-input label="Número de presupuestos" type="number" v-model="filtro.npresupuesto"></base-input>
|
||||
<base-button @click='guardarFiltro()' type="info">Guardar</base-button>
|
||||
<base-input
|
||||
label="Número de presupuestos"
|
||||
type="number"
|
||||
v-model="filtro.npresupuesto"
|
||||
></base-input>
|
||||
<base-button @click="guardarFiltro()" type="info">Guardar</base-button>
|
||||
</card>
|
||||
<div class="row">
|
||||
<card title="Categorias">
|
||||
@@ -37,21 +41,19 @@
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<form>
|
||||
<base-input
|
||||
type="text"
|
||||
placeholder="Nombre de categoria"
|
||||
v-model="newCategoria.name"
|
||||
/>
|
||||
|
||||
<base-input
|
||||
type="text"
|
||||
placeholder="Nombre de categoria"
|
||||
v-model="newCategoria.name"
|
||||
/>
|
||||
|
||||
|
||||
<base-input>
|
||||
<select class="form-control" v-model="newCategoria.icon">
|
||||
<option v-for="icono in iconos">
|
||||
{{ icono.icon }}
|
||||
</option>
|
||||
</select>
|
||||
</base-input>
|
||||
<base-input>
|
||||
<select class="form-control" v-model="newCategoria.icon">
|
||||
<option v-for="icono in iconos">
|
||||
{{ icono.icon }}
|
||||
</option>
|
||||
</select>
|
||||
</base-input>
|
||||
|
||||
<div class="col pull-buttom">
|
||||
<base-button
|
||||
@@ -99,17 +101,20 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<form>
|
||||
<base-input placeholder="Nombre pago" v-model="newMetodo.name"></base-input>
|
||||
<base-input>
|
||||
<select class="form-control" v-model="newMetodo.icon">
|
||||
<option v-for="icono in iconos">
|
||||
{{ icono.icon }}
|
||||
</option>
|
||||
</select>
|
||||
</base-input>
|
||||
<form>
|
||||
<base-input
|
||||
placeholder="Nombre pago"
|
||||
v-model="newMetodo.name"
|
||||
></base-input>
|
||||
<base-input>
|
||||
<select class="form-control" v-model="newMetodo.icon">
|
||||
<option v-for="icono in iconos">
|
||||
{{ icono.icon }}
|
||||
</option>
|
||||
</select>
|
||||
</base-input>
|
||||
|
||||
<div class="col pull-buttom">
|
||||
<div class="col pull-buttom">
|
||||
<base-button
|
||||
type="info"
|
||||
class="mb-3"
|
||||
@@ -118,7 +123,7 @@
|
||||
>Enviar</base-button
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</card>
|
||||
@@ -136,8 +141,8 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.getCategorias();
|
||||
this.getMetodos();
|
||||
this.filtro=this.$store.state.filtro
|
||||
this.getMetodos();
|
||||
this.filtro = JSON.parse(JSON.stringify(this.$store.state.filtro));
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -145,7 +150,7 @@ export default {
|
||||
name: "",
|
||||
icon: "",
|
||||
},
|
||||
newMetodo: {
|
||||
newMetodo: {
|
||||
name: "",
|
||||
icon: "",
|
||||
},
|
||||
@@ -183,15 +188,15 @@ export default {
|
||||
],
|
||||
categorias: [],
|
||||
metodos: [],
|
||||
filtro:{
|
||||
fechas:this.$store.state.filtro.fechas,
|
||||
npresupuesto:this.$store.state.filtro.npresupuesto
|
||||
}
|
||||
filtro: {
|
||||
fechas: "",
|
||||
npresupuesto: 0
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
guardarFiltro(){
|
||||
this.$store.commit("actualizarFiltro",this.filtro)
|
||||
guardarFiltro() {
|
||||
this.$store.commit("actualizarFiltro", this.filtro);
|
||||
},
|
||||
enviarCategoria() {
|
||||
const axiosHeader = {
|
||||
@@ -204,7 +209,6 @@ export default {
|
||||
this.$axios
|
||||
.post("/categoria", toSend, axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
this.getCategorias();
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -213,7 +217,6 @@ export default {
|
||||
icon: "tim-icons icon-alert-circle-exc",
|
||||
message: JSON.parse(e.request.response).error,
|
||||
});
|
||||
console.log(e.request.responseText);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -226,7 +229,6 @@ export default {
|
||||
this.$axios
|
||||
.get("/categoria", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data.data);
|
||||
this.categorias = res.data.data;
|
||||
this.$store.commit("setCategorias", this.categorias);
|
||||
})
|
||||
@@ -244,14 +246,13 @@ export default {
|
||||
this.$axios
|
||||
.delete("/categoria", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
this.getCategorias();
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
},
|
||||
enviarMetodo() {
|
||||
enviarMetodo() {
|
||||
const axiosHeader = {
|
||||
headers: {
|
||||
token: this.$store.state.auth.token,
|
||||
@@ -262,7 +263,6 @@ export default {
|
||||
this.$axios
|
||||
.post("/metodo", toSend, axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
this.getMetodos();
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -271,7 +271,6 @@ export default {
|
||||
icon: "tim-icons icon-alert-circle-exc",
|
||||
message: JSON.parse(e.request.response).error,
|
||||
});
|
||||
console.log(e.request.responseText);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -284,7 +283,6 @@ export default {
|
||||
this.$axios
|
||||
.get("/metodo", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data.data);
|
||||
this.metodos = res.data.data;
|
||||
this.$store.commit("setMetodos", this.metodos);
|
||||
})
|
||||
@@ -302,7 +300,6 @@ export default {
|
||||
this.$axios
|
||||
.delete("/metodo", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
this.getMetodos();
|
||||
})
|
||||
.catch((e) => {
|
||||
|
||||
@@ -234,8 +234,7 @@ export default {
|
||||
this.$axios
|
||||
.put("/Credito", toSend, axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data.status);
|
||||
this.getItems();
|
||||
this.getItems();
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
},
|
||||
@@ -316,7 +315,6 @@ export default {
|
||||
this.selectedCredito = this.Creditos[0];
|
||||
this.selectedCreditoName = this.selectedCredito.nombreCredito;
|
||||
this.newItem._id = this.selectedCredito._id;
|
||||
console.log(this.selectedCredito);
|
||||
this.sumItems();
|
||||
}
|
||||
})
|
||||
@@ -330,7 +328,6 @@ export default {
|
||||
this.sumItems();
|
||||
},
|
||||
deleteCredito() {
|
||||
console.log(this.selectedCredito._id);
|
||||
const axiosHeader = {
|
||||
headers: {
|
||||
token: this.$store.state.auth.token,
|
||||
@@ -342,7 +339,6 @@ export default {
|
||||
this.$axios
|
||||
.delete("/Credito", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
|
||||
this.selectedCredito = {
|
||||
_id: "",
|
||||
|
||||
@@ -115,8 +115,7 @@ export default {
|
||||
this.$axios
|
||||
.get("/ingreso", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data.data);
|
||||
this.ingresos = res.data.data;
|
||||
this.ingresos = res.data.data;
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
},
|
||||
@@ -130,12 +129,10 @@ export default {
|
||||
},
|
||||
};
|
||||
const toSend = this.newIngreso;
|
||||
console.log(axiosHeader.data);
|
||||
this.$axios
|
||||
.post("/ingreso", toSend, axiosHeader)
|
||||
.then((res) => {
|
||||
this.clearFormIngreso();
|
||||
console.log(res.data.status);
|
||||
this.getIngresos();
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
@@ -147,12 +144,10 @@ export default {
|
||||
},
|
||||
};
|
||||
const toSend = this.newIngreso;
|
||||
console.log(axiosHeader.data);
|
||||
this.$axios
|
||||
.put("/ingreso", toSend, axiosHeader)
|
||||
.then((res) => {
|
||||
this.clearFormIngreso();
|
||||
console.log(res.data.status);
|
||||
this.getIngresos();
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
@@ -176,7 +171,6 @@ export default {
|
||||
this.$axios
|
||||
.delete("/ingreso", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
this.getIngresos();
|
||||
this.clearFormIngreso();
|
||||
})
|
||||
|
||||
@@ -71,7 +71,6 @@ export default {
|
||||
icon: "tim-icons icon-check-2",
|
||||
message: "Success! Welcome " + res.data.userData.name
|
||||
});
|
||||
console.log(res.data)
|
||||
const auth = {
|
||||
token: res.data.token,
|
||||
userData: res.data.userData
|
||||
|
||||
@@ -119,9 +119,9 @@
|
||||
|
||||
<script>
|
||||
import { Table, TableColumn } from "element-ui";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
[Table.name]: Table,
|
||||
[TableColumn.name]: TableColumn,
|
||||
},
|
||||
@@ -195,7 +195,6 @@ export default {
|
||||
this.$axios
|
||||
.put("/presupuesto", toSend, axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data.status);
|
||||
this.getItems();
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
@@ -246,6 +245,7 @@ export default {
|
||||
0
|
||||
);
|
||||
this.total = this.totalIngresos - this.totalEgresos;
|
||||
|
||||
},
|
||||
formatMoneda(dato) {
|
||||
var num = dato;
|
||||
@@ -277,7 +277,7 @@ export default {
|
||||
this.selectedPresupuesto = this.presupuestos[0];
|
||||
this.selectedPresupuestoName = this.selectedPresupuesto.nombrePresupuesto;
|
||||
this.newItem._id = this.selectedPresupuesto._id;
|
||||
console.log(this.selectedPresupuesto);
|
||||
|
||||
this.sumItems();
|
||||
}
|
||||
})
|
||||
@@ -291,7 +291,7 @@ export default {
|
||||
this.sumItems();
|
||||
},
|
||||
deletePresupuesto() {
|
||||
console.log(this.selectedPresupuesto._id);
|
||||
|
||||
const axiosHeader = {
|
||||
headers: {
|
||||
token: this.$store.state.auth.token,
|
||||
@@ -303,7 +303,6 @@ export default {
|
||||
this.$axios
|
||||
.delete("/presupuesto", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
|
||||
this.selectedPresupuesto = {
|
||||
_id: "",
|
||||
@@ -319,6 +318,10 @@ export default {
|
||||
mounted() {
|
||||
this.getPresupuesto();
|
||||
},
|
||||
watch:{
|
||||
data(){this.sumItems()}
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -43,37 +54,36 @@ export default {
|
||||
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,
|
||||
@@ -134,20 +151,13 @@ metodosChart:{
|
||||
let categorias = res.data.labels;
|
||||
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,
|
||||
@@ -160,34 +170,28 @@ metodosChart:{
|
||||
let metodos = res.data.labels;
|
||||
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;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export const state = () => ({
|
||||
auth: null,
|
||||
notifications: [],
|
||||
filtro: {fechas:fechaString().slice(0, 7),npresupuesto:5},
|
||||
filtro: { fechas: fechaString().slice(0, 7), npresupuesto: 5 },
|
||||
fecha: fechaString(),
|
||||
categorias: [],
|
||||
metodos_de_pago: []
|
||||
@@ -23,10 +23,8 @@ export const mutations = {
|
||||
setMetodos(state, metodos) {
|
||||
state.metodos_de_pago = metodos;
|
||||
},
|
||||
actualizarFiltro(state,filtro) {
|
||||
|
||||
state.filtro=filtro
|
||||
|
||||
actualizarFiltro(state, filtro) {
|
||||
state.filtro = filtro;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,7 +62,9 @@ export const actions = {
|
||||
this.commit("setCategorias", res.data.data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
localStorage.clear();
|
||||
const auth = {};
|
||||
this.commit("setAuth", auth);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -74,12 +74,17 @@ export const actions = {
|
||||
token: this.state.auth.token
|
||||
}
|
||||
};
|
||||
await this.$axios
|
||||
await this.$axios
|
||||
.get("/metodo", axiosHeader)
|
||||
.then(res => {
|
||||
this.commit("setMetodos", res.data.data);
|
||||
})
|
||||
.catch(e => console.log(e));
|
||||
},
|
||||
|
||||
.catch(e => {
|
||||
//Redireccion token
|
||||
localStorage.clear();
|
||||
const auth = {};
|
||||
this.commit("setAuth", auth);
|
||||
window.location.href = "/login";
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user