mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Bugfix] Remove team member from master-task modal
This commit is contained in:
1 parent
fcd8199d86
commit
7dfac0f155
4 files changed
+15
-58
No files matched your search
@@ -7,7 +7,7 @@
|
||||
<v-card-text>{{ member.name + ' ' + member.surname }} bude odstránený/á z teamu.</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn
|
||||
class="button primary"
|
||||
class="button secondary"
|
||||
variant="text"
|
||||
@click="closeModal()"
|
||||
>
|
||||
@@ -34,18 +34,14 @@ export default {
|
||||
return {
|
||||
visible: false,
|
||||
member: null,
|
||||
allMembers: null,
|
||||
teamId: null,
|
||||
team: null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showModal({ member, team }) {
|
||||
this.member = member
|
||||
this.allMembers = team.employees
|
||||
this.teamId = team.id
|
||||
this.team = team
|
||||
this.member = member
|
||||
this.team = team
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
@@ -53,32 +49,19 @@ export default {
|
||||
this.visible = false
|
||||
},
|
||||
|
||||
editDatepicker(type) {
|
||||
const calendarElement = document.getElementsByClassName('dp__instance_calendar')[0]
|
||||
const switchBtn = calendarElement.lastChild.querySelectorAll('.dp__button')[0]
|
||||
if (!calendarElement) return
|
||||
if (type == 'date') {
|
||||
calendarElement.lastChild.remove()
|
||||
} else if (type == 'time') {
|
||||
switchBtn.click()
|
||||
//calendarElement.lastChild.remove()
|
||||
}
|
||||
},
|
||||
|
||||
async deleteMember() {
|
||||
const filteredMembers = this.allMembers.filter(obj => obj !== this.member)
|
||||
this.team.employees = filteredMembers
|
||||
this.team.employees = [...this.team.employees].filter(employee => employee.id !== this.member.id)
|
||||
|
||||
try {
|
||||
if (this.teamId) {
|
||||
const { team } = await this.$axios.put_auth(`v1/teams/${this.teamId}`, this.team)
|
||||
if (this.team.id) {
|
||||
const { team } = await this.$axios.put_auth(`v1/teams/${this.team.id}`, this.team)
|
||||
this.$store.commit('tm/update_team', team)
|
||||
} else {
|
||||
const { team } = await this.$axios.post_auth(`v1/teams`, this.team)
|
||||
this.$store.commit('tm/save_team', team)
|
||||
}
|
||||
|
||||
this.$events.emit('memberDeleted', { filteredMembers })
|
||||
this.$events.emit('master-task:team-member-deleted', { teamId: this.team.id, memberId: this.member.id })
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
|
||||
Reference in new issue
Block a user