comptes/src/views/home.vue

110 lines
2.6 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-01 13:49:02 +00:00
<box @click.native="set_poste('total')" postename="total"></box>
<box @click.native="set_poste('cash')" postename="cash"></box>
<box @click.native="set_poste('CB')" postename="CB"></box>
<box @click.native="set_poste('other')" postename="other"></box>
2018-11-30 17:36:30 +00:00
</b-card-group>
<postes-comparison></postes-comparison>
<b-table striped hover :items="filtered_rows(poste.words, poste.invert)" :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'
import postesComparison from '../components/postes_comparison'
2018-11-30 10:53:50 +00:00
export default {
name: 'home',
2018-11-30 10:53:50 +00:00
components: {
box: box,
postesComparison: postesComparison
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',
sortable: true
2018-11-30 14:15:23 +00:00
}
],
2018-12-01 14:03:38 +00:00
poste: {}
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-01 13:49:02 +00:00
'filtered_rows': 'datas/libelle_filter_rows',
'start': 'datas/start',
'end': 'datas/end',
2018-11-30 17:36:30 +00:00
'postes': 'config/postes'
2018-12-01 14:03:38 +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-11-30 21:07:08 +00:00
set_poste (postename) {
this.poste = this.postes[postename]
}
2018-11-30 10:53:50 +00:00
}
}
</script>
2018-11-30 14:15:23 +00:00
<style scoped>
.date-selector {
padding: 1rem;
}
</style>