mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
[Unscheduled time] Added unscheduled time to tasks and teams
This commit is contained in:
1 parent
d93e356265
commit
e3b1460c83
5 files changed
+78
-34
No files matched your search
@@ -38,9 +38,9 @@ export default {
|
|||||||
emits: ['filter-changed'],
|
emits: ['filter-changed'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
unscheduledTime: {
|
splitDays: {
|
||||||
type: Number,
|
type: [Array, null],
|
||||||
default: () => 0
|
default: () => null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -101,8 +101,8 @@ export default {
|
|||||||
this._emitFilterChanged()
|
this._emitFilterChanged()
|
||||||
},
|
},
|
||||||
|
|
||||||
unscheduledTime() {
|
splitDays() {
|
||||||
this.time = this.unscheduledTime
|
this.time = this.splitDays.map(day => parseFloat(day.unscheduledTime)).reduce((acc, val) => acc + val, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<A-task-filter v-if="$store.getters['tm/isInitialized']" :unscheduledTime="timelineData?.unscheduledTime || 0" @filter-changed="onFilterChanged" />
|
<A-task-filter v-if="$store.getters['tm/isInitialized']" :split-days="timelineData ? splitDays : 0" @filter-changed="onFilterChanged" />
|
||||||
<Z-timeline v-if="timelineData" :calData="timelineData" :calConfig="config" :splits="splitDays" />
|
<Z-timeline v-if="timelineData" :calData="timelineData" :calConfig="config" :splits="splitDays" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -54,7 +54,7 @@ export default {
|
|||||||
// Ignore elapsed task
|
// Ignore elapsed task
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
else if (now.isAfter(moment(task._real_start) && now.isBefore(moment(task._real_end)))) {
|
else if (now.isAfter(moment(task._real_start)) && now.isBefore(moment(task._real_end))) {
|
||||||
// Task in progress
|
// Task in progress
|
||||||
schedulesCapacityBySplit[task.split] += timelineUtils._getDifferenceInMinutes(task._real_end, new Date())
|
schedulesCapacityBySplit[task.split] += timelineUtils._getDifferenceInMinutes(task._real_end, new Date())
|
||||||
}
|
}
|
||||||
@@ -64,13 +64,10 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
schedulesCapacityBySplit[1] = 0 // Set YESTERDAY value to 0
|
schedulesCapacityBySplit[1] = 0 // Set YESTERDAY value to 0
|
||||||
|
|
||||||
this.timelineData.homeoffices.forEach(task => {
|
this.timelineData.homeoffices.forEach(task => {
|
||||||
homeoffice[task.split] = true
|
homeoffice[task.split - 1] = true
|
||||||
})
|
})
|
||||||
|
|
||||||
for (let i = 0; i < 7; i++) {
|
for (let i = 0; i < 7; i++) {
|
||||||
@@ -79,10 +76,12 @@ export default {
|
|||||||
|
|
||||||
let unscheduledTime
|
let unscheduledTime
|
||||||
|
|
||||||
if (i == 0) {
|
const date = moment(addDays(this.filter.start, i))
|
||||||
|
|
||||||
|
if (date.isBefore(moment(), 'days')) {
|
||||||
// Yesterday
|
// Yesterday
|
||||||
unscheduledTime = 0
|
unscheduledTime = 0
|
||||||
} else if (i == 1) {
|
} else if (date.isSame(moment(), 'days')) {
|
||||||
// Today
|
// Today
|
||||||
const elapsedMinutes = now.diff(now.clone().startOf('day'), 'minutes')
|
const elapsedMinutes = now.diff(now.clone().startOf('day'), 'minutes')
|
||||||
const workStart = this.user.work_start * 60 > elapsedMinutes ? this.user.workStart : elapsedMinutes
|
const workStart = this.user.work_start * 60 > elapsedMinutes ? this.user.workStart : elapsedMinutes
|
||||||
@@ -93,8 +92,6 @@ export default {
|
|||||||
unscheduledTime = dailyCapacityMinutes - schedulesCapacityBySplit[i + 1]
|
unscheduledTime = dailyCapacityMinutes - schedulesCapacityBySplit[i + 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(unscheduledTime)
|
|
||||||
|
|
||||||
days.push({
|
days.push({
|
||||||
id: i + 1,
|
id: i + 1,
|
||||||
fullname: `${this.filter.employee.name} ${this.filter.employee.surname}`,
|
fullname: `${this.filter.employee.name} ${this.filter.employee.surname}`,
|
||||||
@@ -106,8 +103,6 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(days)
|
|
||||||
|
|
||||||
return days
|
return days
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ export default {
|
|||||||
emits: ['filter-changed'],
|
emits: ['filter-changed'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
unscheduledTime: {
|
splitDays: {
|
||||||
type: Number,
|
type: [Array, null],
|
||||||
default: () => 0
|
default: () => null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ export default {
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('auth', ['user']),
|
...mapGetters('auth', ['user']),
|
||||||
...mapGetters('tm', ['teams']),
|
...mapGetters('tm', ['teams'])
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -83,8 +83,8 @@ export default {
|
|||||||
|
|
||||||
_updateFilters() {
|
_updateFilters() {
|
||||||
this.filter.start = this.date
|
this.filter.start = this.date
|
||||||
this.filter.end = this.date
|
// this.filter.end = this.date
|
||||||
// this.filter.end = addDays(this.date, 1)
|
this.filter.end = addDays(this.date, 1)
|
||||||
this.selectedDate = String(this.filter.start?.toLocaleDateString('sk-SK'))
|
this.selectedDate = String(this.filter.start?.toLocaleDateString('sk-SK'))
|
||||||
|
|
||||||
this._emitFilterChanged()
|
this._emitFilterChanged()
|
||||||
@@ -103,8 +103,8 @@ export default {
|
|||||||
this._emitFilterChanged()
|
this._emitFilterChanged()
|
||||||
},
|
},
|
||||||
|
|
||||||
unscheduledTime() {
|
splitDays() {
|
||||||
this.time = this.unscheduledTime
|
this.time = this.splitDays.map(day => parseFloat(day.unscheduledTime)).reduce((acc, val) => acc + val, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ export default {
|
|||||||
|
|
||||||
const blockers = this._generateBlockers()
|
const blockers = this._generateBlockers()
|
||||||
|
|
||||||
console.log([...this._generateNonWorking(), ...this._generateTasks(), ...blockers.filter(blocker => blocker.type != 'home_office')])
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
unscheduledTime: 333,
|
|
||||||
tasks: [...this._generateNonWorking(), ...this._generateTasks(), ...blockers.filter(blocker => blocker.type != 'home_office')],
|
tasks: [...this._generateNonWorking(), ...this._generateTasks(), ...blockers.filter(blocker => blocker.type != 'home_office')],
|
||||||
homeoffices: [...blockers.filter(blocker => blocker.type == 'home_office')]
|
homeoffices: [...blockers.filter(blocker => blocker.type == 'home_office')]
|
||||||
}
|
}
|
||||||
@@ -23,15 +20,30 @@ export default {
|
|||||||
splitDays() {
|
splitDays() {
|
||||||
const days = []
|
const days = []
|
||||||
const homeoffice = {}
|
const homeoffice = {}
|
||||||
|
const now = moment()
|
||||||
|
|
||||||
this.filter.team.employees.forEach((employee, index) => {
|
this.filter.team.employees.forEach((employee, index) => {
|
||||||
let workingHours = 0
|
const selectedDate = moment(this.filter.start)
|
||||||
|
const capacityMinutes = this._getRemainingWorkCapacityMinutes(employee)
|
||||||
|
let scheduledCapacityMinutes = 0
|
||||||
|
|
||||||
this.calendarData.tasks.forEach(task => {
|
this.calendarData.tasks.forEach(task => {
|
||||||
if ((task.subtask?.employee?.id != employee.id) && (task.blocker?.employee?.id != employee.id))
|
// console.log(task)
|
||||||
|
if ((task.subtask?.employee_id != employee.id) && (task.blocker?.employee?.id != employee.id))
|
||||||
return
|
return
|
||||||
|
|
||||||
workingHours += timelineUtils._getDifferenceInHours(task.end, task.start)
|
if (task.type == 'non-working-hours' || task.subtask?.is_finished || task.blocker?.is_finished)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (selectedDate.isBefore(moment(), 'days')) {
|
||||||
|
// Past
|
||||||
|
return
|
||||||
|
} else if (selectedDate.isSame(moment(), 'days')) {
|
||||||
|
// Today
|
||||||
|
|
||||||
|
} else {
|
||||||
|
scheduledCapacityMinutes += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.calendarData.homeoffices.forEach(task => {
|
this.calendarData.homeoffices.forEach(task => {
|
||||||
@@ -40,12 +52,14 @@ export default {
|
|||||||
homeoffice[task.split] = true
|
homeoffice[task.split] = true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const unscheduledTime = capacityMinutes - scheduledCapacityMinutes
|
||||||
|
|
||||||
days.push({
|
days.push({
|
||||||
id: index + 1,
|
id: index + 1,
|
||||||
name: employee.name,
|
name: employee.name,
|
||||||
fullname: `${employee.name} ${employee.surname}`,
|
fullname: `${employee.name} ${employee.surname}`,
|
||||||
initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(),
|
initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(),
|
||||||
unscheduledTime: workingHours,
|
unscheduledTime: unscheduledTime > 0 ? (unscheduledTime / 60).toFixed(1) : 0,
|
||||||
isHomeoffice: homeoffice[index + 1] ? true : false
|
isHomeoffice: homeoffice[index + 1] ? true : false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -122,8 +136,11 @@ export default {
|
|||||||
initials: employee?.name?.charAt(0)?.toUpperCase() + employee?.surname?.charAt(0)?.toUpperCase(),
|
initials: employee?.name?.charAt(0)?.toUpperCase() + employee?.surname?.charAt(0)?.toUpperCase(),
|
||||||
split: split,
|
split: split,
|
||||||
project_code: subtask.project_code,
|
project_code: subtask.project_code,
|
||||||
|
type: 'subtask',
|
||||||
subtask,
|
subtask,
|
||||||
_timeblock_id: timeblock.id
|
_timeblock_id: timeblock.id,
|
||||||
|
_real_start: new Date(timeblock.start),
|
||||||
|
_real_end: new Date(timeblock.end)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -157,6 +174,8 @@ export default {
|
|||||||
color: '#B00020',
|
color: '#B00020',
|
||||||
draggable: false,
|
draggable: false,
|
||||||
isWeekend: moment(blocker.start).day() % 6 == 0,
|
isWeekend: moment(blocker.start).day() % 6 == 0,
|
||||||
|
_real_start: new Date(blocker.start),
|
||||||
|
_real_end: new Date(blocker.end)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -173,6 +192,31 @@ export default {
|
|||||||
_setMinutesToDate(minutes, date = new Date(this.filter.start)) {
|
_setMinutesToDate(minutes, date = new Date(this.filter.start)) {
|
||||||
date.setHours(Math.floor(minutes / 60), minutes % 60, 0, 0)
|
date.setHours(Math.floor(minutes / 60), minutes % 60, 0, 0)
|
||||||
return date
|
return date
|
||||||
|
},
|
||||||
|
|
||||||
|
_getRemainingWorkCapacityMinutes(employee) {
|
||||||
|
const date = moment(this.filter.start)
|
||||||
|
const now = moment()
|
||||||
|
|
||||||
|
if (now.isAfter(date, 'days')) {
|
||||||
|
// Past dates
|
||||||
|
return 0
|
||||||
|
} else if (now.isBefore(date, 'days')) {
|
||||||
|
// Future dates
|
||||||
|
return (employee.work_end - employee.work_start) * 60
|
||||||
|
}
|
||||||
|
|
||||||
|
// Today
|
||||||
|
const workStartMinutes = employee.work_start * 60
|
||||||
|
const workEndMinutes = employee.work_end * 60
|
||||||
|
const elapsedMinutesOfCurrenyDay = now.diff(moment().startOf('day'), 'minutes')
|
||||||
|
|
||||||
|
if (workStartMinutes > elapsedMinutesOfCurrenyDay)
|
||||||
|
return workEndMinutes - workStartMinutes
|
||||||
|
else if (workEndMinutes < elapsedMinutesOfCurrenyDay)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return workEndMinutes - elapsedMinutesOfCurrenyDay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<A-team-filter v-if="$store.getters['tm/isInitialized']" :unscheduledTime="calendarData?.unscheduledTime || 0" @filter-changed="onFilterChanged" />
|
<A-team-filter v-if="$store.getters['tm/isInitialized']" :split-days="calendarData ? splitDays : null" @filter-changed="onFilterChanged" />
|
||||||
<Z-timeline v-if="calendarData" :cal-data="calendarData" :cal-config="calendarConfig" :splits="splitDays" />
|
<Z-timeline v-if="calendarData" :cal-data="calendarData" :cal-config="calendarConfig" :splits="splitDays" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -10,6 +10,7 @@ import ATeamFilter from './_components/a-team-filter.vue'
|
|||||||
import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.vue'
|
import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.vue'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import TeamsCalendar from './_mixins/TeamsCalendar.mixin'
|
import TeamsCalendar from './_mixins/TeamsCalendar.mixin'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [TeamsCalendar],
|
mixins: [TeamsCalendar],
|
||||||
@@ -31,6 +32,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
...mapGetters('auth', ['user']),
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$events.on('on-subtask-edited', () => {
|
this.$events.on('on-subtask-edited', () => {
|
||||||
this.onFilterChanged(this.filter)
|
this.onFilterChanged(this.filter)
|
||||||
|
|||||||
Reference in new issue
Block a user