[mastertask] complete mastertask

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

No files matched your search

@@ -22,7 +22,7 @@ import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default {
mixins: [ modalMixin ],
emits: ['close', 'on-master-task-edited'],
emits: ['close', 'master-task-edited'],
data() {
return {
@@ -43,7 +43,8 @@ export default {
const { mastertask } = await this.$axios.put_auth(`v1/mastertasks/${tempMastertask.id}`, tempMastertask)
this.visible = false
this.$emit('on-master-task-edited', mastertask)
this.$emit('master-task-edited', mastertask)
this.$events.emit('close-both-modals')
} catch (error) {
this.$toast.error(error)
}
@@ -60,7 +60,7 @@
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
<h1>{{ mastertask.name }}</h1>
<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)" />
</div>
</div>
@@ -184,6 +184,8 @@ export default {
},
mounted() {
this.$events.on('close-both-modals', this.closeBothModals)
this.$events.on('master-task:team-member-deleted', ({ teamId, memberId }) => {
if (this.mastertask.team_id != teamId)
return
@@ -216,9 +218,15 @@ export default {
this.$events.off('on-subtask-deleted')
this.$events.off('on-subtask-edited')
this.$events.off('master-task:team-member-deleted')
this.$events.off('close-both-modals', this.closeBothModals)
},
methods: {
closeBothModals() {
this.$emit('close')
this.visible = false
},
removeEmployee({ 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.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
} else {
this.mastertask = { employees: [], duration: 0, _deadline_time: '17:00' }
@@ -264,8 +277,8 @@ export default {
}
},
async toggleIsFinished(mastertask) {
this.$events.emit('show-complete-master-task-modal', { mastertask })
toggleIsFinished() {
this.$events.emit('show-complete-master-task-modal', { mastertask: this.mastertask })
},
async save() {
@@ -43,7 +43,7 @@ export default {
delete timesheet.employee_name
return timesheet
})}
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${tempSubtask.id}`, tempSubtask)
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${tempSubtask.id}`, tempSubtask)
this.visible = false
this.$emit('on-subtask-edited', subtask)