[subTask, masterTask detail-modal]

This commit is contained in:
romankko2 committed 2023-01-11 12:10:24 +01:00
1 parent f237ba05bf
commit 258b13c92a
31 files changed
+1465 -88

No files matched your search

@@ -1,9 +1,9 @@
<template>
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
<W-loadable :content="masterTask" class="h-100">
<v-card height="100%" class="d-flex flex-column scrolling">
<W-loadable :content="masterTask && employees" class="h-100">
<v-card v-if="editMode" height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header">
<h1>Vytvoriť master task</h1>
<h1>{{ masterTask.id ? 'Upraviť master task' : 'Vytvoriť master task' }}</h1>
<v-icon
@click.stop="close()"
icon="mdi-close"
@@ -116,6 +116,184 @@
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
</v-card>
<v-card v-else height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center">
<p>{{ masterTask.project_code }}</p>
<v-icon
@click.stop="close()"
icon="mdi-close"
size="large"
class="pb-5"
></v-icon>
</div>
<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="pencil-icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="deleteTask()"/>
</div>
</div>
<v-card-actions class="d-flex flex-column modal-content">
<div class="w-100">
<v-row no-gutters class="align-center">
<v-col cols="5">
<v-sheet class="pa-2 ma-2">
<div class="d-flex align-center">
<v-icon
icon="mdi-drag-vertical"
size="large"
></v-icon>
<p class="mx-3">Status</p>
</div>
</v-sheet>
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p v-if="masterTask.is_finished" class="status-badge px-4 py-2 rounded-pill">Ukončený</p>
<p v-if="!masterTask.is_finished" class="status-badge px-4 py-2 rounded-pill">Neukončený</p>
</v-sheet>
</v-col>
</v-row>
<v-row no-gutters class="align-center">
<v-col cols="5">
<v-sheet class="pa-2 ma-2">
<div class="d-flex align-center">
<v-icon
icon="mdi-calendar-week"
size="large"
></v-icon>
<p class="mx-3">Deadline</p>
</div>
</v-sheet>
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p class="text-red-darken-4">{{ formattedDeadline }}</p>
</v-sheet>
</v-col>
</v-row>
<v-row no-gutters class="align-center">
<v-col cols="5">
<v-sheet class="pa-2 ma-2">
<div class="d-flex align-center">
<v-icon
icon="mdi-account-multiple-outline"
size="large"
></v-icon>
<p class="mx-3">Tím</p>
</div>
</v-sheet>
</v-col>
<v-col cols="7">
<v-sheet class="ma-2 d-flex scroll-employees">
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ masterTask.team }}</p>
<div class="d-flex align-center flex-shrink-0 mx-3" v-for="(employee, index) in masterTask.employees" :key="employee.id">
<p class="employee-selected-avatar d-flex justify-center align-center">
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
</p>
<p class="ml-2" v-html="`${masterTask.employees[index].name} ${masterTask.employees[index].surname}`" />
</div>
</v-sheet>
</v-col>
</v-row>
<v-row no-gutters class="align-center">
<v-col cols="5">
<v-sheet class="pa-2 ma-2">
<div class="d-flex align-center">
<v-icon
icon="mdi-clock-time-three-outline"
size="large"
></v-icon>
<p class="mx-3">Naplánovaný čas</p>
</div>
</v-sheet>
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p>{{ (masterTask.duration / 60 / 60).toFixed(2) }} h</p>
</v-sheet>
</v-col>
</v-row>
<v-row no-gutters class="align-center">
<v-col cols="5">
<v-sheet class="pa-2 ma-2">
<div class="d-flex align-center">
<v-icon
icon="mdi-timer-outline"
size="large"
></v-icon>
<p class="mx-3">Odpracovaný čas</p>
</div>
</v-sheet>
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p class="text-red-darken-4">{{ masterTask.worked_time }} h</p>
</v-sheet>
</v-col>
</v-row>
<v-row no-gutters class="align-center border-bottom">
<v-col cols="5">
<v-sheet class="pa-2 ma-2">
<div class="d-flex align-center">
<v-icon
icon="mdi-clock-time-three-outline"
size="large"
></v-icon>
<p class="mx-3">Zostávajúci čas</p>
</div>
</v-sheet>
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p class="text-red-darken-4">{{ masterTask.remaining_time }} h</p>
</v-sheet>
</v-col>
</v-row>
<div class="px-5 py-5 border-bottom">
<p>Popis zadania</p>
<section class="description-detail px-2 py-2 w-100 rounded mt-2">{{ masterTask.description }}</section>
<p class="mt-5">Prílohy</p>
<div class="w-100 d-flex align-center">
<div v-for="(file, index) in masterTask.files" :key="file.id" class="d-flex align-center flex-wrap" :class="[index === 0 ? 'ml-0': 'ml-2']">
<v-chip class="mt-2">
{{ file.name }}
<v-icon class="mx-1" icon="mdi-paperclip"></v-icon>
</v-chip>
</div>
</div>
</div>
<div class="d-flex justify-start align-center mt-8">
<v-btn class="z-btn" @click="save()">Ukončiť mastertask</v-btn>
</div>
<v-table class="mt-7 mb-5">
<tbody class="px-5 py-5">
<tr v-for="(employee, index) in masterTask.employees" :key="employee.id">
<td class="w-25">{{ masterTask.name }}</td>
<td class="d-flex align-center">
<p class="employee-selected-avatar d-flex justify-center align-center">
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
</p>
<p class="ml-2" v-html="`${masterTask.employees[index].name} ${masterTask.employees[index].surname}`" />
</td>
<td class="task-action">
<div class="d-flex justify-start">
<img class="pencil-icon" :src="require('@/plugins/tm@dashboard/tasks/_components/_img/checkmark.svg')" alt="checkmark-icon" :style="{opacity: 0.3}">
<img class="pencil-icon ml-2" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" :style="{opacity: 0.3}">
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" :style="{opacity: 0.3}">
</div>
</td>
</tr>
</tbody>
</v-table>
<div class="d-flex align-center ">
<v-btn class="subtask-btn w-100"><v-icon class="mx-1" icon="mdi-plus" />Pridať Subtask</v-btn>
</div>
</div>
</v-card-actions>
</v-card>
</W-loadable>
</v-dialog>
</template>
@@ -127,6 +305,7 @@ import useVuelidate from '@vuelidate/core'
import { required } from '@vuelidate/validators'
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
import moment from 'moment'
const atLeastOne = (value) => value.length
@@ -141,6 +320,7 @@ export default {
data() {
return {
editMode: false,
visible: false,
errorUtils,
v$: useVuelidate(),
@@ -178,10 +358,9 @@ export default {
},
methods: {
async create(masterTask = null) {
if (masterTask) {
this.masterTask = masterTask
await this._load()
async create(masterTaskId = null, editMode = false) {
if (masterTaskId) {
await this._load(masterTaskId)
} else {
this.masterTask = {
project_code: null,
@@ -195,6 +374,7 @@ export default {
}
}
this.editMode = editMode || (!this.masterTask.id)
this.visible = true
},
@@ -221,6 +401,15 @@ export default {
this.masterTask = null
},
async _load(masterTaskId) {
try {
this.masterTask = await this.$axios.get_auth_data(`v1/master-tasks/${masterTaskId}`)
console.log(this.masterTask)
} catch (error) {
this.$toast.error(error)
}
},
async _create() {
try {
await this.$axios.post_auth('v1/master-tasks')
@@ -237,6 +426,15 @@ export default {
}
},
async deleteTask(masterTaskId) {
try {
await this.$axios.delete(`v1/master-tasks/${masterTaskId}`)
this.close()
} catch (error) {
this.$toast.error(error)
}
},
employeeSelected(selectedOption) {
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
this.masterTask.employees.push(employee)
@@ -292,6 +490,12 @@ export default {
value: `${employee.name} ${employee.surname}`,
}
})
},
formattedDeadline() {
let deadline = moment(this.masterTask.deadline)
let date = deadline.format('DD.MM.yyyy')
return date
}
},
@@ -351,4 +555,34 @@ export default {
height: 50px
.scrolling
overflow: hidden !important
.scroll-employees
overflow-x: scroll
.trash-icon
padding: 10px
background: rgba(0, 0, 0, 0.04)
margin-left: 12px
border-radius: 50%
cursor: pointer
.pencil-icon
padding: 10px
background: rgba(0, 0, 0, 0.04)
border-radius: 50%
cursor: pointer
.border-bottom
border-bottom: 1px solid rgba(0,0,0,.1)
.subtask-btn
border: thin solid rgba(var(--v-border-color), var(--v-border-opacity)) !important
color: #7f39fb !important
height: 53px
text-align: center
v-table, tbody
border-top: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
border-bottom: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
td:not(:last-child)
border-right: thin solid rgba(var(--v-border-color), var(--v-border-opacity))
</style>