Newer
Older
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
<template>
<v-tooltip bottom>
<template #activator="{ on, attrs }">
<v-icon
:color="currentStatus?.color"
class="mr-md-4"
v-on="on"
v-bind="attrs"
>{{ currentStatus?.icon }}</v-icon
>
</template>
<span>{{ currentStatus?.text }}</span>
</v-tooltip>
</template>
<script>
export default {
name: "SubstitutionStatus",
data() {
return {
statusChoices: [
{
name: "unedited",
text: this.$t("chronos.substitutions.overview.status.unedited"),
icon: "mdi-calendar-question-outline",
color: "warning",
},
{
name: "substituted",
text: this.$t("chronos.substitutions.overview.status.substituted"),
icon: "mdi-calendar-edit-outline",
color: "success",
},
{
name: "cancelled",
text: this.$t("chronos.substitutions.overview.status.cancelled"),
icon: "mdi-cancel",
color: "error",
},
],
statusTimeout: null,
currentStatusName: "",
};
},
props: {
substitution: {
type: Object,
required: true,
},
},
computed: {
currentStatus() {
return this.statusChoices.find((s) => s.name === this.currentStatusName);
},
},
methods: {
updateStatus() {
if (this.substitution.id.startsWith("DUMMY")) {
this.currentStatusName = "unedited";
} else if (this.substitution.cancelled) {
this.currentStatusName = "cancelled";
} else {
this.currentStatusName = "substituted";
}
},
},
watch: {