-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Season.vue
115 lines (114 loc) · 2.93 KB
/
Season.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<template>
<v-container class="season" fluid>
<v-card>
<v-row>
<v-col cols="12">
<v-card-title
v-if="seasonData.start_date != null && seasonData.end_date != null"
>
{{ seasonData.name }}
<v-spacer />
{{ isStarted }}:
{{ new Date(seasonData.start_date).toLocaleDateString("en-CA") }}
<br />
{{ isEnding }}:
{{ new Date(seasonData.end_date).toLocaleDateString("en-CA") }}
</v-card-title>
<v-card-title
v-else-if="
seasonData.start_date != null && seasonData.end_date == null
"
>
{{ seasonData.name }}
<v-spacer />
{{ isStarted }}:
{{ new Date(seasonData.start_date).toLocaleDateString("en-CA") }}
</v-card-title>
<v-card-title v-else>
{{ seasonData.name }}
</v-card-title>
<v-card-title>
<v-btn :to="`/leaderboard/${seasonData.id}`">
{{ $t("misc.PLeader") }}
</v-btn>
<v-btn :to="`/leaderboard/teams/${seasonData.id}`">
{{ $t("Leaderboard.TTitle") }}
</v-btn>
</v-card-title>
</v-col>
<v-col cols="12">
<MatchesTable :user="user" />
</v-col>
</v-row>
</v-card>
</v-container>
</template>
<script>
// @ is an alias to /src
import MatchesTable from "@/components/MatchesTableNoLimits";
export default {
name: "Season",
components: {
MatchesTable
},
data() {
return {
user: {
admin: false,
steam_id: "",
id: -1,
super_admin: false,
name: "",
small_image: "",
medium_image: "",
large_image: ""
}, // should be object from JSON response
seasonData: {
name: "",
id: -1,
user_id: -1,
start_date: null,
end_date: null
}
};
},
async created() {
this.user = await this.IsLoggedIn();
this.seasonData = await this.GetSeasonInfo(this.$route.params.id);
this.seasonData.start_date = new Date(this.seasonData.start_date)
.toISOString()
.slice(0, 19)
.replace("T", " ");
if (this.seasonData.end_date != null)
this.seasonData.end_date = new Date(this.seasonData.end_date)
.toISOString()
.slice(0, 19)
.replace("T", " ");
},
computed: {
isStarted() {
if (
this.seasonData.start_date >=
new Date()
.toISOString()
.slice(0, 19)
.replace("T", " ")
)
return "Starting";
else return "Started";
},
isEnding() {
if (
this.seasonData.end_date != null &&
this.seasonData.end_date <
new Date()
.toISOString()
.slice(0, 19)
.replace("T", " ")
)
return "Ended";
else return "Ends";
}
}
};
</script>