Browse Source

handle all link type update link

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
de987474db
  1. 21
      edit-mode/function/function.js

21
edit-mode/function/function.js

@ -716,8 +716,25 @@ function updateLinksLag(data) {
if (link.target == task.id) {
let predecessor = data.data.find(item => item.id == link.source);
if (predecessor) {
let lag = gantt.calculateDuration(new Date(predecessor.end_date), new Date(task.start_date));
if (link.type == "0" && isBaselineSet) {
let lag;
if (isBaselineSet) {
switch (link.type) {
case "0":
lag = gantt.calculateDuration(new Date(predecessor.end_date), new Date(task.start_date));
break;
case "1":
lag = gantt.calculateDuration(new Date(predecessor.start_date), new Date(task.start_date));
break;
case "2":
lag = gantt.calculateDuration(new Date(predecessor.end_date), new Date(task.end_date));
break;
case "3":
lag = gantt.calculateDuration(new Date(predecessor.start_date), new Date(task.end_date));
break;
default:
// Handle an unknown link type if needed
break;
}
link.lag = lag;
}
}

Loading…
Cancel
Save