mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
feat(timeline): add support for calculating local timeblock durations and update employee timeblock handling in modal
This commit is contained in:
1 parent
03974b1b99
commit
1b7cea85bf
3 files changed
+75
-26
No files matched your search
@@ -922,12 +922,37 @@ export default {
|
||||
const employee = this.enrichedEmployees.find(
|
||||
(employee) => employee.id == subtask.employee_id,
|
||||
);
|
||||
this.subtask.employees = [employee];
|
||||
|
||||
// Get current logged-in user
|
||||
const currentUserId = this.$store.getters['auth/user']?.id;
|
||||
const isCurrentUser = currentUserId === subtask.employee_id;
|
||||
|
||||
// If the clicked employee is different from current user, add current user first as empty slot
|
||||
if (!isCurrentUser) {
|
||||
this.subtask.employees = [
|
||||
{ id: currentUserId, duration: null }, // Empty current user slot
|
||||
employee, // The clicked employee with data
|
||||
];
|
||||
} else {
|
||||
// Same user or no current user, just add the clicked employee
|
||||
this.subtask.employees = [employee];
|
||||
}
|
||||
|
||||
this.subtask.deadline = subtask.deadline;
|
||||
this.subtask._deadline_time = subtask._deadline_time;
|
||||
|
||||
setTimeout(() => {
|
||||
this.timeblocks = [
|
||||
...(!isCurrentUser
|
||||
? [
|
||||
{
|
||||
date: new Date(subtask.deadline),
|
||||
starts_at_time: subtask._deadline_time,
|
||||
ends_at_time: null,
|
||||
employee_id: currentUserId,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
date: new Date(subtask.deadline),
|
||||
starts_at_time: subtask._deadline_time,
|
||||
|
||||
Reference in new issue
Block a user