mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[subTask, masterTask detail-modal]
This commit is contained in:
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>
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
|
||||
<W-loadable :content="subTask" class="h-100">
|
||||
<v-card height="100%" class="d-flex flex-column scrolling">
|
||||
<W-loadable :content="task && 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ť subtask</h1>
|
||||
<h1>{{ task.id ? 'Upraviť task' : 'Vytvoriť task' }}</h1>
|
||||
<v-icon
|
||||
@click.stop="close()"
|
||||
icon="mdi-close"
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field
|
||||
v-model="subTask.project_code"
|
||||
v-model="task.project_code"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
label="Kód projektu"
|
||||
@@ -30,16 +30,16 @@
|
||||
:items="masterTaskOptions"
|
||||
></v-select>
|
||||
|
||||
<p v-if="subTask.team.employees" class="d-flex justify-start align-center w-100 mb-3 text-grey">Priradení zamestnanci</p>
|
||||
<p v-if="task.team.employees" class="d-flex justify-start align-center w-100 mb-3 text-grey">Priradení zamestnanci</p>
|
||||
|
||||
<v-text-field
|
||||
v-for="(employee, index) in subTask.employees"
|
||||
v-for="(employee, index) in task.employees"
|
||||
:key="employee.id"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
:value="`${employee.name} ${employee.surname}`"
|
||||
variant="solo"
|
||||
v-model="subTask.employees[index].name"
|
||||
v-model="task.employees[index].name"
|
||||
disabled
|
||||
>
|
||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||
@@ -50,24 +50,24 @@
|
||||
<Z-autocomplete
|
||||
v-if="showAddEmployeeInput"
|
||||
:options="employeesOptions"
|
||||
:validations="v$.subTask.employees"
|
||||
:class="{ error: v$.subTask.employees.$errors.length }"
|
||||
:validations="v$.task.employees"
|
||||
:class="{ error: v$.task.employees.$errors.length }"
|
||||
class="modal-input"
|
||||
@option-selected="employeeSelected"
|
||||
/>
|
||||
|
||||
<v-btn class="w-100 mb-5 add-employee-btn" :disabled="!subTask.team.employees" @click="showAddEmployeeInput = true">
|
||||
<v-btn class="w-100 mb-5 add-employee-btn" :disabled="!task.team.employees" @click="showAddEmployeeInput = true">
|
||||
<v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca
|
||||
</v-btn>
|
||||
|
||||
<Datepicker
|
||||
class="modal-input mb-5"
|
||||
v-model="subTask.date"
|
||||
v-model="task.date"
|
||||
format="dd.MM.yyyy, HH:mm"
|
||||
locale="sk"
|
||||
:class="{ error: v$.subTask.date.$errors.length }"
|
||||
:class="{ error: v$.task.date.$errors.length }"
|
||||
@focus="onDateFocus"
|
||||
:validations="v$.subTask.date"
|
||||
:validations="v$.task.date"
|
||||
select-text="Vybrať"
|
||||
cancel-text="Zrušiť"
|
||||
placeholder="Trvanie od - do"
|
||||
@@ -76,16 +76,16 @@
|
||||
/>
|
||||
|
||||
<v-text-field
|
||||
v-model="subTask.duration"
|
||||
v-model="task.duration"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input"
|
||||
variant="solo"
|
||||
type="number"
|
||||
label="Časový odhad"
|
||||
:class="{ error: v$.subTask.duration.$errors.length }"
|
||||
:class="{ error: v$.task.duration.$errors.length }"
|
||||
:hint="
|
||||
v$.subTask.duration.$errors
|
||||
? errorUtils.parseErrors(v$.subTask.duration.$errors)
|
||||
v$.task.duration.$errors
|
||||
? errorUtils.parseErrors(v$.task.duration.$errors)
|
||||
: null
|
||||
"
|
||||
append-inner-icon="mdi-clock-outline"
|
||||
@@ -95,19 +95,198 @@
|
||||
label="Popis"
|
||||
class="modal-input"
|
||||
variant="solo"
|
||||
:class="{ error: v$.subTask.description.$errors.length }"
|
||||
:class="{ error: v$.task.description.$errors.length }"
|
||||
:hint="
|
||||
v$.subTask.description.$errors
|
||||
? errorUtils.parseErrors(v$.subTask.description.$errors)
|
||||
v$.task.description.$errors
|
||||
? errorUtils.parseErrors(v$.task.description.$errors)
|
||||
: null
|
||||
"
|
||||
v-model="subTask.description"
|
||||
v-model="task.description"
|
||||
></v-textarea>
|
||||
|
||||
<Z-files-upload @files-uploaded="filesUploaded"/>
|
||||
</v-card-actions>
|
||||
|
||||
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
|
||||
<v-btn class="z-btn" @click="save()">{{ task.id ? 'UPRAVIŤ' : '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>{{ task.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>{{ task.master_task }}</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-link"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Mastertask</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p class="task-badge px-4 py-2 rounded-pill">{{ task.master_task }}</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-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="task.is_finished" class="status-badge px-4 py-2 rounded-pill">Ukončený</p>
|
||||
<p v-if="!task.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">Trvanie</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2">
|
||||
<p v-html="`${formattedStartDate} - ${formattedEndDate}`" />
|
||||
</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-outline"
|
||||
size="large"
|
||||
></v-icon>
|
||||
<p class="mx-3">Priradený</p>
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="ma-2 d-flex flex-wrap">
|
||||
<div class="d-flex align-center mb-2 me-2" v-for="(employee, index) in task.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="`${task.employees[index].name} ${task.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>{{ (task.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">
|
||||
<v-text-field
|
||||
v-model="task.nieco"
|
||||
class="modal-input"
|
||||
variant="solo"
|
||||
type="number"
|
||||
placeholder="h"
|
||||
></v-text-field>
|
||||
</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>{{ task.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">{{ task.description }}</section>
|
||||
<p class="mt-5">Prílohy</p>
|
||||
<div class="w-100 d-flex align-center">
|
||||
<div v-for="(file, index) in task.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="done-btn">Dokončené</v-btn>
|
||||
<v-btn class="add-employee-btn" @click="save()">Uložiť zmeny</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</W-loadable>
|
||||
</v-dialog>
|
||||
@@ -120,6 +299,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
|
||||
|
||||
@@ -134,8 +314,9 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
editMode: false,
|
||||
visible: false,
|
||||
subTask: null,
|
||||
task: null,
|
||||
errorUtils,
|
||||
v$: useVuelidate(),
|
||||
preventInputFocus: false,
|
||||
@@ -148,7 +329,7 @@ export default {
|
||||
|
||||
validations() {
|
||||
return {
|
||||
subTask: {
|
||||
task: {
|
||||
project_code: { required },
|
||||
date: { required },
|
||||
team: { required },
|
||||
@@ -169,12 +350,11 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
async create(subTask = null) {
|
||||
if (subTask) {
|
||||
this.subTask = subTask
|
||||
await this._load()
|
||||
async create(taskId = null, editMode = false) {
|
||||
if (taskId) {
|
||||
await this._load(taskId)
|
||||
} else {
|
||||
this.subTask = {
|
||||
this.task = {
|
||||
project_code: null,
|
||||
date: null,
|
||||
team: {},
|
||||
@@ -185,6 +365,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
this.editMode = editMode || (!this.task.id)
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
@@ -193,7 +374,7 @@ export default {
|
||||
return
|
||||
|
||||
try {
|
||||
if (this.subTask.id)
|
||||
if (this.task.id)
|
||||
await this._update()
|
||||
else
|
||||
await this._create()
|
||||
@@ -201,14 +382,23 @@ export default {
|
||||
this.close()
|
||||
this.$router.push({ name: 'Dashboard - Tasks' })
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.$toast(error)
|
||||
}
|
||||
},
|
||||
|
||||
close() {
|
||||
this.visible = false
|
||||
this.$emit('close', this.subTask)
|
||||
this.subTask = null
|
||||
this.$emit('close', this.task)
|
||||
this.task = null
|
||||
},
|
||||
|
||||
async _load(taskId) {
|
||||
try {
|
||||
this.task = await this.$axios.get_auth_data(`v1/tasks/${taskId}`)
|
||||
console.log(this.task)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
async _create() {
|
||||
@@ -221,15 +411,24 @@ export default {
|
||||
|
||||
async _update() {
|
||||
try {
|
||||
await this.$axios.post_auth(`v1/master-tasks/${this.subTask.id}`)
|
||||
await this.$axios.post_auth(`v1/master-tasks/${this.task.id}`)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
async deleteTask(taskId) {
|
||||
try {
|
||||
await this.$axios.delete(`v1/tasks/${taskId}`)
|
||||
this.close()
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
employeeSelected(selectedOption) {
|
||||
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
|
||||
this.subTask.employees.push(employee)
|
||||
this.task.employees.push(employee)
|
||||
this.showAddEmployeeInput = false
|
||||
},
|
||||
|
||||
@@ -248,7 +447,7 @@ export default {
|
||||
},
|
||||
|
||||
filesUploaded(files) {
|
||||
this.subTask.files = files
|
||||
this.task.files = files
|
||||
}
|
||||
},
|
||||
|
||||
@@ -258,7 +457,7 @@ export default {
|
||||
},
|
||||
|
||||
employeesOptions() {
|
||||
const selectedEmployeesIds = this.subTask.employees.map(
|
||||
const selectedEmployeesIds = this.task.employees.map(
|
||||
(employee) => employee.id
|
||||
)
|
||||
const employees = this.employees.filter(
|
||||
@@ -271,14 +470,26 @@ export default {
|
||||
value: `${employee.name} ${employee.surname}`,
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
formattedStartDate() {
|
||||
let startDate = moment(this.task.starts_at)
|
||||
let date = startDate.format('DD.MM.yyyy, HH:mm')
|
||||
return date
|
||||
},
|
||||
|
||||
formattedEndDate() {
|
||||
let endDate = moment(this.task.ends_at)
|
||||
let date = endDate.format('DD.MM.yyyy, HH:mm')
|
||||
return date
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
selectedMasterTask() {
|
||||
this.subTask.team = this.masterTasks.find(masterTask => `${masterTask.name} - ${masterTask.id}` == this.selectedMasterTask)
|
||||
this.subTask.employees = this.subTask.team.employees
|
||||
this.subTask.project_code = this.masterTasks.filter(x => `${x.name} - ${x.id}` == this.selectedMasterTask)[0].project_code
|
||||
this.task.team = this.masterTasks.find(masterTask => `${masterTask.name} - ${masterTask.id}` == this.selectedMasterTask)
|
||||
this.task.employees = this.task.team.employees
|
||||
this.task.project_code = this.masterTasks.filter(x => `${x.name} - ${x.id}` == this.selectedMasterTask)[0].project_code
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -322,6 +533,29 @@ export default {
|
||||
border: 1px solid #E0E0E0
|
||||
border-radius: 4px
|
||||
height: 50px
|
||||
width: 203px
|
||||
.scrolling
|
||||
overflow: hidden !important
|
||||
|
||||
.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)
|
||||
|
||||
.done-btn
|
||||
background: #7f39fb !important
|
||||
border-radius: 4px !important
|
||||
color: #fff !important
|
||||
height: 50px
|
||||
width: 203px
|
||||
</style>
|
||||
Reference in new issue
Block a user