mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
91 lines
2.6 KiB
Vue
91 lines
2.6 KiB
Vue
<template>
|
|
<div v-if="Array.isArray(subtasks) && subtasks.length">
|
|
<h1 class="px-3 py-3">Subtasks</h1>
|
|
<v-table>
|
|
<tbody>
|
|
<tr v-for="subtask in enrichedtasks" :key="subtask.id">
|
|
<td>{{ subtask.master_task }}</td>
|
|
<td class="d-flex align-center">
|
|
<p class="employee-selected-avatar d-flex justify-center align-center">
|
|
{{ subtask._employeeInitials }}
|
|
</p>
|
|
<p class="ml-2">{{ subtask._employeeFullName }}</p>
|
|
</td>
|
|
<td class="task-action">
|
|
<div class="d-flex justify-start">
|
|
<img v-if="subtask.is_finished" class="pencil-icon is-finished" :src="require('@/plugins/app/_img/icons/checkmark.svg')" alt="checkmark-icon" @click.stop="clickCompleteTask(subtask)">
|
|
<img v-if="!subtask.is_finished" class="pencil-icon" :src="require('@/plugins/app/_img/icons/checkmark.svg')" alt="checkmark-icon" @click.stop="clickCompleteTask(subtask)">
|
|
<img class="pencil-icon ml-2" :src="require('@/plugins/app/_img/icons/pencil.svg')" alt="pencil-icon" @click.stop="openTaskModal(subtask, true)">
|
|
<img class="pencil-icon ml-2" :src="require('@/plugins/app/_img/icons/eye.svg')" alt="eye-icon" @click.stop="openTaskModal(subtask, false)">
|
|
<img class="trash-icon ml-2" :src="require('@/plugins/app/_img/icons/bin.svg')" alt="trash-icon" @click.stop="openDeleteTaskModal(subtask)">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</v-table>
|
|
</div>
|
|
<div v-else class="px-3 py-3">
|
|
<h1>Subtasks</h1>
|
|
<p>No subtasks match the search</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
|
|
export default {
|
|
props: {
|
|
subtasks: {
|
|
type: Array,
|
|
required: true
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
...mapGetters('tm', ['enrichedEmployees']),
|
|
|
|
enrichedtasks() {
|
|
return this.subtasks.map(subtask => {
|
|
const employee = this.enrichedEmployees.find(employee => employee.id == subtask.employee_id)
|
|
|
|
return {
|
|
...subtask,
|
|
_employeeInitials: employee._initials,
|
|
_employeeFullName: employee._fullName
|
|
}
|
|
})
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
openDeleteTaskModal(subtask) {
|
|
this.$events.emit('show-delete-task-modal', { subtask })
|
|
},
|
|
|
|
openTaskModal(subtask, editMode) {
|
|
this.$events.emit('show-subtask-modal', { subtask, editMode })
|
|
},
|
|
|
|
async clickCompleteTask(subtask) {
|
|
this.$events.emit('show-complete-task-modal', { subtask })
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="sass" scoped>
|
|
v-table, th, td
|
|
border: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
|
|
|
|
.employee-avatar
|
|
background: #6200EE
|
|
color: #fff
|
|
border-radius: 50%
|
|
padding: 13px
|
|
font-size: 11.5px
|
|
height: 24px
|
|
width: 24px
|
|
|
|
.task-action
|
|
|
|
</style> |