mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
feat(timeline): add scheduled time display and calculation across components. Fixed refresh for mastertask, after subtask was updated
This commit is contained in:
1 parent
6a550006d9
commit
4917993390
5 files changed
+42
-13
No files matched your search
@@ -45,6 +45,7 @@
|
||||
<div class="text-wrap me-4">
|
||||
<p class="mb-0 mt-0 unscheduled-time-name">{{split.fullname}}</p>
|
||||
<h1 class="mb-0 mt-0">{{split.unscheduledTime}} h</h1>
|
||||
<h1 class="mb-0 mt-0" style="font-weight:400;">{{split.scheduledTime}} h</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -21,6 +21,13 @@ export default {
|
||||
return unscheduledTime
|
||||
},
|
||||
|
||||
getScheduledTime(subtasks) {
|
||||
let scheduledTime = 0
|
||||
subtasks.forEach(subtask => scheduledTime += subtask.spent_time)
|
||||
|
||||
return scheduledTime
|
||||
},
|
||||
|
||||
isWeekend(date) {
|
||||
return moment(date).day() % 6 == 0
|
||||
},
|
||||
|
||||
@@ -102,6 +102,7 @@ export default {
|
||||
fullname: `${this.filter.employee.name} ${this.filter.employee.surname}`,
|
||||
initials: this.filter.employee.name.charAt(0).toUpperCase() + this.filter.employee.surname.charAt(0).toUpperCase(),
|
||||
unscheduledTime: (unscheduledTime / 60).toFixed(1),
|
||||
scheduledTime: (schedulesCapacityBySplit[i + 1] / 60).toFixed(1),
|
||||
date: addDays(this.filter.start, i),
|
||||
isHomeoffice: homeoffice[i] ? true : false,
|
||||
isWeekend: timelineUtils.isWeekend(addDays(this.filter.start, i))
|
||||
|
||||
@@ -25,6 +25,7 @@ export default {
|
||||
const selectedDate = moment(this.filter.start)
|
||||
const capacityMinutes = this._getRemainingWorkCapacityMinutes(employee)
|
||||
let scheduledCapacityMinutes = 0
|
||||
let totalScheduledTime = 0
|
||||
|
||||
this.calendarData.tasks.forEach(task => {
|
||||
// console.log(task)
|
||||
@@ -35,13 +36,16 @@ export default {
|
||||
return
|
||||
|
||||
if (selectedDate.isBefore(moment(), 'days')) {
|
||||
totalScheduledTime += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||
// Past
|
||||
return
|
||||
} else if (selectedDate.isSame(moment(), 'days')) {
|
||||
totalScheduledTime += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||
// Today
|
||||
|
||||
} else {
|
||||
scheduledCapacityMinutes += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||
totalScheduledTime += timelineUtils._getDifferenceInMinutes(task._real_end, task._real_start)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -61,6 +65,7 @@ export default {
|
||||
fullname: `${employee.name} ${employee.surname}`,
|
||||
initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(),
|
||||
unscheduledTime: unscheduledTime > 0 ? (unscheduledTime / 60).toFixed(1) : 0,
|
||||
scheduledTime: totalScheduledTime > 0 ? (totalScheduledTime / 60).toFixed(1) : 0,
|
||||
isHomeoffice: homeoffice[index + 1] ? true : false
|
||||
})
|
||||
})
|
||||
|
||||
@@ -248,22 +248,11 @@ export default {
|
||||
this.$events.emit('show-delete-team-member-modal', { member, team })
|
||||
},
|
||||
|
||||
async showModal({ mastertask, editMode = false }) {
|
||||
this.isSaving = false
|
||||
this.editMode = null
|
||||
this.visible = true
|
||||
this.mastertask = null
|
||||
this.$nextTick(() => {
|
||||
this.setFocusEvent()
|
||||
this.v$.$reset()
|
||||
})
|
||||
|
||||
async loadMastertask(id) {
|
||||
try {
|
||||
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/${id}`)
|
||||
|
||||
// TODO zmazat ked zacne prichadzat project_id a team_id
|
||||
console.log('1', this.mastertask)
|
||||
const project = this.projects.find((project) => project.code == this.mastertask.project_code)
|
||||
this.mastertask.project_id = project?.id || null
|
||||
this.mastertask.team_id = this.mastertask.team?.id || null
|
||||
@@ -281,6 +270,24 @@ export default {
|
||||
return employee
|
||||
})
|
||||
.filter((employee) => employee !== null)
|
||||
} catch (error) {
|
||||
this.$toast.error(error.message || error)
|
||||
}
|
||||
},
|
||||
|
||||
async showModal({ mastertask, editMode = false }) {
|
||||
this.isSaving = false
|
||||
this.editMode = null
|
||||
this.visible = true
|
||||
this.mastertask = null
|
||||
this.$nextTick(() => {
|
||||
this.setFocusEvent()
|
||||
this.v$.$reset()
|
||||
})
|
||||
|
||||
try {
|
||||
if (mastertask?.id) {
|
||||
await this.loadMastertask(mastertask.id)
|
||||
|
||||
// this.mastertask.project_code = project.code
|
||||
} else {
|
||||
@@ -437,7 +444,15 @@ export default {
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
'$route.query': {
|
||||
handler(_, oldValue) {
|
||||
if (oldValue?.subtask?.length) {
|
||||
this.loadMastertask(this.mastertask.id);
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user