2018-09-14 05:23:25 +00:00
|
|
|
<template>
|
2020-07-03 17:37:20 +00:00
|
|
|
<div class="content loader-container is-max-width-desktop" v-bind:class="{ 'is-loading': teamService.loading}">
|
2021-01-17 17:57:57 +00:00
|
|
|
<x-button
|
|
|
|
:to="{name:'teams.create'}"
|
|
|
|
class="is-pulled-right"
|
|
|
|
icon="plus"
|
|
|
|
>
|
2018-09-14 17:19:50 +00:00
|
|
|
New Team
|
2021-01-17 17:57:57 +00:00
|
|
|
</x-button>
|
2021-01-08 22:07:17 +00:00
|
|
|
|
2018-09-14 05:23:25 +00:00
|
|
|
<h1>Teams</h1>
|
2021-01-08 22:07:17 +00:00
|
|
|
<ul class="teams box" v-if="teams.length > 0">
|
2020-09-05 20:35:52 +00:00
|
|
|
<li :key="t.id" v-for="t in teams">
|
2020-06-17 20:24:37 +00:00
|
|
|
<router-link :to="{name: 'teams.edit', params: {id: t.id}}">
|
2020-09-05 20:35:52 +00:00
|
|
|
{{ t.name }}
|
2018-09-14 05:23:25 +00:00
|
|
|
</router-link>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2021-01-20 21:09:40 +00:00
|
|
|
<p v-else-if="!teamService.loading" class="has-text-centered has-text-grey">
|
2021-01-17 19:21:33 +00:00
|
|
|
You are currently not part of any teams.
|
|
|
|
<router-link :to="{name: 'teams.create'}">
|
|
|
|
Create a new team.
|
|
|
|
</router-link>
|
|
|
|
</p>
|
2018-09-14 05:23:25 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-09-05 20:35:52 +00:00
|
|
|
import TeamService from '../../services/team'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ListTeams',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
teamService: TeamService,
|
|
|
|
teams: [],
|
2018-09-14 05:23:25 +00:00
|
|
|
}
|
2020-09-05 20:35:52 +00:00
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.teamService = new TeamService()
|
|
|
|
this.loadTeams()
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.setTitle('Teams')
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadTeams() {
|
|
|
|
this.teamService.getAll()
|
|
|
|
.then(response => {
|
|
|
|
this.$set(this, 'teams', response)
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.error(e, this)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2018-09-14 05:23:25 +00:00
|
|
|
</script>
|