Feat: new config

This commit is contained in:
2021-06-10 21:56:51 +02:00
parent 0493816dbe
commit 494f302cc5
3 changed files with 100 additions and 13 deletions

View File

@@ -9,7 +9,7 @@ export default {
namespaced: true,
state: {
csv: {},
month: moment()
month: ''
},
getters: {
csvs: (state) => {
@@ -48,9 +48,13 @@ export default {
// return data with negatives 'Montant'
return getters.rows.filter(x => x.Montant < 0)
},
month: (state) => {
month: (state, getters) => {
// month date
return state.month
if (state.month){
return state.month
} else {
return moment(getters.months.slice(-1)[0], "MMMM YYYY")
}
},
date_filter_rows: (state, getters) => {
// return rows filtered by date
@@ -214,6 +218,9 @@ export default {
prev_month (context) {
var prev = moment(context.getters.month).subtract(1, 'months')
context.commit('SET_MONTH', { month: prev })
},
set_month (context, month) {
context.commit('SET_MONTH', { month: month })
}
}
}