[mastertask] complete mastertask

This commit is contained in:
romankko2 committed 2023-09-07 20:38:15 +02:00
1 parent d44f9e4358
commit 1cfdf1b044
2 files changed
+19 -5

No files matched your search

@@ -22,7 +22,7 @@ import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
mixins: [ modalMixin ], mixins: [ modalMixin ],
emits: ['close', 'on-master-task-edited'], emits: ['close', 'master-task-edited'],
data() { data() {
return { return {
@@ -43,7 +43,8 @@ export default {
const { mastertask } = await this.$axios.put_auth(`v1/mastertasks/${tempMastertask.id}`, tempMastertask) const { mastertask } = await this.$axios.put_auth(`v1/mastertasks/${tempMastertask.id}`, tempMastertask)
this.visible = false this.visible = false
this.$emit('on-master-task-edited', mastertask) this.$emit('master-task-edited', mastertask)
this.$events.emit('close-both-modals')
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
@@ -60,7 +60,7 @@
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4"> <div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
<h1>{{ mastertask.name }}</h1> <h1>{{ mastertask.name }}</h1>
<div class="d-flex justify-start"> <div class="d-flex justify-start">
<img class="icon" :src="require('@/plugins/app/_img/icons/pencil.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" /> <img v-if="!mastertask.is_finished" class="icon" :src="require('@/plugins/app/_img/icons/pencil.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
<img class="icon trash" :src="require('@/plugins/app/_img/icons/bin.svg')" alt="trash-icon" @click.stop="openDeleteMasterTaskModal(mastertask)" /> <img class="icon trash" :src="require('@/plugins/app/_img/icons/bin.svg')" alt="trash-icon" @click.stop="openDeleteMasterTaskModal(mastertask)" />
</div> </div>
</div> </div>
@@ -184,6 +184,8 @@ export default {
}, },
mounted() { mounted() {
this.$events.on('close-both-modals', this.closeBothModals)
this.$events.on('master-task:team-member-deleted', ({ teamId, memberId }) => { this.$events.on('master-task:team-member-deleted', ({ teamId, memberId }) => {
if (this.mastertask.team_id != teamId) if (this.mastertask.team_id != teamId)
return return
@@ -216,9 +218,15 @@ export default {
this.$events.off('on-subtask-deleted') this.$events.off('on-subtask-deleted')
this.$events.off('on-subtask-edited') this.$events.off('on-subtask-edited')
this.$events.off('master-task:team-member-deleted') this.$events.off('master-task:team-member-deleted')
this.$events.off('close-both-modals', this.closeBothModals)
}, },
methods: { methods: {
closeBothModals() {
this.$emit('close')
this.visible = false
},
removeEmployee({ id }) { removeEmployee({ id }) {
// const isEmployeeInTeam = this.mastertask.team?.employees.find(employee => employee.id == id) // const isEmployeeInTeam = this.mastertask.team?.employees.find(employee => employee.id == id)
@@ -253,6 +261,11 @@ export default {
this.mastertask.project_id = project?.id || null this.mastertask.project_id = project?.id || null
this.mastertask.team_id = this.mastertask.team?.id || null this.mastertask.team_id = this.mastertask.team?.id || null
// this.mastertask.subtasks.forEach(({ employee_id, duration}) => {
// const employee = this.mastertask.employees.find(({ id }) => id == employee_id)
// employee.duration = duration
// })
// this.mastertask.project_code = project.code // this.mastertask.project_code = project.code
} else { } else {
this.mastertask = { employees: [], duration: 0, _deadline_time: '17:00' } this.mastertask = { employees: [], duration: 0, _deadline_time: '17:00' }
@@ -264,8 +277,8 @@ export default {
} }
}, },
async toggleIsFinished(mastertask) { toggleIsFinished() {
this.$events.emit('show-complete-master-task-modal', { mastertask }) this.$events.emit('show-complete-master-task-modal', { mastertask: this.mastertask })
}, },
async save() { async save() {