Refact: rename poste to tag
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<b-card v-if="poste"
|
||||
:bg-variant="poste.variant"
|
||||
<b-card v-if="tag"
|
||||
:bg-variant="tag.variant"
|
||||
text-variant="white"
|
||||
class="text-center">
|
||||
<div class="card-text">
|
||||
<div class="icon">
|
||||
<font-awesome-icon :icon="poste.icon" class="fa-3x"/>
|
||||
<font-awesome-icon :icon="tag.icon" class="fa-3x"/>
|
||||
</div>
|
||||
<div class="amount">
|
||||
<h3>{{ total() }}€</h3>
|
||||
{{ poste.name }}
|
||||
{{ tag.name }}
|
||||
</div>
|
||||
</div>
|
||||
</b-card>
|
||||
@@ -21,12 +21,12 @@ import { total } from '../libs/data_processing'
|
||||
export default {
|
||||
name: 'box',
|
||||
props: [
|
||||
'postename',
|
||||
'tagname',
|
||||
'rows'
|
||||
],
|
||||
data () {
|
||||
return {
|
||||
default_poste: {
|
||||
default_tag: {
|
||||
name: 'Tout',
|
||||
variant: 'info',
|
||||
icon: 'file-invoice-dollar'
|
||||
@@ -35,25 +35,25 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('config', [
|
||||
'postes'
|
||||
'tags'
|
||||
]),
|
||||
...mapGetters('datas', [
|
||||
'tag_filter_rows'
|
||||
]),
|
||||
poste () {
|
||||
if (this.postename) {
|
||||
return this.postes[this.postename]
|
||||
tag () {
|
||||
if (this.tagname) {
|
||||
return this.tags[this.tagname]
|
||||
} else {
|
||||
return this.default_poste
|
||||
return this.default_tag
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
filter_rows () {
|
||||
if (this.poste === this.default_poste) {
|
||||
if (this.tag === this.default_tag) {
|
||||
return this.tag_filter_rows([])
|
||||
} else {
|
||||
return this.tag_filter_rows([this.poste.name])
|
||||
return this.tag_filter_rows([this.tag.name])
|
||||
}
|
||||
},
|
||||
total () {
|
||||
|
||||
@@ -55,7 +55,6 @@ export default {
|
||||
}
|
||||
})
|
||||
tagsSpendings[tagsSpendings.length - 1] = total(this.tag_filter_rows([])) - tagsSpendings.reduce((sum, a) => sum + a, 0)
|
||||
console.log(tagsSpendings)
|
||||
return tagsSpendings
|
||||
}
|
||||
},
|
||||
Reference in New Issue
Block a user