From 66082aaa45c4a85d3533f6dbeea0587b2b7e3c4c Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sun, 27 Jan 2019 18:59:09 +0100 Subject: [PATCH] Feat(Categories): Show categories no filter yet --- config/config.yml | 28 +++++++- src/components/box.vue | 85 ------------------------ src/components/tag_config.vue | 117 ---------------------------------- src/store/modules/config.js | 20 ++++-- src/views/config.vue | 20 ++++-- src/views/home.vue | 14 ++-- 6 files changed, 63 insertions(+), 221 deletions(-) delete mode 100644 src/components/box.vue delete mode 100644 src/components/tag_config.vue diff --git a/config/config.yml b/config/config.yml index 78fd8e3..5e405a2 100644 --- a/config/config.yml +++ b/config/config.yml @@ -1,5 +1,12 @@ --- -tags: +categories: + tout: + name: Tout + variant: info + icon: file-invoice-dollar + color: '#78e08f' + words: [] + cash: name: Cash variant: info @@ -26,6 +33,25 @@ tags: - PAIEMENT - RETRAIT +tags: + cash: + name: Cash + variant: info + icon: money-bill-wave + color: '#78e08f' + words: + - RETRAIT + + virements: + name: Virements + variant: info + icon: directions + invert: true + color: "#f6b93b" + words: + - PAIEMENT + - RETRAIT + autoroute: name: Autoroute variant: danger diff --git a/src/components/box.vue b/src/components/box.vue deleted file mode 100644 index d2e4291..0000000 --- a/src/components/box.vue +++ /dev/null @@ -1,85 +0,0 @@ - - - - - diff --git a/src/components/tag_config.vue b/src/components/tag_config.vue deleted file mode 100644 index 3c68d21..0000000 --- a/src/components/tag_config.vue +++ /dev/null @@ -1,117 +0,0 @@ - - - - - diff --git a/src/store/modules/config.js b/src/store/modules/config.js index 4a1f8b0..d7b4ade 100644 --- a/src/store/modules/config.js +++ b/src/store/modules/config.js @@ -8,7 +8,8 @@ export default { data_dir: '/home/lafrite/scripts/comptes/data/', config_dir: '/home/lafrite/scripts/comptes/config/', config_filename: 'config.yml', - tags: {} + tags: {}, + categories: {} }, getters: { data_dir: (state) => { @@ -24,13 +25,23 @@ export default { return state.tags }, tag: (state) => (tagname) => { - return state.tags[tagname.toLowerCase()] + return state.tags[tagname.toLowerCase()] + }, + categories: (state) => { + return state.categories + }, + categorie: (state) => (categorieName) => { + return state.categories[categorieName.toLowerCase()] } }, mutations: { SET_TAGS: (state, { tags }) => { - state.tags = Object.keys(tags) - .reduce((c, k) => (c[k.toLowerCase()] = tags[k], c), {}) + state.tags = Object.keys(tags) + .reduce((c, k) => (c[k.toLowerCase()] = tags[k], c), {}) + }, + SET_CATEGORIES: (state, { categories }) => { + state.categories = Object.keys(categories) + .reduce((c, k) => (c[k.toLowerCase()] = categories[k], c), {}) } }, actions: { @@ -44,6 +55,7 @@ export default { } var parsed = yaml.safeLoad(content, parseConfig) context.commit('SET_TAGS', { tags: parsed.tags }) + context.commit('SET_CATEGORIES', { categories: parsed.categories }) } }) }, diff --git a/src/views/config.vue b/src/views/config.vue index ef0523d..aed4b24 100644 --- a/src/views/config.vue +++ b/src/views/config.vue @@ -6,7 +6,7 @@ -

+

Les fichiers csv sont cherché dans {{ data_dir }}