This commit is contained in:
parent
7a67266778
commit
61c345d56c
|
@ -39,7 +39,7 @@
|
|||
</form>
|
||||
<table class="table is-striped is-hoverable is-fullwidth">
|
||||
<tbody>
|
||||
<tr v-for="t in listTeams" :key="t.id">
|
||||
<tr v-for="t in teams" :key="t.id">
|
||||
<td>
|
||||
<router-link :to="{name: 'editTeam', params: {id: t.id}}">
|
||||
{{t.name}}
|
||||
|
@ -75,7 +75,7 @@
|
|||
Admin
|
||||
</template>
|
||||
</button>
|
||||
<button @click="teamToDelete = t.id; showTeamDeleteModal = true" class="button is-danger">
|
||||
<button @click="teamStuffModel.teamID = t.id; showTeamDeleteModal = true" class="button is-danger">
|
||||
<span class="icon is-small">
|
||||
<icon icon="trash-alt"/>
|
||||
</span>
|
||||
|
@ -128,10 +128,8 @@
|
|||
|
||||
currentUser: auth.user.infos,
|
||||
typeString: '',
|
||||
listTeams: [],
|
||||
newTeam: {teamID: 0},
|
||||
teams: [],
|
||||
showTeamDeleteModal: false,
|
||||
teamToDelete: 0,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -159,7 +157,7 @@
|
|||
loadTeams() {
|
||||
this.teamStuffService.getAll(this.teamStuffModel)
|
||||
.then(r => {
|
||||
this.$set(this, 'listTeams', r)
|
||||
this.$set(this, 'teams', r)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
|
@ -168,10 +166,13 @@
|
|||
deleteTeam() {
|
||||
this.teamStuffService.delete(this.teamStuffModel)
|
||||
.then(() => {
|
||||
this.showTeamDeleteModal = false;
|
||||
this.showTeamDeleteModal = false
|
||||
for (const i in this.teams) {
|
||||
if (this.teams[i].id === this.teamStuffModel.teamID) {
|
||||
this.teams.splice(i, 1)
|
||||
}
|
||||
}
|
||||
message.success({message: 'The team was successfully deleted from the ' + this.typeString + '.'}, this)
|
||||
// FIXME: this should remove the team from the list instead of loading it again
|
||||
this.loadTeams()
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
|
@ -190,9 +191,8 @@
|
|||
|
||||
this.teamStuffService.create(this.teamStuffModel)
|
||||
.then(() => {
|
||||
// FIXME: this should add the team to the list instead of loading it again
|
||||
this.loadTeams()
|
||||
message.success({message: 'The team was successfully added.'}, this)
|
||||
this.loadTeams()
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
|
@ -206,9 +206,12 @@
|
|||
}
|
||||
|
||||
this.teamStuffService.update(this.teamStuffModel)
|
||||
.then(() => {
|
||||
// FIXME: this should update the team in the list instead of loading it again
|
||||
this.loadTeams()
|
||||
.then(r => {
|
||||
for (const i in this.teams) {
|
||||
if (this.teams[i].id === this.teamStuffModel.teamID) {
|
||||
this.$set(this.teams[i], 'right', r.right)
|
||||
}
|
||||
}
|
||||
message.success({message: 'The team right was successfully updated.'}, this)
|
||||
})
|
||||
.catch(e => {
|
||||
|
|
Reference in New Issue
Block a user