mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Tasks] Planned hours
This commit is contained in:
1 parent
9dcc87fbe8
commit
e4abc1fc36
2 files changed
+22
-3
No files matched your search
@@ -80,5 +80,11 @@ export default {
|
||||
|
||||
_getSplitFromDate(date, start) {
|
||||
return differenceInCalendarDays(new Date(date), new Date(start)) * (-1) + 1
|
||||
},
|
||||
|
||||
_getDifferenceInHours(date1, date2) {
|
||||
let diff =(date1.getTime() - date2.getTime()) / 1000;
|
||||
diff /= (60 * 60)
|
||||
return Math.abs(Math.round(diff))
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import { addDays, subDays } from 'date-fns'
|
||||
import { mapGetters } from 'vuex'
|
||||
import moment from 'moment'
|
||||
import timelineUtils from './_utils/timeline.utils'
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -33,13 +34,25 @@ export default {
|
||||
computed: {
|
||||
splitDays() {
|
||||
const days = []
|
||||
const workingHours = {}
|
||||
const capacityPerDay = this.$store.getters['auth/user'].work_end - this.$store.getters['auth/user'].work_start
|
||||
|
||||
for (let i = 0; i < 7; i++) {
|
||||
this.timelineData.tasks.forEach(task => {
|
||||
if (!workingHours[task.split])
|
||||
workingHours[task.split] = 0
|
||||
|
||||
if (task.nonWorking)
|
||||
return
|
||||
|
||||
workingHours[task.split] += timelineUtils._getDifferenceInHours(task.end, task.start)
|
||||
})
|
||||
|
||||
for (let i = 1; i <= 7; i++) {
|
||||
days.push({
|
||||
id: i + 1,
|
||||
id: i ,
|
||||
name: this.filter.employee.name + " " + this.filter.employee.surname,
|
||||
initials: this.filter.employee.name.charAt(0).toUpperCase() + this.filter.employee.surname.charAt(0).toUpperCase(),
|
||||
unscheduledTime: this.timelineData.unscheduledTime,
|
||||
unscheduledTime: capacityPerDay - workingHours[i],
|
||||
date: addDays(this.filter.start, i),
|
||||
isWeekend: timelineUtils.isWeekend(addDays(this.filter.start, i))
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user