diff --git a/edit-mode/function/ganttEvent.js b/edit-mode/function/ganttEvent.js index 128f893..d973882 100644 --- a/edit-mode/function/ganttEvent.js +++ b/edit-mode/function/ganttEvent.js @@ -54,7 +54,10 @@ gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){ progress = progress/100; new_item['progress'] = progress; new_item['end_date'].setHours(23,59,59); - new_item['duration'] += 1; + new_item['duration'] = gantt.calculateDuration({ + start_date: new_item['start_date'], + end_date: new_item['end_date'] + }) }); gantt.attachEvent("onAfterTaskDrag", function(id, mode, e){ diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js index e81ca72..15abacc 100644 --- a/edit-mode/function/restActivityLink.js +++ b/edit-mode/function/restActivityLink.js @@ -1,3 +1,4 @@ +let geom = []; gantt.ajax.get({ url: `${base_url}activity/${ganttId}/${proyekId}/get`, headers: { @@ -19,6 +20,13 @@ gantt.ajax.get({ isBaselineSet = false; } } + geom = []; + data.data.forEach(element => { + geom.push({ + "activity_id": element.id, + "geom": element.geom + }) + }); gantt.silent(function () { gantt.parse(data); }); @@ -63,6 +71,13 @@ function refresData(id){ let obj = JSON.parse(response); data['data'] = obj.data.data; data['links'] = obj.data.links; + geom = []; + data.data.forEach(element => { + geom.push({ + "activity_id": element.id, + "geom": element.geom + }) + }); gantt.silent(function () { gantt.parse(data); }); @@ -147,7 +162,7 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { } }); } - + data['geom'] = geom.find(obj => obj.activity_id == id)?.geom; return gantt.ajax.put({ headers: { "Content-Type": "application/json",