token expire, remove console
This commit is contained in:
@@ -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,22 +41,20 @@
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<form>
|
||||
|
||||
<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
|
||||
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>
|
||||
|
||||
<div class="col pull-buttom">
|
||||
<base-button
|
||||
type="info"
|
||||
@@ -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>
|
||||
|
||||
<div class="col pull-buttom">
|
||||
<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">
|
||||
<base-button
|
||||
type="info"
|
||||
class="mb-3"
|
||||
@@ -118,7 +123,7 @@
|
||||
>Enviar</base-button
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</card>
|
||||
@@ -130,14 +135,14 @@
|
||||
import { Table, TableColumn } from "element-ui";
|
||||
export default {
|
||||
middleware: "authenticated",
|
||||
components: {
|
||||
components: {
|
||||
[Table.name]: Table,
|
||||
[TableColumn.name]: TableColumn,
|
||||
},
|
||||
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,11 +150,11 @@ export default {
|
||||
name: "",
|
||||
icon: "",
|
||||
},
|
||||
newMetodo: {
|
||||
newMetodo: {
|
||||
name: "",
|
||||
icon: "",
|
||||
},
|
||||
|
||||
|
||||
iconos: [
|
||||
{ icon: "fa-bell" },
|
||||
{ icon: "fa-book" },
|
||||
@@ -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,8 +339,7 @@ export default {
|
||||
this.$axios
|
||||
.delete("/Credito", axiosHeader)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
|
||||
|
||||
this.selectedCredito = {
|
||||
_id: "",
|
||||
nombreCredito: "",
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
@@ -129,7 +129,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
isOpen: false,
|
||||
|
||||
|
||||
newPresupuesto: {
|
||||
nombrePresupuesto: "",
|
||||
},
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user