mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
no message
This commit is contained in:
1 parent
399f80e106
commit
3016b6aaa0
5 files changed
+62
-36
No files matched your search
@@ -209,15 +209,17 @@ export default {
|
||||
if (this.$route.name == 'Dashboard - Tasks') {
|
||||
const editedSubtask = {
|
||||
...event.subtask,
|
||||
timeblocks: [
|
||||
...event.subtask.timeblocks,
|
||||
{
|
||||
id: event._timeblock_id,
|
||||
is_finished: 0,
|
||||
start: tmUtils.formatDateTimeForBackend(start),
|
||||
end: tmUtils.formatDateTimeForBackend(end),
|
||||
},
|
||||
],
|
||||
timeblocks: event.subtask.timeblocks.map((tb) => {
|
||||
if (tb.id === event._timeblock_id) {
|
||||
return {
|
||||
id: event._timeblock_id,
|
||||
is_finished: tb.is_finished || 0,
|
||||
start: tmUtils.formatDateTimeForBackend(start),
|
||||
end: tmUtils.formatDateTimeForBackend(end),
|
||||
};
|
||||
}
|
||||
return tb;
|
||||
}),
|
||||
timesheets: event.subtask.timesheets.map((timesheet) => {
|
||||
delete timesheet.employee_name;
|
||||
return timesheet;
|
||||
@@ -245,15 +247,17 @@ export default {
|
||||
const editedSubtask = {
|
||||
...event.subtask,
|
||||
employee_id: split.employee_id,
|
||||
timeblocks: [
|
||||
...event.subtask.timeblocks,
|
||||
{
|
||||
id: event._timeblock_id,
|
||||
is_finished: 0,
|
||||
start: tmUtils.formatDateTimeForBackend(event.start),
|
||||
end: tmUtils.formatDateTimeForBackend(event.end),
|
||||
},
|
||||
],
|
||||
timeblocks: event.subtask.timeblocks.map((tb) => {
|
||||
if (tb.id === event._timeblock_id) {
|
||||
return {
|
||||
id: event._timeblock_id,
|
||||
is_finished: tb.is_finished || 0,
|
||||
start: tmUtils.formatDateTimeForBackend(event.start),
|
||||
end: tmUtils.formatDateTimeForBackend(event.end),
|
||||
};
|
||||
}
|
||||
return tb;
|
||||
}),
|
||||
timesheets: event.subtask.timesheets.map((timesheet) => {
|
||||
delete timesheet.employee_name;
|
||||
return timesheet;
|
||||
|
||||
@@ -628,7 +628,9 @@ export default {
|
||||
// Helper: Get timeblocks for specific employee
|
||||
getEmployeeTimeblocks(employeeId) {
|
||||
if (!this.timeblocks) return [];
|
||||
return this.timeblocks.filter((tb) => tb.employee_id == employeeId);
|
||||
return this.timeblocks.filter(
|
||||
(tb) => Number(tb.employee_id) === Number(employeeId),
|
||||
);
|
||||
},
|
||||
|
||||
updateEmployeeTimeblocks(updatedTimeblocks, employeeId) {
|
||||
@@ -1040,23 +1042,28 @@ export default {
|
||||
|
||||
// Convert timeblocks from internal format to BE format for update
|
||||
// Filter out completely empty timeblocks AND timeblocks without all required fields
|
||||
const timeblocks = this.timeblocks
|
||||
.filter(
|
||||
(timeblock) =>
|
||||
timeblock.date &&
|
||||
timeblock.starts_at_time &&
|
||||
timeblock.ends_at_time &&
|
||||
timeblock.employee_id == this.subtask.employee_id,
|
||||
) // Only send complete timeblocks for this employee
|
||||
.map((timeblock) => {
|
||||
const dateStr = moment(timeblock.date).format('YYYY-MM-DD');
|
||||
return {
|
||||
id: timeblock.id || null,
|
||||
start: `${dateStr} ${timeblock.starts_at_time}:00`,
|
||||
end: `${dateStr} ${timeblock.ends_at_time}:00`,
|
||||
is_finished: timeblock.is_finished || 0,
|
||||
};
|
||||
});
|
||||
// Pre draft s multiple employees preskočiť - timeblocks sú v employees array
|
||||
const timeblocks =
|
||||
this.subtask.is_draft && this.isDraftWithMultipleEmployees
|
||||
? []
|
||||
: this.timeblocks
|
||||
.filter(
|
||||
(timeblock) =>
|
||||
timeblock.date &&
|
||||
timeblock.starts_at_time &&
|
||||
timeblock.ends_at_time &&
|
||||
Number(timeblock.employee_id) ===
|
||||
Number(this.subtask.employee_id),
|
||||
) // Only send complete timeblocks for this employee
|
||||
.map((timeblock) => {
|
||||
const dateStr = moment(timeblock.date).format('YYYY-MM-DD');
|
||||
return {
|
||||
id: timeblock.id || null,
|
||||
start: `${dateStr} ${timeblock.starts_at_time}:00`,
|
||||
end: `${dateStr} ${timeblock.ends_at_time}:00`,
|
||||
is_finished: timeblock.is_finished || 0,
|
||||
};
|
||||
});
|
||||
|
||||
const payload = { ...this.subtask, timesheets, timeblocks };
|
||||
|
||||
|
||||
Reference in new issue
Block a user