Merge branch 'main' of bitbucket.org:studiotem/jandl-taskmanager-app

This commit is contained in:
StudioTem committed 2023-09-06 15:46:22 +02:00
commit 026ca33971
13 files changed
+163 -111

No files matched your search

+3 -3
View File
@@ -55,7 +55,7 @@ const routes: Array<RouteRecordRaw> = [
{ {
path: '/app/dashboard/tasks', path: '/app/dashboard/tasks',
name: 'Dashboard - Tasks', name: 'Dashboard - Tasks',
meta: { title: 'Tasks', requiresAuth: true }, meta: { title: 'Sub Tasks', requiresAuth: true },
component: () => import('@/plugins/tm@dashboard/tasks/tasks.vue') component: () => import('@/plugins/tm@dashboard/tasks/tasks.vue')
}, },
{ {
@@ -74,13 +74,13 @@ const routes: Array<RouteRecordRaw> = [
{ {
path: '/app/overview/unscheduled', path: '/app/overview/unscheduled',
name: 'Overview - Unscheduled tasks', name: 'Overview - Unscheduled tasks',
meta: { title: 'Unscheduled tasks', requiresAuth: true }, meta: { title: 'Unscheduled Sub Tasks', requiresAuth: true },
component: () => import('@/plugins/tm@overview/tasks-unscheduled/tasks-unscheduled.vue') component: () => import('@/plugins/tm@overview/tasks-unscheduled/tasks-unscheduled.vue')
}, },
{ {
path: '/app/overview/ongoing', path: '/app/overview/ongoing',
name: 'Overview - Ongoing tasks', name: 'Overview - Ongoing tasks',
meta: { title: 'Ongoing tasks', requiresAuth: true }, meta: { title: 'Ongoing Sub Tasks', requiresAuth: true },
component: () => import('@/plugins/tm@overview/tasks-ongoing/tasks-ongoing.vue') component: () => import('@/plugins/tm@overview/tasks-ongoing/tasks-ongoing.vue')
}, },
{ {
@@ -30,7 +30,7 @@ export default {
data() { data() {
return { return {
pages: [{ pages: [{
title: 'Tasks', title: 'Sub Tasks',
pageName: 'Dashboard - Tasks' pageName: 'Dashboard - Tasks'
}, },
{ {
@@ -42,11 +42,11 @@ export default {
pageName: 'Dashboard - Projects' pageName: 'Dashboard - Projects'
}, },
{ {
title: 'Unscheduled tasks', title: 'Unscheduled Sub Tasks',
pageName: 'Overview - Unscheduled tasks' pageName: 'Overview - Unscheduled tasks'
}, },
{ {
title: 'Ongoing tasks', title: 'Ongoing Sub Tasks',
pageName: 'Overview - Ongoing tasks' pageName: 'Overview - Ongoing tasks'
}, },
{ {
@@ -88,7 +88,7 @@ export default {
<style lang="sass" scoped> <style lang="sass" scoped>
ion-item ion-item
font-weight: 500 !important font-weight: 500 !important
font-size: 15px font-size: 13.5px
--background: #fff --background: #fff
&:hover &:hover
@@ -1,6 +1,6 @@
<template> <template>
<div v-if="Array.isArray(subtasks) && subtasks.length"> <div v-if="Array.isArray(subtasks) && subtasks.length">
<h1 class="px-3 py-3">Tasks</h1> <h1 class="px-3 py-3">Subtasks</h1>
<v-table> <v-table>
<tbody> <tbody>
<tr v-for="subtask in enrichedtasks" :key="subtask.id"> <tr v-for="subtask in enrichedtasks" :key="subtask.id">
@@ -83,9 +83,14 @@
<small class="event-initials-date">{{ event.date?.toLocaleDateString('sk-SK') }}</small> <small class="event-initials-date">{{ event.date?.toLocaleDateString('sk-SK') }}</small>
</div> </div>
<div v-if="event.subtask?.deadline" class="d-flex align-center"> <div v-if="event.type == 'subtask'" class="d-flex align-center">
<v-icon icon="mdi-skull-outline" size="small" /> <v-icon icon="mdi-skull-outline" size="small" />
<small class="ml-1" :class="`${tmUtils.isAfter(event.subtask?.deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDate(event.subtask?.deadline) }}</small> <small v-if="event?.subtask.deadline" class="ml-1">{{ getDeadline(event?.subtask) }}</small>
<v-tooltip v-else text="Deadline z Mastertasku" location="bottom">
<template v-slot:activator="{ props }">
<small class="cursor-pointer ml-1" v-if="!event?.subtask?.deadline" v-bind="props">{{ getDeadline(event?.subtask) }}*</small>
</template>
</v-tooltip>
</div> </div>
</div> </div>
@@ -109,8 +114,10 @@
</template> </template>
<script> <script>
import { addDays } from 'date-fns' import { addDays } from 'date-fns'
import tmUtils from '@/plugins/tm@_utils/tm.utils' import tmUtils from '@/plugins/tm@_utils/tm.utils'
import { mapGetters } from 'vuex'
import moment from 'moment'
export default { export default {
props: { props: {
@@ -154,7 +161,18 @@ export default {
} }
}, },
computed: {
...mapGetters('tm', ['mastertasks'])
},
methods: { methods: {
getDeadline(subtask) {
if(subtask.deadline) return moment(subtask.deadline).format('DD.MM.yyyy')
else if(!this.mastertasks) return ''
const masterTask = this.mastertasks.find((mt) => mt.id === subtask.master_task_id)
return moment(masterTask).format('DD.MM.yyyy') ? moment(masterTask.deadline).format('DD.MM.yyyy') : ''
},
weekChanged() { weekChanged() {
const scrollContainer = this.$el.getElementsByClassName('vuecal__scrollable-body')[0] const scrollContainer = this.$el.getElementsByClassName('vuecal__scrollable-body')[0]
scrollContainer.scrollLeft = 0 scrollContainer.scrollLeft = 0
@@ -294,8 +312,8 @@ export default {
.colWidth .colWidth
width: 120px width: 120px
@media (min-width: 1476px) // @media (min-width: 1476px)
width: 100% !important // width: 100% !important
.vuecal .vuecal
box-shadow: none !important box-shadow: none !important
@@ -435,7 +453,6 @@ export default {
.vuecal__event .vuecal__event
border-radius: 16px border-radius: 16px
// padding: 20px 10px
min-height: 70px !important min-height: 70px !important
text-align: left text-align: left
background: rgba(248, 248, 248, 1) background: rgba(248, 248, 248, 1)
@@ -466,7 +483,7 @@ export default {
&.vuecal__event--focus &.vuecal__event--focus
z-index: 100 !important z-index: 100 !important
min-height: 250px !important min-height: 350px !important
width: 100% !important width: 100% !important
left: 0 !important left: 0 !important
@@ -485,14 +502,15 @@ export default {
.mini-event .mini-event
.event-content .event-content
display: flex // display: flex
align-items: center // align-items: center
flex-wrap: nowrap // flex-wrap: nowrap
justify-content: space-between // justify-content: space-between
width: 100% width: 100%
padding: 5px 10px
.event-initials-wrapper .event-initials-wrapper
margin-bottom: 0 // margin-bottom: 0
.event-initials .event-initials
margin-right: 0 margin-right: 0
@@ -5,7 +5,8 @@ export default {
methods: { methods: {
handleKeyDown(event) { handleKeyDown(event) {
if (event.keyCode === 27) this.closeModal() // if (event.keyCode === 27) this.closeModal()
if (event.keyCode === 27) this.visible = false
} }
}, },
} }
@@ -39,7 +39,7 @@ export default {
async complete() { async complete() {
try { try {
const tempMastertask = {...this.mastertask, is_finished: this.mastertask.is_finished ? 0 : 1, duration: this.mastertask.duration } const tempMastertask = {...this.mastertask, is_finished: this.mastertask.is_finished ? 0 : 1 }
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
@@ -76,7 +76,7 @@
<A-tasks-table :subtasks="mastertask.subtasks" /> <A-tasks-table :subtasks="mastertask.subtasks" />
<div class="d-flex align-center "> <div class="d-flex align-center ">
<v-btn class="subtask-btn w-100" @click="addTask()" ><v-icon class="mx-1" icon="mdi-plus" />Pridať task</v-btn> <v-btn class="subtask-btn w-100" @click="addTask()" ><v-icon class="mx-1" icon="mdi-plus" />Pridať sub task</v-btn>
</div> </div>
</div> </div>
</v-card-actions> </v-card-actions>
@@ -10,28 +10,46 @@
</v-col> </v-col>
<v-col cols="7"> <v-col cols="7">
<v-sheet class="py-3"> <v-sheet class="py-3">
<p v-if="deadline" :class="`${tmUtils.isAfter(deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDate(deadline) }}</p> <p v-if="subtask.deadline" :class="`${tmUtils.isAfter(subtask.deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDate(subtask.deadline) }}</p>
<p v-else>Tento task nema určený deadline</p> <v-tooltip v-else text="Deadline z Mastertasku" location="end">
<template v-slot:activator="{ props }">
<span class="cursor-pointer" v-bind="props">{{ getMasterTaskDeadline(subtask) }}*</span>
</template>
</v-tooltip>
</v-sheet> </v-sheet>
</v-col> </v-col>
</v-row> </v-row>
</template> </template>
<script> <script>
import tmUtils from '@/plugins/tm@_utils/tm.utils' import tmUtils from '@/plugins/tm@_utils/tm.utils'
import moment from 'moment'
import { mapGetters } from 'vuex'
export default { export default {
props: { props: {
deadline: { subtask: {
type: [String, Object, null], type: [String, Object, null],
required: true required: true
} }
}, },
computed: {
...mapGetters('tm', ['mastertasks'])
},
data() { data() {
return { return {
tmUtils tmUtils
} }
},
methods: {
getMasterTaskDeadline(subtask) {
if(!this.mastertasks) return ''
const masterTask = this.mastertasks.find((mt) => mt.id === subtask.master_task_id)
return moment(masterTask).format('DD.MM.yyyy') ? moment(masterTask.deadline).format('DD.MM.yyyy') : ''
}
} }
} }
</script> </script>
@@ -1,7 +1,7 @@
<template> <template>
<A-mastertask-name :name="subtask._master_task.name" :id="subtask.master_task_id" :color="subtask._master_task.color" @close-modal="$emit('close-modal')" /> <A-mastertask-name :name="subtask._master_task.name" :id="subtask.master_task_id" :color="subtask._master_task.color" @close-modal="$emit('close-modal')" />
<A-mastertask-status :isFinished="subtask.is_finished" /> <A-mastertask-status :isFinished="subtask.is_finished" />
<A-task-deadline :deadline="subtask.deadline" /> <A-task-deadline :subtask="subtask" />
<A-task-timeblocks :timeblocks="subtask.timeblocks" :subtask="subtask" @update-subtask="$emit('update-subtask', $event)" /> <A-task-timeblocks :timeblocks="subtask.timeblocks" :subtask="subtask" @update-subtask="$emit('update-subtask', $event)" />
<Z-created-by :employee-id="subtask.created_by" /> <Z-created-by :employee-id="subtask.created_by" />
<A-task-assigned-employee :employee="subtask._employee" /> <A-task-assigned-employee :employee="subtask._employee" />
@@ -2,7 +2,7 @@
<v-dialog v-model="visible" max-width="750" persistent> <v-dialog v-model="visible" max-width="750" persistent>
<v-card> <v-card>
<div class="d-flex justify-space-between align-center"> <div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete {{ subtask.is_finished ? 'znovu otvoriť' : 'dokončiť' }} task, z mastertasku <b>{{ subtask?.master_task?.name || subtask.master_task }}</b>?</h1> <h1>Ste si istý, že chcete {{ subtask.is_finished ? 'znovu otvoriť' : 'dokončiť' }} sub task, z mastertasku <b>{{ subtask?.master_task?.name || subtask.master_task }}</b>?</h1>
<v-icon <v-icon
@click.stop="closeModal()" @click.stop="closeModal()"
icon="mdi-close" icon="mdi-close"
@@ -2,7 +2,7 @@
<v-dialog v-model="visible" max-width="750" persistent> <v-dialog v-model="visible" max-width="750" persistent>
<v-card> <v-card>
<div class="d-flex justify-space-between align-center"> <div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete zmazať task z mastertasku <b>{{ subtask.project_code }}</b>?</h1> <h1>Ste si istý, že chcete zmazať sub task z mastertasku <b>{{ subtask.project_code }}</b>?</h1>
<v-icon <v-icon
@click.stop="closeModal()" @click.stop="closeModal()"
+89 -78
View File
@@ -3,24 +3,22 @@
<W-loadable :content="subtask" class="h-100"> <W-loadable :content="subtask" class="h-100">
<v-card v-if="editMode" height="100%" class="d-flex flex-column scrolling"> <v-card v-if="editMode" height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header"> <div class="d-flex justify-space-between align-center modal-header">
<h1>{{ subtask?.id ? 'Upraviť task' : 'Vytvoriť task' }}</h1> <h1>{{ subtask?.id ? 'Upraviť sub task' : 'Vytvoriť sub task' }}</h1>
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large"></v-icon> <v-icon @click.stop="closeModal()" icon="mdi-close" size="large"></v-icon>
</div> </div>
<v-card-actions class="d-flex flex-column modal-content"> <v-card-actions class="d-flex flex-column modal-content">
<v-text-field v-model="subtask.project_code" label="Kód projektu" :value="subtask.project_code" @focus="onInputFocus" class="modal-input" variant="solo" disabled></v-text-field> <v-text-field v-model="subtask.project_code" label="Kód projektu" :value="subtask.project_code" @focus="onInputFocus" class="modal-input" variant="solo" disabled></v-text-field>
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="subtask.master_task_id" label="Master task" :class="{error: v$.subtask.master_task_id.$errors.length}" :items="mastertasks" item-title="name" item-value="id" variant="solo" class="modal-input" clearable /> <v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="subtask.master_task_id" label="Master task" :class="{ error: v$.subtask.master_task_id.$errors.length }" :items="mastertasks" item-title="name" item-value="id" variant="solo" class="modal-input" clearable />
<v-text-field v-model="subtask.title" @focus="onInputFocus" class="modal-input" label="Názov subtasku" variant="solo"></v-text-field> <v-text-field v-model="subtask.title" @focus="onInputFocus" class="modal-input" label="Názov subtasku" variant="solo"></v-text-field>
<div class="splitted-inputs"> <div class="splitted-inputs">
<!-- TODO: Bialko validacie --> <!-- TODO: Bialko validacie -->
<Datepicker v-model="subtask.deadline" :auto-apply="true" @focus="onDateFocus" :min-date="new Date()" class="modal-input left" format="dd.MM.yyyy" locale="sk" select-text="Vybrať" cancel-text="Zrušiť" placeholder="Dátum" <Datepicker v-model="subtask.deadline" :auto-apply="true" @focus="onDateFocus" :min-date="new Date()" class="modal-input left" format="dd.MM.yyyy" locale="sk" select-text="Vybrať" cancel-text="Zrušiť" placeholder="Dátum" :class="{ error: v$.subtask.deadline.$errors?.length }" :validations="v$.subtask.deadline" />
:class="{ error: v$.subtask.deadline.$errors?.length }" :validations="v$.subtask.deadline" />
<v-text-field class="modal-input right" variant="solo" v-model="subtask._deadline_time" label="Čas" append-inner-icon="mdi-clock-outline" type="time" @focus="onInputFocus" <v-text-field class="modal-input right" variant="solo" v-model="subtask._deadline_time" label="Čas" append-inner-icon="mdi-clock-outline" type="time" @focus="onInputFocus" :class="{ error: v$.subtask._deadline_time.$errors.length }" :hint="v$.subtask._deadline_time.$errors ? errorUtils.parseErrors(v$.subtask._deadline_time.$errors) : null" />
:class="{ error: v$.subtask._deadline_time.$errors.length }" :hint="v$.subtask._deadline_time.$errors ? errorUtils.parseErrors(v$.subtask._deadline_time.$errors) : null" />
</div> </div>
<!-- TODO: Toto tu nema byt ci? --> <!-- TODO: Toto tu nema byt ci? -->
@@ -36,18 +34,24 @@
</div> --> </div> -->
<template v-if="subtask.id"> <template v-if="subtask.id">
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="subtask.employee_id" label="Priradený" :items="enrichedEmployees" item-title="_fullName" item-value="id" variant="solo" class="modal-input" :class="{ error: employeeValidations[0]?.employee }" <div class="employee-wrapper" :class="{'hide-arrow': subtask.employee_id}">
@update:model-value="employeeValidations[0] ? employeeValidations[0].employee = false : null" /> <svg v-if="subtask.employee_id" version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" class="dp__icon dp__clear_icon dp__input_icons" data-test="clear-icon"
<v-text-field v-model="subtask.duration" class="modal-input" variant="solo" type="number" label="Časový odhad" :class="{ error: employeeValidations[0]?.duration }" append-inner-icon="mdi-clock-outline" @focus="onInputFocus" @click.prevent="subtask.employee_id = null; subtask.employee = null">
@update:model-value="employeeValidations[0] ? employeeValidations[0].duration = false : null" /> <path d="M23.057 7.057l-16 16c-0.52 0.52-0.52 1.365 0 1.885s1.365 0.52 1.885 0l16-16c0.52-0.52 0.52-1.365 0-1.885s-1.365-0.52-1.885 0z"></path>
<path d="M7.057 8.943l16 16c0.52 0.52 1.365 0.52 1.885 0s0.52-1.365 0-1.885l-16-16c-0.52-0.52-1.365-0.52-1.885 0s-0.52 1.365 0 1.885z"></path>
</svg>
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="subtask.employee_id" label="Priradený" :items="enrichedEmployees" item-title="_fullName" item-value="id" variant="solo" class="modal-input" :class="{ error: employeeValidations[0]?.employee }" @update:model-value="employeeValidations[0] ? (employeeValidations[0].employee = false) : null" />
</div>
<v-text-field v-model="subtask.duration" class="modal-input" variant="solo" type="number" label="Časový odhad" :class="{ error: employeeValidations[0]?.duration }" append-inner-icon="mdi-clock-outline" @focus="onInputFocus" @update:model-value="employeeValidations[0] ? (employeeValidations[0].duration = false) : null" />
</template> </template>
<template v-else> <template v-else>
<!-- R: Subtask nemoze mat viacero employees ci? Vyhodit -->
<div v-for="(employee, index) in subtask.employees" :key="`employee-${index}`" class="splitted-inputs"> <div v-for="(employee, index) in subtask.employees" :key="`employee-${index}`" class="splitted-inputs">
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="employee.id" label="Priradený" :items="enrichedEmployees" item-title="_fullName" item-value="id" variant="solo" class="modal-input left" :class="{ error: employeeValidations[index]?.employee }" <v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="employee.id" label="Priradený" :items="enrichedEmployees" item-title="_fullName" item-value="id" variant="solo" class="modal-input left" :class="{ error: employeeValidations[index]?.employee }" @update:model-value="employeeValidations[index] ? (employeeValidations[index].employee = false) : null" />
@update:model-value="employeeValidations[index] ? employeeValidations[index].employee = false : null" /> <v-text-field v-model="employee.duration" class="modal-input right" variant="solo" type="number" label="Časový odhad" append-inner-icon="mdi-clock-outline" :class="{ error: employeeValidations[index]?.duration }" @focus="onInputFocus" @update:model-value="employeeValidations[index] ? (employeeValidations[index].duration = false) : null" />
<v-text-field v-model="employee.duration" class="modal-input right" variant="solo" type="number" label="Časový odhad" append-inner-icon="mdi-clock-outline" :class="{ error: employeeValidations[index]?.duration }" @focus="onInputFocus"
@update:model-value="employeeValidations[index] ? employeeValidations[index].duration = false : null" />
</div> </div>
</template> </template>
@@ -58,8 +62,8 @@
<Z-files-upload class="mt-15 files" :files="subtask.files" @files-uploaded="filesUploaded" :is-saving="isSaving" /> <Z-files-upload class="mt-15 files" :files="subtask.files" @files-uploaded="filesUploaded" :is-saving="isSaving" />
</v-card-actions> </v-card-actions>
<v-btn class="button primary" v-if="!isSaving" @click="save()">{{ subtask.id ? "UPRAVIŤ" : "VYTVORIŤ" }}</v-btn> <v-btn class="button primary" v-if="!isSaving" @click="save()">{{ subtask.id ? 'UPRAVIŤ' : 'VYTVORIŤ' }}</v-btn>
<v-btn class="button primary disabled" v-else disabled>{{ $t('Ukladám...')}}</v-btn> <v-btn class="button primary disabled" v-else disabled>{{ $t('Ukladám...') }}</v-btn>
</v-card> </v-card>
<v-card v-else height="100%" class="d-flex flex-column scrolling"> <v-card v-else height="100%" class="d-flex flex-column scrolling">
@@ -104,26 +108,26 @@
<script> <script>
import Datepicker from '@vuepic/vue-datepicker' import Datepicker from '@vuepic/vue-datepicker'
import ZFilesUpload from "@/plugins/tm@_components/z-files-upload.vue" import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue'
import ATaskTimeblocks from '@/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue' import ATaskTimeblocks from '@/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue'
import useVuelidate from "@vuelidate/core" import useVuelidate from '@vuelidate/core'
import { required } from "@vuelidate/validators" import { required } from '@vuelidate/validators'
import errorUtils from "@/plugins/lib@auth/_utils/error.utils" import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
import { QuillEditor } from "@vueup/vue-quill" import { QuillEditor } from '@vueup/vue-quill'
import VuetifyFixFocusMixin from "@/plugins/tm@modal/_mixins/vuetify-fix-focus" import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus'
import SelectsMixin from "../master-task/_mixins/selects.mixin" import SelectsMixin from '../master-task/_mixins/selects.mixin'
import * as FileSaver from "file-saver" import * as FileSaver from 'file-saver'
import tmUtils from "@/plugins/tm@_utils/tm.utils" import tmUtils from '@/plugins/tm@_utils/tm.utils'
import moment from 'moment' import moment from 'moment'
import "@vueup/vue-quill/dist/vue-quill.snow.css" import '@vueup/vue-quill/dist/vue-quill.snow.css'
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin' import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
import ZTaskReadonlyInfo from "./_components/z-task-readonly-info.vue" import ZTaskReadonlyInfo from './_components/z-task-readonly-info.vue'
import { mapGetters } from "vuex" import { mapGetters } from 'vuex'
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin' import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
export default { export default {
emits: ["close", "refresh"], emits: ['close', 'refresh'],
mixins: [VuetifyFixFocusMixin, SelectsMixin, AutocompleteMixin, modalMixin], mixins: [VuetifyFixFocusMixin, SelectsMixin, AutocompleteMixin, modalMixin],
components: { components: {
@@ -151,10 +155,7 @@ export default {
}, },
computed: { computed: {
...mapGetters('tm', [ ...mapGetters('tm', ['mastertasks', 'enrichedEmployees'])
'mastertasks',
'enrichedEmployees'
])
}, },
validations() { validations() {
@@ -169,19 +170,24 @@ export default {
}, },
mounted() { mounted() {
this.$events.on("add-timeblock", (timeblock) => { this.$events.on('add-timeblock', (timeblock) => {
if (!this.subtask?.timeblocks) { this.subtask.timeblocks = [] } if (!this.subtask?.timeblocks) {
if (!this.subtask?.timesheets) { this.subtask.timesheets = [] } this.subtask.timeblocks = []
if (!this.subtask?.is_finished) { this.subtask.is_finished = 0 } }
if (!this.subtask?.timesheets) {
this.subtask.timesheets = []
}
if (!this.subtask?.is_finished) {
this.subtask.is_finished = 0
}
this.subtask.timeblocks.push(timeblock) this.subtask.timeblocks.push(timeblock)
}) })
this.$events.on("on-subtask-edited", (subtask) => { this.$events.on('on-subtask-edited', (subtask) => {
if (subtask?.id == this.subtask?.id) if (subtask?.id == this.subtask?.id) this.subtask = this._enrichTask(subtask)
this.subtask = this._enrichTask(subtask)
// TODO: Remove? riesil som neodstranovanie jedineho zanamu v trvani a odpracovanom case // TODO: Remove? riesil som neodstranovanie jedineho zanamu v trvani a odpracovanom case
this.$forceUpdate() this.$forceUpdate()
}) })
this.$events.on('on-subtask-deleted', (subtask) => { this.$events.on('on-subtask-deleted', (subtask) => {
@@ -190,18 +196,17 @@ export default {
}, },
methods: { methods: {
async showModal({subtask, editMode = false, mastertask = {}}) { async showModal({ subtask, editMode = false, mastertask = {} }) {
this.isSaving = false this.isSaving = false
this.subtask = null this.subtask = null
this.visible = true this.visible = true
this.$nextTick(() => this.v$.$reset()) this.$nextTick(() => this.v$.$reset())
try { try {
if (subtask?.id) { if (subtask?.id) {
const data = await this.$axios.get_auth_data(`v1/subtasks/${subtask.id}`) const data = await this.$axios.get_auth_data(`v1/subtasks/${subtask.id}`)
if (!data.deadline) if (!data.deadline) return (this.subtask = this._enrichTask(data))
return this.subtask = this._enrichTask(data)
const splittedDeadline = data.deadline.split(' ') const splittedDeadline = data.deadline.split(' ')
data.deadline = moment(splittedDeadline[0]) data.deadline = moment(splittedDeadline[0])
@@ -229,7 +234,7 @@ export default {
closeModal() { closeModal() {
this.visible = false this.visible = false
this.$router.replace({name: this.$route.name}) this.$router.replace({ name: this.$route.name })
}, },
async save() { async save() {
@@ -251,19 +256,19 @@ export default {
return timesheet return timesheet
}) })
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${this.subtask.id}`, {...this.subtask, timesheets}) const { subtask } = await this.$axios.put_auth(`v1/subtasks/${this.subtask.id}`, { ...this.subtask, timesheets })
this.$store.commit('tm/update_subtask', subtask) this.$store.commit('tm/update_subtask', subtask)
this.$events.emit("on-subtask-edited", this.subtask) this.$events.emit('on-subtask-edited', this.subtask)
} else { } else {
const { subtasks } = await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`, this.subtask) const { subtasks } = await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`, this.subtask)
this.subtask.id = subtasks[0].id this.subtask.id = subtasks[0].id
subtasks.forEach(subtask => { subtasks.forEach((subtask) => {
this.$store.commit('tm/update_subtask', subtask) this.$store.commit('tm/update_subtask', subtask)
this.$events.emit("on-subtask-edited", this.subtask) this.$events.emit('on-subtask-edited', this.subtask)
}) })
this.$events.emit("task-created") this.$events.emit('task-created')
} }
this.closeModal() this.closeModal()
@@ -275,12 +280,12 @@ export default {
}, },
openDeleteTaskModal(subtask) { openDeleteTaskModal(subtask) {
this.$events.emit("show-delete-task-modal", { subtask }) this.$events.emit('show-delete-task-modal', { subtask })
}, },
showCompleteTaskModal() { showCompleteTaskModal() {
this.$events.emit('show-complete-task-modal', { subtask: this.subtask }) this.$events.emit('show-complete-task-modal', { subtask: this.subtask })
if(this.subtask.deadline) this.subtask.deadline = tmUtils.formatDateTimeForBackend(this.subtask.deadline) if (this.subtask.deadline) this.subtask.deadline = tmUtils.formatDateTimeForBackend(this.subtask.deadline)
}, },
filesUploaded(files) { filesUploaded(files) {
@@ -307,36 +312,28 @@ export default {
this.employeeValidations = [] this.employeeValidations = []
if (this.subtask.id) { if (this.subtask.id) {
if (this.subtask.employee && this.subtask.duration) if (this.subtask.employee && this.subtask.duration) return
return
this.employeeValidations[0] = {} this.employeeValidations[0] = {}
if (!this.subtask.employee_id) if (!this.subtask.employee_id) this.employeeValidations[0].employee = true
this.employeeValidations[0].employee = true
if (!this.subtask.duration) if (!this.subtask.duration) this.employeeValidations[0].duration = true
this.employeeValidations[0].duration = true
} else { } else {
this.subtask.employees.forEach((employee, index) => { this.subtask.employees.forEach((employee, index) => {
if (index == this.subtask.employees.length - 1 && index > 0) if (index == this.subtask.employees.length - 1 && index > 0) return // Skip the last which is allways empty
return // Skip the last which is allways empty
if (employee.id && employee.duration) if (employee.id && employee.duration) return
return
this.employeeValidations[index] = {} this.employeeValidations[index] = {}
if (!employee.id) if (!employee.id) this.employeeValidations[index].employee = true
this.employeeValidations[index].employee = true
if (!employee.duration) if (!employee.duration) this.employeeValidations[index].duration = true
this.employeeValidations[index].duration = true
}) })
} }
const isError = this.employeeValidations.some((employee) => employee.duration || employee.employee)
const isError = this.employeeValidations.some(employee => employee.duration || employee.employee)
resolve(!isError) resolve(!isError)
}) })
}, },
@@ -356,17 +353,15 @@ export default {
if (!value || !oldValue) return if (!value || !oldValue) return
this.subtask.timeblocks = [] this.subtask.timeblocks = []
this.subtask._employee = this.enrichedEmployees.find((employee) => employee.id == this.subtask.employee_id) this.subtask._employee = this.enrichedEmployees.find((employee) => employee.id == this.subtask.employee_id)
}, },
'subtask.employees': { 'subtask.employees': {
handler() { handler() {
if (!this.subtask?.employees) if (!this.subtask?.employees) return
return
const lastEmployee = this.subtask.employees[this.subtask.employees.length - 1] const lastEmployee = this.subtask.employees[this.subtask.employees.length - 1]
if (lastEmployee.id || lastEmployee.duration) if (lastEmployee.id || lastEmployee.duration) this.subtask.employees.push({})
this.subtask.employees.push({})
}, },
deep: true deep: true
}, },
@@ -379,7 +374,7 @@ export default {
editMode() { editMode() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["description"]?.setHTML(this.subtask.description || "") this.$refs['description']?.setHTML(this.subtask.description || '')
}) })
} }
} }
@@ -413,6 +408,22 @@ export default {
height: 50px height: 50px
width: 203px width: 203px
.employee-wrapper
position: relative
width: 100%
svg
position: absolute
right: 4px
top: 28px
z-index: 5
opacity: 0.5
&.hide-arrow ::v-deep
.mdi-menu-down,
.mdi-menu-up
display: none
@media screen and (max-width: 522px) @media screen and (max-width: 522px)
.files .files
margin-top: 104px !important margin-top: 104px !important
@@ -113,10 +113,14 @@ export default {
try { try {
if (this.team.id) { if (this.team.id) {
const { team } = await this.$axios.put_auth(`v1/teams/${this.team.id}`, this.team) const { team } = await this.$axios.put_auth(`v1/teams/${this.team.id}`, this.team)
this.$store.commit('tm/update_team', team)
const fullTeamResource = await this.$axios.get_auth_data(`v1/teams/${team.id}`)
this.$store.commit('tm/update_team', fullTeamResource)
} else { } else {
const { team } = await this.$axios.post_auth(`v1/teams`, this.team) const { team } = await this.$axios.post_auth(`v1/teams`, this.team)
this.$store.commit('tm/save_team', team)
const fullTeamResource = await this.$axios.get_auth_data(`v1/teams/${team.id}`)
this.$store.commit('tm/save_team', fullTeamResource)
} }
this.closeModal() this.closeModal()