token expire, remove console
This commit is contained in:
@@ -60,7 +60,7 @@ export var pieOptions={
|
|||||||
chart: {
|
chart: {
|
||||||
renderTo: "container",
|
renderTo: "container",
|
||||||
defaultSeriesType: "pie",
|
defaultSeriesType: "pie",
|
||||||
backgroundColor: "rgba(0,0,0,0)"
|
//backgroundColor: "rgba(255,0,0,)"
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
categories: [],
|
categories: [],
|
||||||
@@ -80,4 +80,112 @@ 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 module configuration (https://go.nuxtjs.dev/config-axios)
|
||||||
axios: {
|
axios: {
|
||||||
//baseURL: "http://192.168.1.111:4000/api"
|
//baseURL: "http://192.168.1.111:4000/api"
|
||||||
baseURL:"http://localhost:4000/api"
|
//baseURL:"http://localhost:4000/api"
|
||||||
//baseURL:"https://finanzasm.herokuapp.com/api"
|
// baseURL:"https://finanzasm.herokuapp.com/api"
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.get("/compras", axiosHeader)
|
.get("/compras", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.data);
|
|
||||||
this.compras = res.data.data;
|
this.compras = res.data.data;
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
@@ -151,12 +150,11 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const toSend = this.newCompra;
|
const toSend = this.newCompra;
|
||||||
console.log(axiosHeader.data);
|
|
||||||
this.$axios
|
this.$axios
|
||||||
.post("/compra", toSend, axiosHeader)
|
.post("/compra", toSend, axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.clearFormCompra();
|
this.clearFormCompra();
|
||||||
console.log(res.data.status);
|
|
||||||
this.getCompras();
|
this.getCompras();
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
@@ -168,12 +166,10 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const toSend = this.newCompra;
|
const toSend = this.newCompra;
|
||||||
console.log(axiosHeader.data);
|
|
||||||
this.$axios
|
this.$axios
|
||||||
.put("/compra", toSend, axiosHeader)
|
.put("/compra", toSend, axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.clearFormCompra();
|
this.clearFormCompra();
|
||||||
console.log(res.data.status);
|
|
||||||
this.getCompras();
|
this.getCompras();
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
@@ -183,7 +179,7 @@ export default {
|
|||||||
var reg_edit = this.compras.filter((ic) => ic._id===id)[0];
|
var reg_edit = this.compras.filter((ic) => ic._id===id)[0];
|
||||||
this.newCompra = JSON.parse(JSON.stringify(reg_edit));
|
this.newCompra = JSON.parse(JSON.stringify(reg_edit));
|
||||||
this.openForm = true;
|
this.openForm = true;
|
||||||
console.log(reg_edit)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteCompra(id) {
|
deleteCompra(id) {
|
||||||
@@ -198,7 +194,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.delete("/compra", axiosHeader)
|
.delete("/compra", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
|
||||||
this.getCompras();
|
this.getCompras();
|
||||||
this.clearFormCompra();
|
this.clearFormCompra();
|
||||||
})
|
})
|
||||||
@@ -214,7 +209,6 @@ export default {
|
|||||||
},
|
},
|
||||||
getIcon(row, column, cellValue, index) {
|
getIcon(row, column, cellValue, index) {
|
||||||
const found = this.$store.state.categorias.filter((ic) => ic.name === cellValue)[0];
|
const found = this.$store.state.categorias.filter((ic) => ic.name === cellValue)[0];
|
||||||
//console.log(found);
|
|
||||||
return `<i class="${found.icon}"></i>${cellValue}`
|
return `<i class="${found.icon}"></i>${cellValue}`
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<card title='Filtro general'>
|
<card title="Filtro general">
|
||||||
<base-input label="Filtro de fechas" v-model="filtro.fechas"></base-input>
|
<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-input
|
||||||
<base-button @click='guardarFiltro()' type="info">Guardar</base-button>
|
label="Número de presupuestos"
|
||||||
|
type="number"
|
||||||
|
v-model="filtro.npresupuesto"
|
||||||
|
></base-input>
|
||||||
|
<base-button @click="guardarFiltro()" type="info">Guardar</base-button>
|
||||||
</card>
|
</card>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<card title="Categorias">
|
<card title="Categorias">
|
||||||
@@ -37,22 +41,20 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<form>
|
<form>
|
||||||
|
<base-input
|
||||||
<base-input
|
type="text"
|
||||||
type="text"
|
placeholder="Nombre de categoria"
|
||||||
placeholder="Nombre de categoria"
|
v-model="newCategoria.name"
|
||||||
v-model="newCategoria.name"
|
/>
|
||||||
/>
|
|
||||||
|
<base-input>
|
||||||
|
<select class="form-control" v-model="newCategoria.icon">
|
||||||
<base-input>
|
<option v-for="icono in iconos">
|
||||||
<select class="form-control" v-model="newCategoria.icon">
|
{{ icono.icon }}
|
||||||
<option v-for="icono in iconos">
|
</option>
|
||||||
{{ icono.icon }}
|
</select>
|
||||||
</option>
|
</base-input>
|
||||||
</select>
|
|
||||||
</base-input>
|
|
||||||
|
|
||||||
<div class="col pull-buttom">
|
<div class="col pull-buttom">
|
||||||
<base-button
|
<base-button
|
||||||
type="info"
|
type="info"
|
||||||
@@ -99,17 +101,20 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<form>
|
<form>
|
||||||
<base-input placeholder="Nombre pago" v-model="newMetodo.name"></base-input>
|
<base-input
|
||||||
<base-input>
|
placeholder="Nombre pago"
|
||||||
<select class="form-control" v-model="newMetodo.icon">
|
v-model="newMetodo.name"
|
||||||
<option v-for="icono in iconos">
|
></base-input>
|
||||||
{{ icono.icon }}
|
<base-input>
|
||||||
</option>
|
<select class="form-control" v-model="newMetodo.icon">
|
||||||
</select>
|
<option v-for="icono in iconos">
|
||||||
</base-input>
|
{{ icono.icon }}
|
||||||
|
</option>
|
||||||
<div class="col pull-buttom">
|
</select>
|
||||||
|
</base-input>
|
||||||
|
|
||||||
|
<div class="col pull-buttom">
|
||||||
<base-button
|
<base-button
|
||||||
type="info"
|
type="info"
|
||||||
class="mb-3"
|
class="mb-3"
|
||||||
@@ -118,7 +123,7 @@
|
|||||||
>Enviar</base-button
|
>Enviar</base-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</card>
|
</card>
|
||||||
@@ -130,14 +135,14 @@
|
|||||||
import { Table, TableColumn } from "element-ui";
|
import { Table, TableColumn } from "element-ui";
|
||||||
export default {
|
export default {
|
||||||
middleware: "authenticated",
|
middleware: "authenticated",
|
||||||
components: {
|
components: {
|
||||||
[Table.name]: Table,
|
[Table.name]: Table,
|
||||||
[TableColumn.name]: TableColumn,
|
[TableColumn.name]: TableColumn,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getCategorias();
|
this.getCategorias();
|
||||||
this.getMetodos();
|
this.getMetodos();
|
||||||
this.filtro=this.$store.state.filtro
|
this.filtro = JSON.parse(JSON.stringify(this.$store.state.filtro));
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -145,11 +150,11 @@ export default {
|
|||||||
name: "",
|
name: "",
|
||||||
icon: "",
|
icon: "",
|
||||||
},
|
},
|
||||||
newMetodo: {
|
newMetodo: {
|
||||||
name: "",
|
name: "",
|
||||||
icon: "",
|
icon: "",
|
||||||
},
|
},
|
||||||
|
|
||||||
iconos: [
|
iconos: [
|
||||||
{ icon: "fa-bell" },
|
{ icon: "fa-bell" },
|
||||||
{ icon: "fa-book" },
|
{ icon: "fa-book" },
|
||||||
@@ -183,15 +188,15 @@ export default {
|
|||||||
],
|
],
|
||||||
categorias: [],
|
categorias: [],
|
||||||
metodos: [],
|
metodos: [],
|
||||||
filtro:{
|
filtro: {
|
||||||
fechas:this.$store.state.filtro.fechas,
|
fechas: "",
|
||||||
npresupuesto:this.$store.state.filtro.npresupuesto
|
npresupuesto: 0
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
guardarFiltro(){
|
guardarFiltro() {
|
||||||
this.$store.commit("actualizarFiltro",this.filtro)
|
this.$store.commit("actualizarFiltro", this.filtro);
|
||||||
},
|
},
|
||||||
enviarCategoria() {
|
enviarCategoria() {
|
||||||
const axiosHeader = {
|
const axiosHeader = {
|
||||||
@@ -204,7 +209,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.post("/categoria", toSend, axiosHeader)
|
.post("/categoria", toSend, axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
|
||||||
this.getCategorias();
|
this.getCategorias();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
@@ -213,7 +217,6 @@ export default {
|
|||||||
icon: "tim-icons icon-alert-circle-exc",
|
icon: "tim-icons icon-alert-circle-exc",
|
||||||
message: JSON.parse(e.request.response).error,
|
message: JSON.parse(e.request.response).error,
|
||||||
});
|
});
|
||||||
console.log(e.request.responseText);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -226,7 +229,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.get("/categoria", axiosHeader)
|
.get("/categoria", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.data);
|
|
||||||
this.categorias = res.data.data;
|
this.categorias = res.data.data;
|
||||||
this.$store.commit("setCategorias", this.categorias);
|
this.$store.commit("setCategorias", this.categorias);
|
||||||
})
|
})
|
||||||
@@ -244,14 +246,13 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.delete("/categoria", axiosHeader)
|
.delete("/categoria", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
|
||||||
this.getCategorias();
|
this.getCategorias();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
enviarMetodo() {
|
enviarMetodo() {
|
||||||
const axiosHeader = {
|
const axiosHeader = {
|
||||||
headers: {
|
headers: {
|
||||||
token: this.$store.state.auth.token,
|
token: this.$store.state.auth.token,
|
||||||
@@ -262,7 +263,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.post("/metodo", toSend, axiosHeader)
|
.post("/metodo", toSend, axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
|
||||||
this.getMetodos();
|
this.getMetodos();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
@@ -271,7 +271,6 @@ export default {
|
|||||||
icon: "tim-icons icon-alert-circle-exc",
|
icon: "tim-icons icon-alert-circle-exc",
|
||||||
message: JSON.parse(e.request.response).error,
|
message: JSON.parse(e.request.response).error,
|
||||||
});
|
});
|
||||||
console.log(e.request.responseText);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -284,7 +283,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.get("/metodo", axiosHeader)
|
.get("/metodo", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.data);
|
|
||||||
this.metodos = res.data.data;
|
this.metodos = res.data.data;
|
||||||
this.$store.commit("setMetodos", this.metodos);
|
this.$store.commit("setMetodos", this.metodos);
|
||||||
})
|
})
|
||||||
@@ -302,7 +300,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.delete("/metodo", axiosHeader)
|
.delete("/metodo", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
|
||||||
this.getMetodos();
|
this.getMetodos();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|||||||
@@ -234,8 +234,7 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.put("/Credito", toSend, axiosHeader)
|
.put("/Credito", toSend, axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.status);
|
this.getItems();
|
||||||
this.getItems();
|
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
},
|
},
|
||||||
@@ -316,7 +315,6 @@ export default {
|
|||||||
this.selectedCredito = this.Creditos[0];
|
this.selectedCredito = this.Creditos[0];
|
||||||
this.selectedCreditoName = this.selectedCredito.nombreCredito;
|
this.selectedCreditoName = this.selectedCredito.nombreCredito;
|
||||||
this.newItem._id = this.selectedCredito._id;
|
this.newItem._id = this.selectedCredito._id;
|
||||||
console.log(this.selectedCredito);
|
|
||||||
this.sumItems();
|
this.sumItems();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -330,7 +328,6 @@ export default {
|
|||||||
this.sumItems();
|
this.sumItems();
|
||||||
},
|
},
|
||||||
deleteCredito() {
|
deleteCredito() {
|
||||||
console.log(this.selectedCredito._id);
|
|
||||||
const axiosHeader = {
|
const axiosHeader = {
|
||||||
headers: {
|
headers: {
|
||||||
token: this.$store.state.auth.token,
|
token: this.$store.state.auth.token,
|
||||||
@@ -342,8 +339,7 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.delete("/Credito", axiosHeader)
|
.delete("/Credito", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
|
||||||
|
|
||||||
this.selectedCredito = {
|
this.selectedCredito = {
|
||||||
_id: "",
|
_id: "",
|
||||||
nombreCredito: "",
|
nombreCredito: "",
|
||||||
|
|||||||
@@ -115,8 +115,7 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.get("/ingreso", axiosHeader)
|
.get("/ingreso", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.data);
|
this.ingresos = res.data.data;
|
||||||
this.ingresos = res.data.data;
|
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
},
|
},
|
||||||
@@ -130,12 +129,10 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const toSend = this.newIngreso;
|
const toSend = this.newIngreso;
|
||||||
console.log(axiosHeader.data);
|
|
||||||
this.$axios
|
this.$axios
|
||||||
.post("/ingreso", toSend, axiosHeader)
|
.post("/ingreso", toSend, axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.clearFormIngreso();
|
this.clearFormIngreso();
|
||||||
console.log(res.data.status);
|
|
||||||
this.getIngresos();
|
this.getIngresos();
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
@@ -147,12 +144,10 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const toSend = this.newIngreso;
|
const toSend = this.newIngreso;
|
||||||
console.log(axiosHeader.data);
|
|
||||||
this.$axios
|
this.$axios
|
||||||
.put("/ingreso", toSend, axiosHeader)
|
.put("/ingreso", toSend, axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.clearFormIngreso();
|
this.clearFormIngreso();
|
||||||
console.log(res.data.status);
|
|
||||||
this.getIngresos();
|
this.getIngresos();
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
@@ -176,7 +171,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.delete("/ingreso", axiosHeader)
|
.delete("/ingreso", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
|
||||||
this.getIngresos();
|
this.getIngresos();
|
||||||
this.clearFormIngreso();
|
this.clearFormIngreso();
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ export default {
|
|||||||
icon: "tim-icons icon-check-2",
|
icon: "tim-icons icon-check-2",
|
||||||
message: "Success! Welcome " + res.data.userData.name
|
message: "Success! Welcome " + res.data.userData.name
|
||||||
});
|
});
|
||||||
console.log(res.data)
|
|
||||||
const auth = {
|
const auth = {
|
||||||
token: res.data.token,
|
token: res.data.token,
|
||||||
userData: res.data.userData
|
userData: res.data.userData
|
||||||
|
|||||||
@@ -119,9 +119,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Table, TableColumn } from "element-ui";
|
import { Table, TableColumn } from "element-ui";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
||||||
[Table.name]: Table,
|
[Table.name]: Table,
|
||||||
[TableColumn.name]: TableColumn,
|
[TableColumn.name]: TableColumn,
|
||||||
},
|
},
|
||||||
@@ -129,7 +129,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isOpen: false,
|
isOpen: false,
|
||||||
|
|
||||||
newPresupuesto: {
|
newPresupuesto: {
|
||||||
nombrePresupuesto: "",
|
nombrePresupuesto: "",
|
||||||
},
|
},
|
||||||
@@ -195,7 +195,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.put("/presupuesto", toSend, axiosHeader)
|
.put("/presupuesto", toSend, axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.status);
|
|
||||||
this.getItems();
|
this.getItems();
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
@@ -246,6 +245,7 @@ export default {
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
this.total = this.totalIngresos - this.totalEgresos;
|
this.total = this.totalIngresos - this.totalEgresos;
|
||||||
|
|
||||||
},
|
},
|
||||||
formatMoneda(dato) {
|
formatMoneda(dato) {
|
||||||
var num = dato;
|
var num = dato;
|
||||||
@@ -277,7 +277,7 @@ export default {
|
|||||||
this.selectedPresupuesto = this.presupuestos[0];
|
this.selectedPresupuesto = this.presupuestos[0];
|
||||||
this.selectedPresupuestoName = this.selectedPresupuesto.nombrePresupuesto;
|
this.selectedPresupuestoName = this.selectedPresupuesto.nombrePresupuesto;
|
||||||
this.newItem._id = this.selectedPresupuesto._id;
|
this.newItem._id = this.selectedPresupuesto._id;
|
||||||
console.log(this.selectedPresupuesto);
|
|
||||||
this.sumItems();
|
this.sumItems();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -291,7 +291,7 @@ export default {
|
|||||||
this.sumItems();
|
this.sumItems();
|
||||||
},
|
},
|
||||||
deletePresupuesto() {
|
deletePresupuesto() {
|
||||||
console.log(this.selectedPresupuesto._id);
|
|
||||||
const axiosHeader = {
|
const axiosHeader = {
|
||||||
headers: {
|
headers: {
|
||||||
token: this.$store.state.auth.token,
|
token: this.$store.state.auth.token,
|
||||||
@@ -303,7 +303,6 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.delete("/presupuesto", axiosHeader)
|
.delete("/presupuesto", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
|
||||||
|
|
||||||
this.selectedPresupuesto = {
|
this.selectedPresupuesto = {
|
||||||
_id: "",
|
_id: "",
|
||||||
@@ -319,6 +318,10 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.getPresupuesto();
|
this.getPresupuesto();
|
||||||
},
|
},
|
||||||
|
watch:{
|
||||||
|
data(){this.sumItems()}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,43 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h1>Resumen mensual</h1>
|
<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>
|
|
||||||
|
|
||||||
<card>
|
<card>
|
||||||
<div class="chart-area" style="height: 300px">
|
<div class="row">
|
||||||
<highchart style="height: 100%" v-if="isMounted" :options="comprasChart"/>
|
<Badge type="info" class="col-6 p-1 rounded-pill"
|
||||||
</div>
|
>Total Ingresos: <br /><b>{{ formatMoneda(ingresos) }}</b></Badge
|
||||||
<div class="chart-area" style="height: 300px">
|
>
|
||||||
<highchart style="height: 100%" v-if="isMounted" :options="metodosChart"/>
|
<Badge type="primary" class="col-6 p-1 rounded-pill"
|
||||||
</div>
|
>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>
|
</card>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
@@ -38,42 +49,41 @@ import config from "@/config";
|
|||||||
export default {
|
export default {
|
||||||
name: "dashboard",
|
name: "dashboard",
|
||||||
middleware: "authenticated",
|
middleware: "authenticated",
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isMounted: false,
|
isMounted: false,
|
||||||
|
|
||||||
comprasChart:{
|
comprasChart: {
|
||||||
...configPlot.chartOptions,
|
...configPlot.chartOptions,
|
||||||
title: {
|
title: {
|
||||||
text: 'Compras por categorías'
|
text: "Gastos por categoría",
|
||||||
},
|
},
|
||||||
series: [{
|
series: [],
|
||||||
name: '',
|
},
|
||||||
data: [],
|
|
||||||
color: "#e14eca"
|
|
||||||
},],
|
|
||||||
|
|
||||||
},
|
ingresosVscompras: {
|
||||||
|
...configPlot.ingresosvscomprasOptions,
|
||||||
|
},
|
||||||
|
|
||||||
metodosChart:{
|
metodosChart: {
|
||||||
...configPlot.pieOptions,
|
...configPlot.pieOptions,
|
||||||
title: {
|
title: {
|
||||||
text: 'Métodos de pago'
|
text: "Métodos de pago",
|
||||||
},
|
},
|
||||||
series: [{
|
series: [
|
||||||
data: [],
|
{
|
||||||
},],
|
data: [],
|
||||||
|
},
|
||||||
},
|
],
|
||||||
|
},
|
||||||
|
|
||||||
ingresos: 1000,
|
ingresos: 1000,
|
||||||
compras: 1000,
|
compras: 1000,
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
formatMoneda(dato) {
|
formatMoneda(dato) {
|
||||||
var num = dato;
|
var num = dato;
|
||||||
if (!isNaN(num)) {
|
if (!isNaN(num)) {
|
||||||
@@ -99,8 +109,9 @@ metodosChart:{
|
|||||||
this.$axios
|
this.$axios
|
||||||
.get("/resumen_compras", axiosHeader)
|
.get("/resumen_compras", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.data);
|
//console.log(res.data.data);
|
||||||
this.compras = res.data.data;
|
this.compras = res.data.data;
|
||||||
|
this.ingresosVscompras.series[1].data[0] = this.compras;
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
},
|
},
|
||||||
@@ -115,13 +126,19 @@ metodosChart:{
|
|||||||
this.$axios
|
this.$axios
|
||||||
.get("/resumen_ingresos", axiosHeader)
|
.get("/resumen_ingresos", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.data);
|
// console.log(res.data.data);
|
||||||
this.ingresos = 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));
|
.catch((e) => console.log(e));
|
||||||
},
|
},
|
||||||
|
|
||||||
async getResumenCategorias() {
|
async getResumenCategorias() {
|
||||||
const axiosHeader = {
|
const axiosHeader = {
|
||||||
headers: {
|
headers: {
|
||||||
token: this.$store.state.auth.token,
|
token: this.$store.state.auth.token,
|
||||||
@@ -132,22 +149,15 @@ metodosChart:{
|
|||||||
.get("/resumen_categorias", axiosHeader)
|
.get("/resumen_categorias", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let categorias = res.data.labels;
|
let categorias = res.data.labels;
|
||||||
let valores = res.data.datos;
|
let valores = res.data.datos;
|
||||||
|
|
||||||
this.comprasChart.xAxis.categories =categorias;
|
this.comprasChart.xAxis.categories = categorias;
|
||||||
this.comprasChart.series =[{name: '',
|
this.comprasChart.series = [{ name: "", data: valores }];
|
||||||
data: valores,
|
|
||||||
}]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
},
|
},
|
||||||
|
|
||||||
async getResumenMetodos() {
|
async getResumenMetodos() {
|
||||||
const axiosHeader = {
|
const axiosHeader = {
|
||||||
headers: {
|
headers: {
|
||||||
token: this.$store.state.auth.token,
|
token: this.$store.state.auth.token,
|
||||||
@@ -158,36 +168,30 @@ metodosChart:{
|
|||||||
.get("/resumen_metodos", axiosHeader)
|
.get("/resumen_metodos", axiosHeader)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let metodos = res.data.labels;
|
let metodos = res.data.labels;
|
||||||
let valores = res.data.datos;
|
let valores = res.data.datos;
|
||||||
|
|
||||||
//this.metodosChart.xAxis.categories =metodos;
|
//this.metodosChart.xAxis.categories =metodos;
|
||||||
var series =[];
|
var series = [];
|
||||||
for (var i=0;i< metodos.length;i++){
|
for (var i = 0; i < metodos.length; i++) {
|
||||||
var serie={
|
var serie = {
|
||||||
name:metodos[i],
|
name: metodos[i],
|
||||||
y:valores[i]
|
y: valores[i],
|
||||||
}
|
};
|
||||||
series.push(serie)
|
series.push(serie);
|
||||||
}
|
}
|
||||||
console.log(series)
|
//console.log(series);
|
||||||
this.metodosChart.series = [{name: '',
|
this.metodosChart.series = [{ name: "", data: series }];
|
||||||
data: series,
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.getCompras();
|
await this.getCompras();
|
||||||
await this.getIngresos();
|
await this.getIngresos();
|
||||||
await this.getResumenCategorias();
|
|
||||||
await this.getResumenMetodos();
|
await this.getResumenCategorias();
|
||||||
|
await this.getResumenMetodos();
|
||||||
this.isMounted = true;
|
this.isMounted = true;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export const state = () => ({
|
export const state = () => ({
|
||||||
auth: null,
|
auth: null,
|
||||||
notifications: [],
|
notifications: [],
|
||||||
filtro: {fechas:fechaString().slice(0, 7),npresupuesto:5},
|
filtro: { fechas: fechaString().slice(0, 7), npresupuesto: 5 },
|
||||||
fecha: fechaString(),
|
fecha: fechaString(),
|
||||||
categorias: [],
|
categorias: [],
|
||||||
metodos_de_pago: []
|
metodos_de_pago: []
|
||||||
@@ -23,10 +23,8 @@ export const mutations = {
|
|||||||
setMetodos(state, metodos) {
|
setMetodos(state, metodos) {
|
||||||
state.metodos_de_pago = metodos;
|
state.metodos_de_pago = metodos;
|
||||||
},
|
},
|
||||||
actualizarFiltro(state,filtro) {
|
actualizarFiltro(state, filtro) {
|
||||||
|
state.filtro = filtro;
|
||||||
state.filtro=filtro
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,7 +62,9 @@ export const actions = {
|
|||||||
this.commit("setCategorias", res.data.data);
|
this.commit("setCategorias", res.data.data);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.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
|
token: this.state.auth.token
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await this.$axios
|
await this.$axios
|
||||||
.get("/metodo", axiosHeader)
|
.get("/metodo", axiosHeader)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.commit("setMetodos", res.data.data);
|
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