comptes/src/views/home.vue

117 lines
2.7 KiB
Vue
Raw Normal View History

2018-11-30 07:42:04 +00:00
<template>
<div class="import">
<h1>Analyse</h1>
2018-11-30 14:15:23 +00:00
<b-container fluid>
<b-row class="date-selector">
<b-col sm="1"><label for="start"> Entre </label> </b-col>
2018-12-01 13:49:02 +00:00
<b-col sm="3">
<b-form-input id="start" type="date" :value="start" @input="set_start"></b-form-input>
</b-col>
2018-11-30 14:15:23 +00:00
<b-col sm="1"><label for="end"> et </label></b-col>
2018-12-01 13:49:02 +00:00
<b-col sm="3">
<b-form-input id="end" type="date" :value="end" @input="set_end"></b-form-input>
</b-col>
2018-11-30 14:15:23 +00:00
</b-row>
</b-container>
2018-11-30 17:36:30 +00:00
<b-card-group deck class="mb-3">
2018-12-03 11:00:41 +00:00
<box @click.native="set_tags_filter([])"></box>
<box @click.native="set_tags_filter(['cash'])" tagname="cash"></box>
<box @click.native="set_tags_filter(['CB'])" tagname="CB"></box>
<box @click.native="set_tags_filter(['virements'])" tagname="virements"></box>
2018-11-30 17:36:30 +00:00
</b-card-group>
2018-12-03 11:00:41 +00:00
<tags-comparison></tags-comparison>
2018-12-03 09:41:57 +00:00
<b-table striped hover :items="filtered_rows" :fields='fields'>
<template slot="tags" slot-scope="data">
<div v-for="tag in data.item.tags">
<div v-if="tag.name !== 'Tout'">
<font-awesome-icon :icon="tag.icon" class="fa"/>
</div>
</div>
</template>
</b-table>
2018-11-30 07:42:04 +00:00
</div>
</template>
2018-11-30 10:53:50 +00:00
<script>
2018-12-01 13:49:02 +00:00
import { mapGetters, mapActions } from 'vuex'
2018-11-30 17:36:30 +00:00
import box from '../components/box'
2018-12-03 11:00:41 +00:00
import tagsComparison from '../components/tags_comparison'
2018-11-30 10:53:50 +00:00
export default {
name: 'home',
2018-11-30 10:53:50 +00:00
components: {
box: box,
2018-12-03 11:00:41 +00:00
tagsComparison: tagsComparison
2018-11-30 10:53:50 +00:00
},
data () {
return {
2018-11-30 14:15:23 +00:00
fields: [
{
key: 'Date',
sortable: true,
formatter: this.table_date_format
2018-11-30 14:15:23 +00:00
},
{
key: 'Montant',
sortable: true
},
{
key: 'Libellé',
sortable: true
},
{
key: 'tags',
2018-11-30 14:15:23 +00:00
}
],
2018-12-03 11:00:41 +00:00
default_tag: {
2018-12-03 09:41:57 +00:00
name: 'Tout',
variant: 'info',
icon: 'file-invoice-dollar'
},
2018-12-03 11:00:41 +00:00
tags_filter: []
2018-11-30 10:53:50 +00:00
}
},
mounted: function () {
this.$store.dispatch('config/load')
this.$store.dispatch('datas/find_csv')
2018-11-30 10:53:50 +00:00
},
computed: {
...mapGetters({
'csvs': 'datas/csvs',
2018-12-03 09:41:57 +00:00
'tag_filter_rows': 'datas/tag_filter_rows',
2018-12-01 13:49:02 +00:00
'start': 'datas/start',
'end': 'datas/end',
2018-12-03 11:00:41 +00:00
'tags': 'config/tags'
2018-12-03 09:41:57 +00:00
}),
filtered_rows () {
2018-12-03 11:00:41 +00:00
return this.tag_filter_rows(this.tags_filter)
2018-12-03 09:41:57 +00:00
}
2018-11-30 10:53:50 +00:00
},
methods: {
2018-12-01 13:49:02 +00:00
...mapActions('datas', [
'set_start',
'set_end'
]),
update_start (e) {
},
table_date_format (date) {
return date
2018-11-30 14:15:23 +00:00
},
2018-12-03 11:00:41 +00:00
set_tags_filter (tagnames) {
this.tags_filter = tagnames
}
2018-11-30 10:53:50 +00:00
}
}
</script>
2018-11-30 14:15:23 +00:00
<style scoped>
.date-selector {
padding: 1rem;
}
</style>