mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
99 lines
2.8 KiB
Vue
99 lines
2.8 KiB
Vue
<template>
|
|
<v-dialog v-model="visible" :width="modalWidth" :height="modalHeight" persistent>
|
|
<v-card style="position: relative">
|
|
<div class="d-flex justify-space-between align-center">
|
|
<h1 class="text-h5">
|
|
Chcete túto osobu odstrániť z tímu?
|
|
</h1>
|
|
<div class="d-flex align-center">
|
|
<a-reset-size-button @reset="resetModalSize" />
|
|
<a-close-button @close="closeModal()" />
|
|
</div>
|
|
</div>
|
|
<v-card-text>{{ member.name + ' ' + member.surname }} bude odstránený/á z teamu.</v-card-text>
|
|
<v-card-actions>
|
|
<v-btn
|
|
class="button secondary"
|
|
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>
|
|
<a-resize-handle @resize="handleModalResize" @resize-end="handleResizeEnd" :current-width="modalWidthPx" :current-height="modalHeightPx" />
|
|
</v-card>
|
|
</v-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
|
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
|
|
import AResizeHandle from '@/plugins/tm@modal/_components/a-resize-handle.vue'
|
|
import AResetSizeButton from '@/plugins/tm@modal/_components/a-reset-size-button.vue'
|
|
import ACloseButton from '@/plugins/tm@modal/_components/a-close-button.vue'
|
|
|
|
export default {
|
|
mixins: [ modalMixin ],
|
|
|
|
components: {
|
|
AResizeHandle,
|
|
AResetSizeButton, ACloseButton,
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
member: null,
|
|
team: null,
|
|
modalName: 'z-delete-team-member-modal',
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
async showModal({ member, team }) {
|
|
this.member = member
|
|
this.team = team
|
|
this.visible = true
|
|
},
|
|
|
|
closeModal() {
|
|
this.visible = false
|
|
},
|
|
|
|
async deleteMember() {
|
|
this.team.employees = [...this.team.employees].filter(employee => employee.id !== this.member.id)
|
|
|
|
try {
|
|
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('master-task:team-member-deleted', { teamId: this.team.id, memberId: this.member.id })
|
|
this.closeModal()
|
|
} catch (error) {
|
|
this.$toast.error(this.$parseError(error))
|
|
|
|
if (process.env.NODE_ENV === 'development')
|
|
console.log('[z-delete-team-member-modal.vue] Error: ', error)
|
|
}
|
|
},
|
|
|
|
_enrichTeam(team) {
|
|
team.employees = tmUtils.enrichEmployees(team.employees)
|
|
return team
|
|
}
|
|
}
|
|
}
|
|
</script> |