sort tables ok

This commit is contained in:
2021-06-15 19:36:51 -05:00
parent 6dbb3c80c5
commit 14f9937d93
11 changed files with 109 additions and 85 deletions

View File

@@ -4,6 +4,7 @@
:background-color="sidebarBackground"
short-title="MD"
title="Finanzas"
>
<notifications></notifications>
<template slot-scope="props" slot="links">

View File

@@ -60,8 +60,8 @@ 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://localhost:4000/api"
baseURL:"https://finanzasm.herokuapp.com/api"
},
/*

View File

@@ -44,7 +44,7 @@
icon
size="sm"
class="btn-link"
@click="updateCompraClic($index)"
@click="updateCompraClic(row._id)"
>
<i class="el-icon-edit"></i>
</base-button>
@@ -134,6 +134,7 @@ export default {
const axiosHeader = {
headers: {
token: this.$store.state.auth.token,
filtro:this.$store.state.filtro.fechas
},
};
this.$axios
@@ -183,9 +184,10 @@ export default {
},
updateCompraClic(id) {
this.isUpdate = true;
this.newCompra = JSON.parse(JSON.stringify(this.compras[id]));
var reg_edit = this.compras.filter((ic) => ic._id===id)[0];
this.newCompra = JSON.parse(JSON.stringify(reg_edit));
this.openForm = true;
console.log("SJS")
console.log(reg_edit)
},
deleteCompra(id) {

View File

@@ -1,5 +1,10 @@
<template>
<div>
<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>
</card>
<div class="row">
<card title="Categorias">
<div class="row">
@@ -123,16 +128,16 @@
<script>
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
},
data() {
return {
@@ -178,9 +183,16 @@ export default {
],
categorias: [],
metodos: [],
filtro:{
fechas:this.$store.state.filtro.fechas,
npresupuesto:this.$store.state.filtro.npresupuesto
}
};
},
methods: {
guardarFiltro(){
this.$store.commit("actualizarFiltro",this.filtro)
},
enviarCategoria() {
const axiosHeader = {
headers: {

View File

@@ -7,6 +7,9 @@
<script>
export default {
middleware: 'authenticated',
mounted(){
$nuxt.$router.push("/compras")
}
}
</script>

View File

@@ -32,7 +32,7 @@
icon
size="sm"
class="btn-link"
@click="updateIngresoClic($index)"
@click="updateIngresoClic(row._id)"
>
<i class="el-icon-edit"></i>
</base-button>
@@ -109,6 +109,7 @@ export default {
const axiosHeader = {
headers: {
token: this.$store.state.auth.token,
filtro:this.$store.state.filtro.fechas
},
};
this.$axios
@@ -158,7 +159,8 @@ export default {
},
updateIngresoClic(id) {
this.isUpdate = true;
this.newIngreso = JSON.parse(JSON.stringify(this.ingresos[id]));
var reg_edit = this.ingresos.filter((ic) => ic._id===id)[0];
this.newIngreso = JSON.parse(JSON.stringify(reg_edit));
this.openForm = !this.openForm;
},

View File

@@ -261,6 +261,7 @@ export default {
const axiosHeader = {
headers: {
token: this.$store.state.auth.token,
limite:this.$store.state.filtro.npresupuesto
},
};

View File

@@ -1,94 +1,85 @@
export const state = () => ({
auth: null,
notifications: [],
fecha: fechaString(),
categorias:[],
metodos_de_pago:[]
});
auth: null,
notifications: [],
filtro: {fechas:fechaString().slice(0, 7),npresupuesto:5},
fecha: fechaString(),
categorias: [],
metodos_de_pago: []
});
export const mutations = {
export const mutations = {
setAuth(state, auth) {
state.auth = auth;
},
setAuth(state, auth) {
state.auth = auth;
},
setNotifications(state, notifications) {
state.notifications = notifications;
},
setNotifications(state, notifications) {
state.notifications = notifications;
},
setCategorias(state, categorias) {
state.categorias = categorias;
},
setCategorias(state, categorias) {
state.categorias = categorias;
},
setMetodos(state, metodos) {
state.metodos_de_pago = metodos;
},
};
setMetodos(state, metodos) {
state.metodos_de_pago = metodos;
},
actualizarFiltro(state,filtro) {
function fechaString(){
let data = new Date();
let year= data.getFullYear();
let month = (data.getMonth() + 1)<9?"0"+(data.getMonth() + 1):(data.getMonth() + 1)
let day = data.getDate()<9?"0"+data.getDate():data.getDate()
let dataF=`${year}-${month}-${day}`
return dataF;
state.filtro=filtro
}
};
function fechaString() {
let data = new Date();
let year = data.getFullYear();
let month =
data.getMonth() + 1 < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
let day = data.getDate() < 9 ? "0" + data.getDate() : data.getDate();
let dataF = `${year}-${month}-${day}`;
return dataF;
}
export const actions = {
readToken() {
let auth = null;
try {
auth = JSON.parse(localStorage.getItem("auth"));
} catch (error) {
console.log(err);
readToken() {
let auth = null;
try {
auth = JSON.parse(localStorage.getItem("auth"));
} catch (error) {
console.log(err);
}
//saving auth in state
this.commit("setAuth", auth);
},
getCategorias() {
const axiosHeader = {
headers: {
token: this.state.auth.token
}
//saving auth in state
this.commit("setAuth", auth);
},
getCategorias() {
const axiosHeader = {
headers: {
token: this.state.auth.token
}
};
};
this.$axios.get("/categoria", axiosHeader)
.then(res => {
this.commit("setCategorias", res.data.data);
}).catch(error => {
console.log(error);
});
this.$axios
.get("/categoria", axiosHeader)
.then(res => {
this.commit("setCategorias", res.data.data);
})
.catch(error => {
console.log(error);
});
},
getMetodos() {
const axiosHeader = {
headers: {
token: this.state.auth.token,
},
token: this.state.auth.token
}
};
this.$axios
.get("/metodo", axiosHeader)
.then((res) => {
.then(res => {
this.commit("setMetodos", res.data.data);
})
.catch((e) => console.log(e));
},
}
.catch(e => console.log(e));
},
};