mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[CHR WIP] CHR10, CHR12, CHR13, CHR14, CHR15, CHR17 - WIP not validated
This commit is contained in:
1 parent
994d3449d3
commit
fcd8199d86
12 files changed
+353
-52
No files matched your search
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<v-dialog v-model="visible" max-width="500" >
|
||||
<v-card>
|
||||
<h1 class="text-h5">
|
||||
Chcete túto osobu odstrániť z tímu?
|
||||
</h1>
|
||||
<v-card-text>{{ member.name + ' ' + member.surname }} bude odstránený/á z teamu.</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn
|
||||
class="button primary"
|
||||
variant="text"
|
||||
@click="closeModal()"
|
||||
>
|
||||
Zrušiť
|
||||
</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
class="button primary"
|
||||
variant="text"
|
||||
@click="deleteMember()"
|
||||
>
|
||||
Áno
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
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.visible = true
|
||||
},
|
||||
|
||||
closeModal() {
|
||||
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
|
||||
|
||||
try {
|
||||
if (this.teamId) {
|
||||
const { team } = await this.$axios.put_auth(`v1/teams/${this.teamId}`, 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.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
_enrichTeam(team) {
|
||||
team.employees = tmUtils.enrichEmployees(team.employees)
|
||||
return team
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user