mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
Merge branch 'main' of bitbucket.org:studiotem/jandl-taskmanager-app
This commit is contained in:
commit
c67b151c47
29 files changed
+508
-350
No files matched your search
@@ -55,24 +55,24 @@ export default {
|
|||||||
this.$refs['z-delete-task-modal'].showModal(task)
|
this.$refs['z-delete-task-modal'].showModal(task)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('show-delete-master-task-modal', ({masterTask}) => {
|
this.$events.on('show-delete-master-task-modal', ({mastertask}) => {
|
||||||
this.$refs['z-delete-master-task-modal'].showModal(masterTask)
|
this.$refs['z-delete-master-task-modal'].showModal(mastertask)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('show-task-modal', ({task, editMode, masterTask}) => {
|
this.$events.on('show-task-modal', ({task, editMode, mastertask}) => {
|
||||||
if(task && task.id) {
|
if(task && task.id) {
|
||||||
const id = task.id
|
const id = task.id
|
||||||
this.$router.push({ query: { 'task': id }})
|
this.$router.push({ query: { 'task': id }})
|
||||||
}
|
}
|
||||||
this.$refs['z-task-modal'].showModal(task, editMode, masterTask)
|
this.$refs['z-task-modal'].showModal(task, editMode, mastertask)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('show-master-task-modal', ({ masterTask, editMode }) => {
|
this.$events.on('show-master-task-modal', ({ mastertask, editMode }) => {
|
||||||
if (masterTask && masterTask.id) {
|
if (mastertask && mastertask.id) {
|
||||||
const id = masterTask.id
|
const id = mastertask.id
|
||||||
this.$router.push({ query: { 'master-task': id } })
|
this.$router.push({ query: { 'master-task': id } })
|
||||||
}
|
}
|
||||||
this.$refs['z-master-task-modal'].showModal(masterTask, editMode)
|
this.$refs['z-master-task-modal'].showModal(mastertask, editMode)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('show-complete-task-modal', ({ subtask }) => {
|
this.$events.on('show-complete-task-modal', ({ subtask }) => {
|
||||||
@@ -90,6 +90,14 @@ export default {
|
|||||||
this.$events.on('on-subtask-edited', () => {
|
this.$events.on('on-subtask-edited', () => {
|
||||||
this.$store.dispatch('tm/reloadSubtasks')
|
this.$store.dispatch('tm/reloadSubtasks')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.$events.on('on-mastertask-edited', () => {
|
||||||
|
this.$store.dispatch('tm/reloadMastertasks')
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$events.on('on-mastertask-deleted', () => {
|
||||||
|
this.$store.dispatch('tm/reloadMastertasks')
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -105,19 +113,19 @@ export default {
|
|||||||
this.$events.emit('on-subtask-edited', task)
|
this.$events.emit('on-subtask-edited', task)
|
||||||
},
|
},
|
||||||
|
|
||||||
onMasterTaskDeleted(masterTask){
|
onMasterTaskDeleted(mastertask){
|
||||||
this.$events.emit('on-master-task-deleted', masterTask)
|
this.$events.emit('on-master-task-deleted', mastertask)
|
||||||
},
|
},
|
||||||
|
|
||||||
onMasterTaskEdited(masterTask){
|
onMasterTaskEdited(mastertask){
|
||||||
this.$events.emit('on-master-task-edited', masterTask)
|
this.$events.emit('on-mastertask-edited', mastertask)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
'$route'() {
|
'$route'() {
|
||||||
if (this.$route.query['master-task']) {
|
if (this.$route.query['master-task']) {
|
||||||
this.$events.emit('show-master-task-modal', { masterTask: { id: this.$route.query['master-task'] }, editMode: false })
|
this.$events.emit('show-master-task-modal', { mastertask: { id: this.$route.query['master-task'] }, editMode: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ export default class DateUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getWeek (date) {
|
getWeek (date) {
|
||||||
|
console.log(date)
|
||||||
|
console.log('kokot')
|
||||||
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
||||||
const dayNum = d.getUTCDay() || 7
|
const dayNum = d.getUTCDay() || 7
|
||||||
d.setUTCDate(d.getUTCDate() + 4 - dayNum)
|
d.setUTCDate(d.getUTCDate() + 4 - dayNum)
|
||||||
|
|||||||
@@ -108,10 +108,16 @@ export default {
|
|||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
|
reloadMastertasks({dispatch}: {dispatch: any}) {
|
||||||
|
return Promise.all([
|
||||||
|
dispatch('loadMastertasks')
|
||||||
|
])
|
||||||
|
},
|
||||||
|
|
||||||
loadMastertasks({commit}: {commit: any}) {
|
loadMastertasks({commit}: {commit: any}) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.get_auth_data('v1/mastertasks')
|
axios.get_auth('v1/mastertasks')
|
||||||
.then(mastertasks => {
|
.then(({ mastertasks }) => {
|
||||||
commit('set_mastertasks', mastertasks)
|
commit('set_mastertasks', mastertasks)
|
||||||
resolve(mastertasks)
|
resolve(mastertasks)
|
||||||
})
|
})
|
||||||
@@ -208,7 +214,11 @@ export default {
|
|||||||
enrichedEmployees: (state: any) => {
|
enrichedEmployees: (state: any) => {
|
||||||
if (!state.employees) return []
|
if (!state.employees) return []
|
||||||
|
|
||||||
return state.employees.map(employee => ({...employee, _fullName: `${ employee.name } ${ employee.surname }`}))
|
return state.employees.map(employee => ({
|
||||||
|
...employee,
|
||||||
|
_fullName: `${ employee.name } ${ employee.surname }`,
|
||||||
|
_initials: employee.name.charAt(0) + employee.surname.charAt(0)
|
||||||
|
})).sort((a, b) => a.name < b.name ? -1 : 1)
|
||||||
},
|
},
|
||||||
|
|
||||||
teams: (state: any) => {
|
teams: (state: any) => {
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
enrichEmployeesByFullName(employees) {
|
enrichEmployees(employees) {
|
||||||
return employees.map(employee => ({...employee, _fullName: `${ employee.name } ${ employee.surname }`}))
|
return employees.map(employee => ({
|
||||||
|
...employee,
|
||||||
|
_fullName: `${ employee.name } ${ employee.surname }`,
|
||||||
|
_initials: employee.name.charAt(0) + employee.surname.charAt(0)
|
||||||
|
}))
|
||||||
},
|
},
|
||||||
|
|
||||||
formatDateTime(date) {
|
formatDateTime(date) {
|
||||||
|
|||||||
@@ -44,9 +44,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
const currentYear = new Date().getFullYear()
|
const currentYear = new Date().getFullYear()
|
||||||
|
const monthIndex = typeof this.month == 'string' ? parseInt(this.month) - 1 : this.month - 1
|
||||||
this.calendarOptions.events = this.events
|
this.calendarOptions.events = this.events
|
||||||
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, this.month, 1))
|
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, monthIndex, 1))
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row class="px-10 py-8 subheader">
|
<v-row class="px-10 py-8 subheader">
|
||||||
<v-select v-model="filter.selectedProject" class="subheader-input" :items="[null, ...projects]" item-title="name" item-value="id" label="Projekt" variant="outlined" />
|
<v-select v-model="filter.projectId" class="subheader-input" :items="[null, ...projects]" item-title="name" item-value="id" label="Projekt" variant="outlined" />
|
||||||
|
|
||||||
<v-select v-model="filter.selectedTeam" class="subheader-input" :items="[null, ...teams]" label="Tím" variant="outlined" item-title="name" item-value="id" />
|
<v-select v-model="filter.teamId" class="subheader-input" :items="[null, ...teams]" label="Tím" variant="outlined" item-title="name" item-value="id" />
|
||||||
|
|
||||||
<v-select v-model="filter.selectedEmployee" class="subheader-input" :items="[null, ...enrichedEmployees]" label="Zamestnanec" variant="outlined" item-title="_fullName" item-value="id" />
|
<v-select v-model="filter.employeeId" class="subheader-input" :items="[null, ...enrichedEmployees]" label="Zamestnanec" variant="outlined" item-title="_fullName" item-value="id" />
|
||||||
|
|
||||||
<v-select v-model="filter.selectedAssignedBy" class="subheader-input" :items="[null, ...enrichedEmployees]" label="Vytvoril" variant="outlined" item-title="_fullName" item-value="id" />
|
<v-select v-model="filter.createdById" class="subheader-input" :items="[null, ...enrichedEmployees]" label="Vytvoril" variant="outlined" item-title="_fullName" item-value="id" />
|
||||||
|
|
||||||
<v-select v-model="filter.selectedMonth" class="subheader-input" :items="months" label="Mesiac" variant="outlined" />
|
<v-select v-model="filter.month" class="subheader-input" :items="months" label="Mesiac" variant="outlined" />
|
||||||
|
|
||||||
<div class="subheader-input switch">
|
<div class="subheader-input switch">
|
||||||
<p class="switch-label">Zobraziť ukončené</p>
|
<p class="switch-label">Zobraziť ukončené</p>
|
||||||
<v-switch v-model="filter.showFinishedTasks" color="#6200EE" hide-details></v-switch>
|
<v-switch v-model="filter.isFinished" color="#6200EE" hide-details></v-switch>
|
||||||
</div>
|
</div>
|
||||||
</v-row>
|
</v-row>
|
||||||
</template>
|
</template>
|
||||||
@@ -26,31 +26,36 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
months: [
|
months: [
|
||||||
{ title: 'Január', value: 0 },
|
{ title: 'Január', value: '01' },
|
||||||
{ title: 'Február', value: 1 },
|
{ title: 'Február', value: '02' },
|
||||||
{ title: 'Marec', value: 2 },
|
{ title: 'Marec', value: '03' },
|
||||||
{ title: 'Apríl', value: 3 },
|
{ title: 'Apríl', value: '04' },
|
||||||
{ title: 'Máj', value: 4 },
|
{ title: 'Máj', value: '05' },
|
||||||
{ title: 'Jún', value: 5 },
|
{ title: 'Jún', value: '06' },
|
||||||
{ title: 'Júl', value: 6 },
|
{ title: 'Júl', value: '07' },
|
||||||
{ title: 'August', value: 7 },
|
{ title: 'August', value: '08' },
|
||||||
{ title: 'September', value: 8 },
|
{ title: 'September', value: '09' },
|
||||||
{ title: 'Október', value: 9 },
|
{ title: 'Október', value: '10' },
|
||||||
{ title: 'November', value: 10 },
|
{ title: 'November', value: '11' },
|
||||||
{ title: 'December', value: 11 }
|
{ title: 'December', value: '12' }
|
||||||
],
|
],
|
||||||
|
|
||||||
filter: {
|
filter: {
|
||||||
selectedProject: null,
|
projectId: null,
|
||||||
selectedTeam: null,
|
teamId: null,
|
||||||
selectedEmployee: null,
|
employeeId: null,
|
||||||
selectedAssignedBy: null,
|
createdById: null,
|
||||||
selectedMonth: new Date().getMonth(),
|
month: null,
|
||||||
showFinishedTasks: false
|
isFinished: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
const monthIndex = new Date().getMonth()
|
||||||
|
this.filter.month = monthIndex < 9 ? `0${monthIndex + 1}` : `${monthIndex + 1}`
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('tm', [
|
...mapGetters('tm', [
|
||||||
'teams',
|
'teams',
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<W-loadable :content="filteredEvents" empty-message="Nepodarilo sa nacitat data!">
|
<div>
|
||||||
<A-project-filter @filterChanged="onFilterChanged" />
|
<A-project-filter v-if="$store.getters['tm/isInitialized']" @filterChanged="onFilterChanged" />
|
||||||
<A-project-calendar :events="filteredEvents" :month="filter.selectedMonth" @open-detail="openMasterTaskModal" />
|
|
||||||
</W-loadable>
|
<W-loadable :content="filteredProjects" emptyMessage="Nenašli sa žiadne vyhovujúce projekty">
|
||||||
|
<A-project-calendar :events="filteredProjects" :month="filter.month" @open-detail="openMasterTaskModal" />
|
||||||
|
</W-loadable>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
|
||||||
import AProjectCalendar from './_components/a-project-calendar.vue'
|
import AProjectCalendar from './_components/a-project-calendar.vue'
|
||||||
import AProjectFilter from './_components/a-project-filter.vue'
|
import AProjectFilter from './_components/a-project-filter.vue'
|
||||||
|
|
||||||
@@ -15,51 +17,20 @@ export default {
|
|||||||
AProjectCalendar,
|
AProjectCalendar,
|
||||||
AProjectFilter
|
AProjectFilter
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedProject: null,
|
mastertasks: null,
|
||||||
filter: {
|
filter: null
|
||||||
selectedMonth: new Date().getMonth()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('tm', [
|
filteredProjects() {
|
||||||
'mastertasks'
|
|
||||||
]),
|
|
||||||
|
|
||||||
filteredEvents() {
|
|
||||||
if (!this.mastertasks)
|
if (!this.mastertasks)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
if (this.mastertasks.error)
|
return this.mastertasks.map(event => {
|
||||||
return this.mastertasks
|
|
||||||
|
|
||||||
if (!this.mastertasks.length)
|
|
||||||
return []
|
|
||||||
|
|
||||||
// duplicate all tasks
|
|
||||||
let events = this.mastertasks
|
|
||||||
|
|
||||||
// show/hide finished tasks
|
|
||||||
if (!this.filter.showFinishedTasks)
|
|
||||||
events = events.filter(event => !event.is_finished)
|
|
||||||
|
|
||||||
// filter by project_id
|
|
||||||
if(this.filter.selectedProject)
|
|
||||||
events = events.filter(event => event.project_id == this.filter.selectedProject)
|
|
||||||
|
|
||||||
// filter by team_id
|
|
||||||
if (this.filter.selectedTeam)
|
|
||||||
events = events.filter(event => event.team_id == this.filter.selectedTeam)
|
|
||||||
|
|
||||||
// filter by employee_id
|
|
||||||
if (this.filter.selectedEmployee)
|
|
||||||
events = events.filter(event => event.employees.find(employee => employee.id == this.filter.selectedEmployee))
|
|
||||||
|
|
||||||
// format masterTasks to event format for calendar
|
|
||||||
events = events.map(event => {
|
|
||||||
return {
|
return {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
title: `${event.project_code} - ${event.name}`,
|
title: `${event.project_code} - ${event.name}`,
|
||||||
@@ -72,30 +43,35 @@ export default {
|
|||||||
borderColor: event.color
|
borderColor: event.color
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return events
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
|
||||||
// this.$events.on('on-master-task-deleted', (masterTask) => {
|
|
||||||
// this.mastertasks = this.mastertasks.filter(mt => mt.id != masterTask.id)
|
|
||||||
// })
|
|
||||||
|
|
||||||
// this.$events.on('on-master-task-edited', (masterTask) => {
|
|
||||||
// this.mastertasks = this.mastertasks.map(mTask => mTask.id == masterTask.id ? masterTask : mTask)
|
|
||||||
// this._getData()
|
|
||||||
// })
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onFilterChanged(filterValues) {
|
async onFilterChanged(filter) {
|
||||||
this.filter = filterValues
|
this.mastertasks = null
|
||||||
|
this.filter = filter
|
||||||
|
const urlQueryObject = {}
|
||||||
|
|
||||||
|
if (filter.employeeId) urlQueryObject.employee_id = filter.employeeId
|
||||||
|
if (filter.projectId) urlQueryObject.project_id = filter.projectId
|
||||||
|
if (filter.teamId) urlQueryObject.team_id = filter.teamId
|
||||||
|
if (filter.createdById) urlQueryObject.created_by = filter.createdById
|
||||||
|
if (filter.isFinished) urlQueryObject.is_finished = filter.isFinished ? 1 : 0
|
||||||
|
if (filter.month) urlQueryObject.created_at = filter.month
|
||||||
|
|
||||||
|
const queryParameters = new URLSearchParams(urlQueryObject).toString()
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { mastertasks } = await this.$axios.get_auth(`v1/mastertasks?${queryParameters}`)
|
||||||
|
this.mastertasks = mastertasks
|
||||||
|
} catch (error) {
|
||||||
|
this.$toast.error('Nepodarilo sa nacitat data!')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openMasterTaskModal(masterTaskId) {
|
openMasterTaskModal(mastertaskId) {
|
||||||
const masterTask = this.mastertasks.find(masterTask => masterTask.id == masterTaskId)
|
const mastertask = this.mastertasks.find(mastertask => mastertask.id == mastertaskId)
|
||||||
this.$events.emit('show-master-task-modal', {masterTask, editMode: false})
|
this.$events.emit('show-master-task-modal', {mastertask, editMode: false})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,8 @@
|
|||||||
import ATaskFilter from './_components/a-tasks-filter.vue'
|
import ATaskFilter from './_components/a-tasks-filter.vue'
|
||||||
import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.vue'
|
import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.vue'
|
||||||
import { addDays, subDays } from 'date-fns'
|
import { addDays, subDays } from 'date-fns'
|
||||||
import { mapGetters } from 'vuex'
|
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import timelineUtils from './_utils/timeline.utils'
|
import timelineUtils from './_utils/timeline.utils'
|
||||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -81,21 +79,18 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.$events.on('on-subtask-edited', () => {
|
||||||
this.$events.on('on-subtask-edited', (subtask) => {
|
this.onFilterChanged(this.filter)
|
||||||
this.subtasks = this.subtasks.map(st => {
|
|
||||||
if (st.id == subtask.id)
|
|
||||||
return subtask
|
|
||||||
|
|
||||||
return st
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
unmounted() {
|
||||||
|
this.$events.off('on-subtask-edited')
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async onFilterChanged(filter) {
|
async onFilterChanged(filter) {
|
||||||
this.filter = filter
|
this.filter = filter
|
||||||
|
|
||||||
const urlQueryObject = {}
|
const urlQueryObject = {}
|
||||||
|
|
||||||
if (filter.start) urlQueryObject.start = moment(filter.start).format('YYYY-MM-DD')
|
if (filter.start) urlQueryObject.start = moment(filter.start).format('YYYY-MM-DD')
|
||||||
@@ -106,10 +101,11 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { subtasks } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`)
|
const { subtasks } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`)
|
||||||
this.config.scrollHour = this.filter.employee.work_start - 1
|
this.config.scrollHour = this.filter?.employee.work_start - 1
|
||||||
this.config.date = this.filter.start
|
this.config.date = this.filter.start
|
||||||
this.subtasks = subtasks
|
this.subtasks = subtasks
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
this.$toast.error('Nepodarilo sa nacitat data!')
|
this.$toast.error('Nepodarilo sa nacitat data!')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<v-row no-gutters class="align-center" v-if="employee">
|
||||||
|
<v-col cols="5">
|
||||||
|
<v-sheet class="py-3">
|
||||||
|
<div class="d-flex align-center">
|
||||||
|
<v-icon icon="mdi-account-star-outline" size="large"></v-icon>
|
||||||
|
<p class="mx-3">Vytvoril</p>
|
||||||
|
</div>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col cols="7">
|
||||||
|
<v-sheet class="py-3 d-flex align-center">
|
||||||
|
<p class="employee-selected-avatar d-flex justify-center align-center">
|
||||||
|
{{ employee._initials }}
|
||||||
|
</p>
|
||||||
|
<p class="ml-2">{{ employee._fullName }}</p>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
employee: {
|
||||||
|
type: [Object, Number],
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<v-row no-gutters class="align-center">
|
||||||
|
<v-col cols="5">
|
||||||
|
<v-sheet class="py-3">
|
||||||
|
<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="py-3">
|
||||||
|
<p :class="`${tmUtils.isAfter(deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDateTime(deadline) }}</p>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
deadline: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tmUtils
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<div class="px-5 py-5 border-bottom" v-if="description" >
|
||||||
|
<p>Popis zadania</p>
|
||||||
|
<section v-html="description" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="px-5 py-5 border-bottom" v-if="inheritedDescription">
|
||||||
|
<p>Popis mastertasku</p>
|
||||||
|
<section v-html="inheritedDescription" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
description: {
|
||||||
|
type: String || null,
|
||||||
|
default: () => null
|
||||||
|
},
|
||||||
|
|
||||||
|
inheritedDescription: {
|
||||||
|
type: String || null,
|
||||||
|
default: () => null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
File renamed without changes.
@@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<v-row no-gutters class="align-center">
|
||||||
|
<v-col cols="5">
|
||||||
|
<v-sheet class="py-3">
|
||||||
|
<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="py-3">
|
||||||
|
<p>{{ hours }} h</p>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
hours: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
<v-row no-gutters class="align-center border-bottom">
|
||||||
|
<v-col cols="5">
|
||||||
|
<v-sheet class="py-3">
|
||||||
|
<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="py-3">
|
||||||
|
<p>{{ hours }} h</p>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
hours: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<template>
|
||||||
|
<v-row no-gutters>
|
||||||
|
<v-col cols="5">
|
||||||
|
<v-sheet class="py-3">
|
||||||
|
<div class="d-flex align-center">
|
||||||
|
<v-icon icon="mdi-clock-time-three-outline" size="large"></v-icon>
|
||||||
|
<p class="mx-3">Odpracovaný čas</p>
|
||||||
|
</div>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col cols="7">
|
||||||
|
<v-sheet class="py-3">
|
||||||
|
<p :class="isExceeded ? 'text-red-darken-4' : 'text-black'">{{ hours }} h</p>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
hours: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
isExceeded: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
<v-row no-gutters class="align-center">
|
||||||
|
<v-col cols="5">
|
||||||
|
<v-sheet class="py-3">
|
||||||
|
<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="py-3">
|
||||||
|
<p v-if="status == 1" class="status-badge px-4 py-2 rounded-pill">Ukončený</p>
|
||||||
|
<p v-else-if="status == 0" class="status-badge px-4 py-2 rounded-pill">Neukončený</p>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
status: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<template>
|
||||||
|
<v-row no-gutters>
|
||||||
|
<v-col cols="5">
|
||||||
|
<v-sheet class="py-3">
|
||||||
|
<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="py-3 d-flex flex-wrap flex-column">
|
||||||
|
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ team?.name || 'Nepriradený' }}</p>
|
||||||
|
<div class="d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill" v-for="employee in enrichedEmployees" :key="employee.id">
|
||||||
|
<p class="employee-selected-avatar d-flex justify-center align-center">
|
||||||
|
{{ employee._initials }}
|
||||||
|
</p>
|
||||||
|
<p class="ml-2">{{ employee._fullName }}</p>
|
||||||
|
</div>
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
team: {
|
||||||
|
type: Object,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
|
||||||
|
employees: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
enrichedEmployees() {
|
||||||
|
return tmUtils.enrichEmployees(this.employees)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -139,11 +139,11 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const employees = await this.$axios.get_auth_data('v1/employees')
|
const employees = await this.$axios.get_auth_data('v1/employees')
|
||||||
this.employees = tmUtils.enrichEmployeesByFullName(employees)
|
this.employees = tmUtils.enrichEmployees(employees)
|
||||||
|
|
||||||
if (blocker?.id) {
|
if (blocker?.id) {
|
||||||
const b = await this.$axios.get_auth_data(`v1/blockers/${blocker.id}`)
|
const b = await this.$axios.get_auth_data(`v1/blockers/${blocker.id}`)
|
||||||
this.blocker = {...b, employees: tmUtils.enrichEmployeesByFullName(b.employees)}
|
this.blocker = {...b, employees: tmUtils.enrichEmployees(b.employees)}
|
||||||
} else {
|
} else {
|
||||||
this.blocker = {employees: []}
|
this.blocker = {employees: []}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,153 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row no-gutters class="align-center">
|
<Z-status :status="mastertask.is_finished" />
|
||||||
<v-col cols="5">
|
<Z-deadline :deadline="mastertask.deadline" />
|
||||||
<v-sheet class="py-3">
|
<Z-created-by :employee="mastertask.created_by" />
|
||||||
<div class="d-flex align-center">
|
<Z-team :team="mastertask.team" :employees="mastertask.employees" />
|
||||||
<v-icon icon="mdi-drag-vertical" size="large"></v-icon>
|
<Z-planned-time :hours="mastertask.duration" />
|
||||||
<p class="mx-3">Status</p>
|
<Z-remaining-time :hours="mastertask.duration - mastertask.time_worked" />
|
||||||
</div>
|
<Z-spent-time :hours="mastertask.time_worked" :is-exceeded="mastertask.time_worked > mastertask.duration" />
|
||||||
</v-sheet>
|
<Z-description :description="mastertask.description" />
|
||||||
</v-col>
|
<Z-files :files="mastertask.files" />
|
||||||
<v-col cols="7">
|
|
||||||
<v-sheet class="py-3">
|
|
||||||
<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="py-3">
|
|
||||||
<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="py-3">
|
|
||||||
<p :class="`${tmUtils.isAfter(masterTask.deadline) ? 'text-black' : 'text-red-darken-4'}`">{{ tmUtils.formatDateTime(masterTask.deadline) }}</p>
|
|
||||||
</v-sheet>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row no-gutters>
|
|
||||||
<v-col cols="5">
|
|
||||||
<v-sheet class="pa-2 pt-0">
|
|
||||||
<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="d-flex flex-wrap flex-column">
|
|
||||||
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ masterTask.team?.name }}</p>
|
|
||||||
<div class="d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill" 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="py-3">
|
|
||||||
<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="py-3">
|
|
||||||
<p>{{ masterTask?.duration?.toFixed(2) }} h</p>
|
|
||||||
</v-sheet>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row no-gutters class="align-center">
|
|
||||||
<v-col cols="5">
|
|
||||||
<v-sheet class="py-3">
|
|
||||||
<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="py-3">
|
|
||||||
<p :class="masterTask.time_worked > masterTask.duration ? 'text-red-darken-4' : 'text-black'">{{ masterTask.time_worked?.toFixed(2) }} h</p>
|
|
||||||
</v-sheet>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row no-gutters class="align-center border-bottom">
|
|
||||||
<v-col cols="5">
|
|
||||||
<v-sheet class="py-3">
|
|
||||||
<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="py-3">
|
|
||||||
<p :class="masterTask.time_worked > masterTask.duration ? 'text-red-darken-4' : 'text-black'">{{ (masterTask.duration - masterTask.time_worked)?.toFixed(2) }} h</p>
|
|
||||||
</v-sheet>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<div class="px-5 py-5 border-bottom">
|
|
||||||
<p>Popis zadania</p>
|
|
||||||
<section v-html="masterTask.description" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
|
||||||
|
|
||||||
<template v-if="masterTask.files?.length">
|
|
||||||
<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">
|
|
||||||
<p @click="downloadFile(index)" class="cursor-pointer">{{ file.name }}</p>
|
|
||||||
<v-icon class="mx-1" icon="mdi-paperclip"></v-icon>
|
|
||||||
</v-chip>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
import ZCreatedBy from '../../_components/read-only/z-created-by.vue'
|
||||||
import * as FileSaver from 'file-saver'
|
import ZDeadline from '../../_components/read-only/z-deadline.vue'
|
||||||
|
import ZDescription from '../../_components/read-only/z-description.vue'
|
||||||
|
import ZFiles from '../../_components/read-only/z-files.vue'
|
||||||
|
import ZPlannedTime from '../../_components/read-only/z-planned-time.vue'
|
||||||
|
import ZRemainingTime from '../../_components/read-only/z-remaining-time.vue'
|
||||||
|
import ZSpentTime from '../../_components/read-only/z-spent-time.vue'
|
||||||
|
import ZStatus from '../../_components/read-only/z-status.vue'
|
||||||
|
import ZTeam from '../../_components/read-only/z-team.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
ZCreatedBy,
|
||||||
|
ZDeadline,
|
||||||
|
ZDescription,
|
||||||
|
ZFiles,
|
||||||
|
ZPlannedTime,
|
||||||
|
ZRemainingTime,
|
||||||
|
ZSpentTime,
|
||||||
|
ZStatus,
|
||||||
|
ZTeam
|
||||||
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
masterTask: {
|
mastertask: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
tmUtils
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
async downloadFile(id) {
|
|
||||||
try {
|
|
||||||
const file = await this.$axios.get_auth_data(`v1/mastertasks/${this.masterTask.id}`, { responseType: 'arraybuffer' })
|
|
||||||
FileSaver.saveAs(file.files[id].path, file.files[id].name)
|
|
||||||
} catch(error) {
|
|
||||||
this.$toast.error(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="sass" scoped>
|
|
||||||
@media screen and (max-width: 522px)
|
|
||||||
.files
|
|
||||||
margin-top: 104px !important
|
|
||||||
</style>
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
employeesOptions() {
|
employeesOptions() {
|
||||||
const selectedEmployees = [...this.masterTask.employees].map(employee => employee.id)
|
const selectedEmployees = [...this.mastertask.employees].map(employee => employee.id)
|
||||||
|
|
||||||
const employees = this.employees.filter(
|
const employees = this.employees.filter(
|
||||||
(employee) => !selectedEmployees.includes(employee.id)
|
(employee) => !selectedEmployees.includes(employee.id)
|
||||||
@@ -19,26 +19,26 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
onProjectSelected({ key }) {
|
onProjectSelected({ key }) {
|
||||||
const project = this.projects.find(project => project.id == key)
|
const project = this.projects.find(project => project.id == key)
|
||||||
this.masterTask.project_code = project.code
|
this.mastertask.project_code = project.code
|
||||||
this.masterTask.project_id = project.id
|
this.mastertask.project_id = project.id
|
||||||
},
|
},
|
||||||
|
|
||||||
onMasterTaskSelected({ key }) {
|
onMasterTaskSelected({ key }) {
|
||||||
const mastertask = this.mastertasks.find(masterTask => masterTask.id == key)
|
const mastertask = this.mastertasks.find(mastertask => mastertask.id == key)
|
||||||
this.task.master_task = mastertask
|
this.task.master_task = mastertask
|
||||||
this.task.project_code = mastertask.project_code
|
this.task.project_code = mastertask.project_code
|
||||||
},
|
},
|
||||||
|
|
||||||
onEmployeeSelected({ key }) {
|
onEmployeeSelected({ key }) {
|
||||||
const employee = this.employees.find(employee => employee.id == key)
|
const employee = this.employees.find(employee => employee.id == key)
|
||||||
this.masterTask.employees.push(employee)
|
this.mastertask.employees.push(employee)
|
||||||
this.showAddEmployeeInput = false
|
this.showAddEmployeeInput = false
|
||||||
},
|
},
|
||||||
|
|
||||||
onEmployeeDurationChanged() {
|
onEmployeeDurationChanged() {
|
||||||
let totalDuration = 0
|
let totalDuration = 0
|
||||||
|
|
||||||
this.masterTask.employees = this.masterTask.employees.map(employee => {
|
this.mastertask.employees = this.mastertask.employees.map(employee => {
|
||||||
if (typeof employee.duration == 'string') {
|
if (typeof employee.duration == 'string') {
|
||||||
totalDuration += parseInt(employee.duration)
|
totalDuration += parseInt(employee.duration)
|
||||||
employee.duration = parseInt(employee.duration)
|
employee.duration = parseInt(employee.duration)
|
||||||
@@ -50,16 +50,16 @@ export default {
|
|||||||
return employee
|
return employee
|
||||||
})
|
})
|
||||||
|
|
||||||
this.masterTask.duration = totalDuration
|
this.mastertask.duration = totalDuration
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
'masterTask.team_id'(value, oldValue) {
|
'mastertask.team_id'(value, oldValue) {
|
||||||
if (!value || !oldValue) return
|
if (!value || !oldValue) return
|
||||||
|
|
||||||
this.masterTask.team = this.teams.find(team => team.id == value)
|
this.mastertask.team = this.teams.find(team => team.id == value)
|
||||||
this.masterTask.employees = this.masterTask.team.employees
|
this.mastertask.employees = this.mastertask.team.employees
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<v-dialog v-model="visible" max-width="750">
|
<v-dialog v-model="visible" max-width="750">
|
||||||
<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ť <b>{{ masterTask.name }}</b>?</h1>
|
<h1>Ste si istý, že chcete zmazať <b>{{ mastertask.name }}</b>?</h1>
|
||||||
|
|
||||||
<v-icon
|
<v-icon
|
||||||
@click.stop="closeModal()"
|
@click.stop="closeModal()"
|
||||||
@@ -26,13 +26,13 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
masterTask: null
|
mastertask: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async showModal(masterTask) {
|
async showModal(mastertask) {
|
||||||
this.masterTask = masterTask
|
this.mastertask = mastertask
|
||||||
this.visible = true
|
this.visible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -42,8 +42,8 @@ export default {
|
|||||||
|
|
||||||
async deleteMasterTask() {
|
async deleteMasterTask() {
|
||||||
try {
|
try {
|
||||||
await this.$axios.delete_auth(`v1/mastertasks/${this.masterTask.id}`)
|
await this.$axios.delete_auth(`v1/mastertasks/${this.mastertask.id}`)
|
||||||
this.$emit('on-master-task-deleted', this.masterTask)
|
this.$emit('on-master-task-deleted', this.mastertask)
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-dialog v-model="visible" max-width="750" max-height="90%" height="700px">
|
<v-dialog v-model="visible" max-width="750" max-height="90%" height="700px">
|
||||||
<W-loadable :content="masterTask" class="h-100">
|
<W-loadable :content="mastertask" 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>{{ masterTask?.id ? 'Upraviť master task' : 'Vytvoriť master task' }}</h1>
|
<h1>{{ mastertask?.id ? 'Upraviť master task' : 'Vytvoriť master 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">
|
||||||
<Z-autocomplete label="Kód projektu" :options="projects.map((project) => ({ key: project.id, value: project.code }))" :validations="v$.masterTask.project_code" :clear-on-submit="false" :value="masterTask.project_code" :class="{ error: v$.masterTask.project_code.$errors.length }" class="modal-input" @option-selected="onProjectSelected" />
|
<Z-autocomplete label="Kód projektu" :options="projects.map((project) => ({ key: project.id, value: project.code }))" :validations="v$.mastertask.project_code" :clear-on-submit="false" :value="mastertask.project_code" :class="{ error: v$.mastertask.project_code.$errors.length }" class="modal-input" @option-selected="onProjectSelected" />
|
||||||
|
|
||||||
<v-text-field v-model="masterTask.name" @focus="onInputFocus" class="modal-input" label="Názov mastertasku" variant="solo" :class="{ error: v$.masterTask.name.$errors.length }" :hint="v$.masterTask.name.$errors ? errorUtils.parseErrors(v$.masterTask.name.$errors) : null"></v-text-field>
|
<v-text-field v-model="mastertask.name" @focus="onInputFocus" class="modal-input" label="Názov mastertasku" variant="solo" :class="{ error: v$.mastertask.name.$errors.length }" :hint="v$.mastertask.name.$errors ? errorUtils.parseErrors(v$.mastertask.name.$errors) : null"></v-text-field>
|
||||||
|
|
||||||
<Datepicker v-model="masterTask.deadline" @focus="onDateFocus" class="modal-input" format="dd.MM.yyyy, HH:mm" locale="sk" :class="{ error: v$.masterTask.deadline.$errors.length }" select-text="Vybrať" cancel-text="Zrušiť" placeholder="Deadline" />
|
<Datepicker v-model="mastertask.deadline" @focus="onDateFocus" class="modal-input" format="dd.MM.yyyy, HH:mm" locale="sk" :class="{ error: v$.mastertask.deadline.$errors.length }" select-text="Vybrať" cancel-text="Zrušiť" placeholder="Deadline" />
|
||||||
|
|
||||||
<v-text-field v-model="masterTask.duration" @focus="onInputFocus" class="modal-input mt-5" variant="solo" type="number" disabled :label="`${masterTask.duration} h`"></v-text-field>
|
<v-text-field v-model="mastertask.duration" @focus="onInputFocus" class="modal-input mt-5" variant="solo" type="number" disabled :label="`${mastertask.duration} h`"></v-text-field>
|
||||||
|
|
||||||
<v-select v-model="this.masterTask.team_id" @focus="onInputFocus" class="modal-input border-select" :class="{ error: v$.masterTask.team_id.$errors.length }" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
|
<v-select v-model="this.mastertask.team_id" @focus="onInputFocus" class="modal-input border-select" :class="{ error: v$.mastertask.team_id.$errors.length }" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
|
||||||
|
|
||||||
<template v-if="!masterTask.id">
|
<template v-if="!mastertask.id">
|
||||||
<v-text-field v-for="(employee, index) in masterTask.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !masterTask.employees[index].duration }" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="masterTask.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
|
<v-text-field v-for="(employee, index) in mastertask.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !mastertask.employees[index].duration }" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="mastertask.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
|
||||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||||
</p>
|
</p>
|
||||||
@@ -28,40 +28,40 @@
|
|||||||
|
|
||||||
<Z-autocomplete label="Vyhľadať zamestnanca" v-if="showAddEmployeeInput" :options="employeesOptions" class="modal-input" @option-selected="onEmployeeSelected" />
|
<Z-autocomplete label="Vyhľadať zamestnanca" v-if="showAddEmployeeInput" :options="employeesOptions" class="modal-input" @option-selected="onEmployeeSelected" />
|
||||||
|
|
||||||
<v-btn class="w-100 mb-5 button secondary" :disabled="!masterTask.team?.id" @click="showAddEmployeeInput = true"> <v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca </v-btn>
|
<v-btn class="w-100 mb-5 button secondary" :disabled="!mastertask.team?.id" @click="showAddEmployeeInput = true"> <v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca </v-btn>
|
||||||
|
|
||||||
<div class="w-100 modal-input" :class="{ error: v$.masterTask.description.$errors.length }">
|
<div class="w-100 modal-input" :class="{ error: v$.mastertask.description.$errors.length }">
|
||||||
<QuillEditor ref="description" v-model="masterTask.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="masterTask.description = $event.srcElement.innerHTML" />
|
<QuillEditor ref="description" v-model="mastertask.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="mastertask.description = $event.srcElement.innerHTML" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Z-files-upload class="mt-15 files" :files="masterTask.files" @files-uploaded="filesUploaded" />
|
<Z-files-upload class="mt-15 files" :files="mastertask.files" @files-uploaded="filesUploaded" />
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
|
|
||||||
<v-btn class="button primary" @click="save()">{{ masterTask.id ? 'ULOŽIŤ' : 'VYTVORIŤ' }}</v-btn>
|
<v-btn class="button primary" @click="save()">{{ mastertask.id ? 'ULOŽIŤ' : 'VYTVORIŤ' }}</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">
|
||||||
<div class="d-flex justify-space-between align-center">
|
<div class="d-flex justify-space-between align-center">
|
||||||
<p>{{ masterTask.project_code }}</p>
|
<p>{{ mastertask.project_code }}</p>
|
||||||
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large" class="pb-5"></v-icon>
|
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large" class="pb-5"></v-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
|
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
|
||||||
<h1>{{ masterTask.name }}</h1>
|
<h1>{{ mastertask.name }}</h1>
|
||||||
<div class="d-flex justify-start">
|
<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 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)" />
|
<img class="icon trash" :src="require('@/plugins/app/_img/icons/bin.svg')" alt="trash-icon" @click.stop="openDeleteMasterTaskModal(mastertask)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<v-card-actions class="d-flex flex-column modal-content">
|
<v-card-actions class="d-flex flex-column modal-content">
|
||||||
<div class="w-100">
|
<div class="w-100">
|
||||||
<A-mastertask-description :master-task="masterTask" />
|
<A-mastertask-description :mastertask="mastertask" />
|
||||||
|
|
||||||
<div class="d-flex justify-start align-center mt-8">
|
<div class="d-flex justify-start align-center mt-8">
|
||||||
<v-btn class="button primary" @click="save()">Ukončiť mastertask</v-btn>
|
<v-btn class="button primary" @click="save()">Ukončiť mastertask</v-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<A-tasks-table :tasks="masterTask.subtasks" :employees="enrichedEmployees" />
|
<A-tasks-table :tasks="mastertask.subtasks" :employees="enrichedEmployees" />
|
||||||
|
|
||||||
<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ť task</v-btn>
|
||||||
@@ -96,7 +96,7 @@ export default {
|
|||||||
// MIXINS
|
// MIXINS
|
||||||
// computed: employeesOptions
|
// computed: employeesOptions
|
||||||
// methods: onProjectSelected, onEmployeeSelected, onEmployeeDurationChanged
|
// methods: onProjectSelected, onEmployeeSelected, onEmployeeDurationChanged
|
||||||
// watch: masterTask.team_id
|
// watch: mastertask.team_id
|
||||||
|
|
||||||
emits: ['master-task-edited', 'close'],
|
emits: ['master-task-edited', 'close'],
|
||||||
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||||
@@ -116,7 +116,7 @@ export default {
|
|||||||
visible: false,
|
visible: false,
|
||||||
errorUtils,
|
errorUtils,
|
||||||
v$: useVuelidate(),
|
v$: useVuelidate(),
|
||||||
masterTask: null,
|
mastertask: null,
|
||||||
showAddEmployeeInput: false,
|
showAddEmployeeInput: false,
|
||||||
date: null,
|
date: null,
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ export default {
|
|||||||
|
|
||||||
validations() {
|
validations() {
|
||||||
return {
|
return {
|
||||||
masterTask: {
|
mastertask: {
|
||||||
project_code: { required },
|
project_code: { required },
|
||||||
team_id: { required },
|
team_id: { required },
|
||||||
name: { required },
|
name: { required },
|
||||||
@@ -143,22 +143,22 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$events.on('on-master-task-deleted', (masterTask) => {
|
this.$events.on('on-master-task-deleted', (mastertask) => {
|
||||||
if (masterTask?.id == this.masterTask?.id) this.closeModal()
|
if (mastertask?.id == this.mastertask?.id) this.closeModal()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('on-task-deleted', (task) => {
|
this.$events.on('on-task-deleted', (task) => {
|
||||||
if (!this.masterTask) return
|
if (!this.mastertask) return
|
||||||
this.masterTask.subtasks = this.masterTask.subtasks.filter((subtask) => subtask.id != task.id)
|
this.mastertask.subtasks = this.mastertask.subtasks.filter((subtask) => subtask.id != task.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$events.on('on-subtask-edited', (task) => {
|
this.$events.on('on-subtask-edited', (task) => {
|
||||||
if (!this.masterTask?.subtasks) return
|
if (!this.mastertask?.subtasks) return
|
||||||
|
|
||||||
if (this.masterTask.subtasks.find(subtask => subtask.id == task.id)) {
|
if (this.mastertask.subtasks.find(subtask => subtask.id == task.id)) {
|
||||||
this.masterTask.subtasks = this.masterTask.subtasks.map(t => t.id == task.id ? task : t)
|
this.mastertask.subtasks = this.mastertask.subtasks.map(t => t.id == task.id ? task : t)
|
||||||
} else {
|
} else {
|
||||||
this.masterTask.subtasks.push(task)
|
this.mastertask.subtasks.push(task)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -170,25 +170,25 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async showModal(masterTask, editMode = false) {
|
async showModal(mastertask, editMode = false) {
|
||||||
this.v$.$reset()
|
this.v$.$reset()
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.masterTask = null
|
this.mastertask = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (masterTask?.id) {
|
if (mastertask?.id) {
|
||||||
this.masterTask = await this.$axios.get_auth_data(`v1/mastertasks/${masterTask.id}`)
|
this.mastertask = await this.$axios.get_auth_data(`v1/mastertasks/${mastertask.id}`)
|
||||||
|
|
||||||
const project = this.projects.find((project) => project.code == this.masterTask?.project_code)
|
const project = this.projects.find((project) => project.code == this.mastertask?.project_code)
|
||||||
|
|
||||||
this.masterTask.team_id = this.masterTask.team.id
|
this.mastertask.team_id = this.mastertask.team?.id || null
|
||||||
this.masterTask.project_id = project.id
|
this.mastertask.project_id = project.id
|
||||||
this.masterTask.project_code = project.code
|
this.mastertask.project_code = project.code
|
||||||
} else {
|
} else {
|
||||||
this.masterTask = { employees: [], duration: 0 }
|
this.mastertask = { employees: [], duration: 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editMode = editMode || !this.masterTask.id
|
this.editMode = editMode || !this.mastertask.id
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
}
|
}
|
||||||
@@ -197,24 +197,24 @@ export default {
|
|||||||
async save() {
|
async save() {
|
||||||
if (!(await this.v$.$validate())) return
|
if (!(await this.v$.$validate())) return
|
||||||
|
|
||||||
this.masterTask.description = this.$refs['description'].getHTML()
|
this.mastertask.description = this.$refs['description'].getHTML()
|
||||||
|
|
||||||
// this.masterTask.subtasks = this.masterTask.subtasks.map(subtask => {
|
// this.mastertask.subtasks = this.mastertask.subtasks.map(subtask => {
|
||||||
// const employee = this.masterTask.employees.find(employee => employee.id == subtask.employee_id)
|
// const employee = this.mastertask.employees.find(employee => employee.id == subtask.employee_id)
|
||||||
// subtask.duration = employee.duration
|
// subtask.duration = employee.duration
|
||||||
|
|
||||||
// return subtask
|
// return subtask
|
||||||
// })
|
// })
|
||||||
|
|
||||||
// this.masterTask.project_code = null
|
// this.mastertask.project_code = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.masterTask.deadline = moment(this.masterTask.deadline).format('YYYY-MM-DD HH:MM:SS')
|
this.mastertask.deadline = moment(this.mastertask.deadline).format('YYYY-MM-DD HH:MM:SS')
|
||||||
|
|
||||||
if (this.masterTask.id) await this.$axios.put_auth_data(`v1/mastertasks/${this.masterTask.id}`, this.masterTask)
|
if (this.mastertask.id) await this.$axios.put_auth_data(`v1/mastertasks/${this.mastertask.id}`, this.mastertask)
|
||||||
else await this.$axios.post_auth_data('v1/mastertasks', this.masterTask)
|
else await this.$axios.post_auth_data('v1/mastertasks', this.mastertask)
|
||||||
|
|
||||||
this.$emit('master-task-edited', this.masterTask)
|
this.$emit('master-task-edited', this.mastertask)
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
@@ -222,26 +222,26 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
filesUploaded(files) {
|
filesUploaded(files) {
|
||||||
this.masterTask.files = files
|
this.mastertask.files = files
|
||||||
},
|
},
|
||||||
|
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.visible = false
|
this.visible = false
|
||||||
},
|
},
|
||||||
|
|
||||||
openDeleteMasterTaskModal(masterTask) {
|
openDeleteMasterTaskModal(mastertask) {
|
||||||
this.$events.emit('show-delete-master-task-modal', { masterTask })
|
this.$events.emit('show-delete-master-task-modal', { mastertask })
|
||||||
},
|
},
|
||||||
|
|
||||||
addTask() {
|
addTask() {
|
||||||
this.$events.emit('show-task-modal', { task: null, editMode: false, masterTask: this.masterTask })
|
this.$events.emit('show-task-modal', { task: null, editMode: false, mastertask: this.mastertask })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
editMode() {
|
editMode() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs['description']?.setHTML(this.masterTask.description || '')
|
this.$refs['description']?.setHTML(this.mastertask.description || '')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
openMastertask() {
|
openMastertask() {
|
||||||
this.$emit('close-modal')
|
this.$emit('close-modal')
|
||||||
this.$events.emit('show-master-task-modal', {masterTask: {id: this.id}, editMode: false})
|
this.$events.emit('show-master-task-modal', {mastertask: {id: this.id}, editMode: false})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
<section v-html="description" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
<section v-html="description" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="px-5 py-5 border-bottom" v-if="masterTaskDescription">
|
<div class="px-5 py-5 border-bottom" v-if="mastertaskDescription">
|
||||||
<p>Popis mastertasku</p>
|
<p>Popis mastertasku</p>
|
||||||
<section v-html="masterTaskDescription" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
<section v-html="mastertaskDescription" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ export default {
|
|||||||
default: () => null
|
default: () => null
|
||||||
},
|
},
|
||||||
|
|
||||||
masterTaskDescription: {
|
mastertaskDescription: {
|
||||||
type: String || null,
|
type: String || null,
|
||||||
default: () => null
|
default: () => null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<A-task-planned-time :hours="task.duration" />
|
<A-task-planned-time :hours="task.duration" />
|
||||||
<A-task-remaining-time :hours="task.duration - task.spent_time" />
|
<A-task-remaining-time :hours="task.duration - task.spent_time" />
|
||||||
<A-task-spent-time :hours="task.spent_time" :task="task" />
|
<A-task-spent-time :hours="task.spent_time" :task="task" />
|
||||||
<A-task-description :description="task.description" :master-task-description="task.master_task_description" />
|
<A-task-description :description="task.description" :mastertask-description="task.master_task_description" />
|
||||||
<Z-files :files="task.files" />
|
<Z-files :files="task.files" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ import ATaskPlannedTime from './_components/a-task-planned-time.vue'
|
|||||||
import ATaskSpentTime from './_components/a-task-spent-time.vue'
|
import ATaskSpentTime from './_components/a-task-spent-time.vue'
|
||||||
import ATaskRemainingTime from './_components/a-task-remaining-time.vue'
|
import ATaskRemainingTime from './_components/a-task-remaining-time.vue'
|
||||||
import ATaskDescription from './_components/a-task-description.vue'
|
import ATaskDescription from './_components/a-task-description.vue'
|
||||||
import ZFiles from '@/plugins/tm@modal/_components/z-files.vue'
|
import ZFiles from '@/plugins/tm@modal/_components/read-only/z-files.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
emits: ['close-modal'],
|
emits: ['close-modal'],
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<v-dialog v-model="visible" max-width="750">
|
<v-dialog v-model="visible" max-width="750">
|
||||||
<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ť' }} task, z mastertasku <b>{{ subtask?.master_task?.name || subtask.master_task }}</b>?</h1>
|
||||||
<v-icon
|
<v-icon
|
||||||
@click.stop="visible = false"
|
@click.stop="visible = false"
|
||||||
icon="mdi-close"
|
icon="mdi-close"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<v-dialog v-model="visible" max-width="750">
|
<v-dialog v-model="visible" max-width="750">
|
||||||
<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>{{ task.project_code }}</b>?</h1>
|
<h1>Ste si istý, že chcete zmazať task z mastertasku <b>{{ task.project_code }}</b>?</h1>
|
||||||
|
|
||||||
<v-icon
|
<v-icon
|
||||||
@click.stop="closeModal()"
|
@click.stop="closeModal()"
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
<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="task.project_code" label="Kód projektu" :value="task.project_code" @focus="onInputFocus" class="modal-input" variant="solo" disabled></v-text-field>
|
<v-text-field v-model="task.project_code" label="Kód projektu" :value="task.project_code" @focus="onInputFocus" class="modal-input" variant="solo" disabled></v-text-field>
|
||||||
|
|
||||||
<Z-autocomplete label="Master task" :options="mastertasks.map((masterTask) => ({ key: masterTask.id, value: masterTask.name }))" :validations="v$.task.master_task.id" :clear-on-submit="false" :value="task?.master_task?.name" :class="{ error: v$.task.master_task.id.$errors.length }" class="modal-input" @option-selected="onMasterTaskSelected" />
|
<Z-autocomplete label="Master task" :options="mastertasks.map((mastertask) => ({ key: mastertask.id, value: mastertask.name }))" :validations="v$.task.master_task.id" :clear-on-submit="false" :value="task?.master_task?.name" :class="{ error: v$.task.master_task.id.$errors.length }" class="modal-input" @option-selected="onMasterTaskSelected" />
|
||||||
|
|
||||||
<v-select v-model="task.employee_id" ref="employee-select" @focus="onInputFocus" class="modal-input border-select" label="Priradený" :class="{ error: v$.task.employee_id.$errors.length }" variant="solo" :items="filteredEmployees" item-value="id" item-title="_fullName"></v-select>
|
<v-select v-model="task.employee_id" ref="employee-select" @focus="onInputFocus" class="modal-input border-select" label="Priradený" :class="{ error: v$.task.employee_id.$errors.length }" variant="solo" :items="filteredEmployees" item-value="id" item-title="_fullName"></v-select>
|
||||||
|
|
||||||
<v-text-field v-model="task.duration" @focus="onInputFocus" class="modal-input" variant="solo" type="number" label="Časový odhad" :class="{ error: v$.task.duration.$errors.length }" :hint="v$.task.duration.$errors ? errorUtils.parseErrors(v$.task.duration.$errors) : null" append-inner-icon="mdi-clock-outline"></v-text-field>
|
<v-text-field v-model="task.duration" @focus="onInputFocus" class="modal-input" variant="solo" type="number" label="Časový odhad" :class="{ error: v$.task.duration.$errors.length }" :hint="v$.task.duration.$errors ? errorUtils.parseErrors(v$.task.duration.$errors) : null" append-inner-icon="mdi-clock-outline"></v-text-field>
|
||||||
|
|
||||||
<div class="w-100 modal-input" :class="{ error: v$.task.description.$errors.length }">
|
<div class="w-100 modal-input">
|
||||||
<QuillEditor ref="description" v-model="task.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="task.description = $event.srcElement.innerHTML" />
|
<QuillEditor ref="description" v-model="task.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="task.description = $event.srcElement.innerHTML" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ export default {
|
|||||||
errorUtils,
|
errorUtils,
|
||||||
v$: useVuelidate(),
|
v$: useVuelidate(),
|
||||||
preventInputFocus: false,
|
preventInputFocus: false,
|
||||||
masterTaskIdSelect: null,
|
mastertaskIdSelect: null,
|
||||||
showDatePicker: false,
|
showDatePicker: false,
|
||||||
selectedNewDate: []
|
selectedNewDate: []
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,6 @@ export default {
|
|||||||
validations() {
|
validations() {
|
||||||
return {
|
return {
|
||||||
task: {
|
task: {
|
||||||
description: { required },
|
|
||||||
master_task: {
|
master_task: {
|
||||||
id: { required }
|
id: { required }
|
||||||
},
|
},
|
||||||
@@ -140,7 +139,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async showModal(task, editMode = false, masterTask = {}) {
|
async showModal(task, editMode = false, mastertask = {}) {
|
||||||
this.task = null
|
this.task = null
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.$nextTick(() => this.v$.$reset())
|
this.$nextTick(() => this.v$.$reset())
|
||||||
@@ -150,8 +149,8 @@ export default {
|
|||||||
const subtask = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
|
const subtask = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
|
||||||
this.task = this._enrichTask(subtask)
|
this.task = this._enrichTask(subtask)
|
||||||
} else {
|
} else {
|
||||||
this.task = { master_task: masterTask, timeblocks: [{start: tmUtils.formatDateTimeForBackend(moment()), end: tmUtils.formatDateTimeForBackend(moment())}] }
|
this.task = { master_task: mastertask, timeblocks: [{start: tmUtils.formatDateTimeForBackend(moment()), end: tmUtils.formatDateTimeForBackend(moment())}] }
|
||||||
this.masterTaskIdSelect = masterTask.id
|
this.mastertaskIdSelect = mastertask.id
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editMode = editMode || !this.task.id
|
this.editMode = editMode || !this.task.id
|
||||||
@@ -224,26 +223,29 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_enrichTask(task) {
|
_enrichTask(task) {
|
||||||
task.master_task = this.mastertasks.find((masterTask) => masterTask.id == task.master_task_id)
|
task.master_task = this.mastertasks.find((mastertask) => mastertask.id == task.master_task_id)
|
||||||
task.employee = this.enrichedEmployees.find((employee) => employee.id == task.employee_id)
|
task.employee = this.enrichedEmployees.find((employee) => employee.id == task.employee_id)
|
||||||
task._created_by = this.enrichedEmployees.find((employee) => employee.id == task.created_by)
|
task._created_by = this.enrichedEmployees.find((employee) => employee.id == task.created_by)
|
||||||
this.masterTaskIdSelect = task.master_task?.id
|
this.mastertaskIdSelect = task.master_task?.id
|
||||||
|
|
||||||
return task
|
return task
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
masterTaskIdSelect(value) {
|
mastertaskIdSelect(value) {
|
||||||
if (!value || !this.task) return
|
if (!value || !this.task) return
|
||||||
|
|
||||||
this.task.master_task = this.mastertasks.find((masterTask) => masterTask.id == value)
|
this.task.master_task = this.mastertasks.find((mastertask) => mastertask.id == value)
|
||||||
this.task.project_code = this.task.master_task.project_code
|
this.task.project_code = this.task.master_task.project_code
|
||||||
},
|
},
|
||||||
|
|
||||||
"task.employee_id"(value) {
|
"task.employee_id"(value, oldValue) {
|
||||||
if (!value) return
|
if (!value) return
|
||||||
|
|
||||||
|
if (value && oldValue)
|
||||||
|
this.task.timeblocks = []
|
||||||
|
|
||||||
this.task.employee = this.enrichedEmployees.find((employee) => employee.id == value)
|
this.task.employee = this.enrichedEmployees.find((employee) => employee.id == value)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const allEmployees = await this.$axios.get_auth_data('v1/employees')
|
const allEmployees = await this.$axios.get_auth_data('v1/employees')
|
||||||
this.allEmployees = tmUtils.enrichEmployeesByFullName(allEmployees)
|
this.allEmployees = tmUtils.enrichEmployees(allEmployees)
|
||||||
|
|
||||||
if (team?.id) {
|
if (team?.id) {
|
||||||
const t = await this.$axios.get_auth_data(`v1/teams/${team.id}`)
|
const t = await this.$axios.get_auth_data(`v1/teams/${team.id}`)
|
||||||
@@ -146,7 +146,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_enrichTeam(team) {
|
_enrichTeam(team) {
|
||||||
team.employees = tmUtils.enrichEmployeesByFullName(team.employees)
|
team.employees = tmUtils.enrichEmployees(team.employees)
|
||||||
return team
|
return team
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user