Merge branch 'release-v2.1.4' of https://github.com/Worklenz/worklenz into feature/team-utilization

This commit is contained in:
chamiakJ
2025-07-31 06:57:50 +05:30
14 changed files with 858 additions and 808 deletions

View File

@@ -706,8 +706,23 @@ const taskManagementSlice = createSlice({
const group = state.groups.find(g => g.id === sourceGroupId);
if (group) {
const newTasks = Array.from(group.taskIds);
const [removed] = newTasks.splice(newTasks.indexOf(sourceTaskId), 1);
newTasks.splice(newTasks.indexOf(destinationTaskId), 0, removed);
const sourceIndex = newTasks.indexOf(sourceTaskId);
const destinationIndex = newTasks.indexOf(destinationTaskId);
// Remove the task from its current position
const [removed] = newTasks.splice(sourceIndex, 1);
// Calculate the insertion index
let insertIndex = destinationIndex;
if (sourceIndex < destinationIndex) {
// When dragging down, we need to insert after the destination
insertIndex = destinationIndex;
} else {
// When dragging up, we insert before the destination
insertIndex = destinationIndex;
}
newTasks.splice(insertIndex, 0, removed);
group.taskIds = newTasks;
// Update order for affected tasks using the appropriate sort field