-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAnBehaviour.vue
75 lines (68 loc) · 1.72 KB
/
AnBehaviour.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<template>
<div class="an-behaviour">
<div class="an-behaviour__heading">
<strong>So komme ich mit diesem Verhalten zurecht:</strong>
</div>
<AnLollipop :values="behaviourChanges" :labels="labels" />
</div>
</template>
<script>
import visJson from '@/data/visualisation.json';
import visualisation from '@/mixins/visualisation.js';
import AnLollipop from '@/components/visualisations/AnLollipop.vue';
export default {
name: 'AnBehaviour',
components: { AnLollipop },
mixins: [visualisation],
data() {
return {
labels: Array
};
},
computed: {
behaviourChanges() {
const behaviour = this.$store.getters.getFieldValue(
'verhaltensveraenderungen-veraenderungen'
);
const behaviourLabel = visJson.visualisation.behaviour;
const behaviourValues = [];
const typeValue = {
sehr_gut: 0,
gut: 1,
mittelmäßig: 2,
schlecht: 3
};
if (behaviour?.length > 0) {
behaviour.forEach(item => {
const type = this.$store.getters.getFieldValue(
`verhaltensveraenderungen-veraenderungen-${item}-details`
);
if (type) {
behaviourValues.push({
value: typeValue[type],
text: behaviourLabel[item]
});
}
});
}
this.$emit('update:available', behaviourValues?.length > 0);
return behaviourValues;
}
},
created() {
this.labels = ['sehr gut', 'gut', 'mittelmäßig', 'schlecht'];
}
};
</script>
<style lang="scss" scoped>
.an-behaviour {
display: flex;
flex-direction: column;
align-items: flex-end;
&__heading {
margin-bottom: 0.5rem;
width: 50%;
text-align: center;
}
}
</style>