Browse Source

Fix duratiion calculation and geom

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
70be6b4466
  1. 5
      edit-mode/function/ganttEvent.js
  2. 17
      edit-mode/function/restActivityLink.js

5
edit-mode/function/ganttEvent.js

@ -54,7 +54,10 @@ gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){
progress = progress/100; progress = progress/100;
new_item['progress'] = progress; new_item['progress'] = progress;
new_item['end_date'].setHours(23,59,59); 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){ gantt.attachEvent("onAfterTaskDrag", function(id, mode, e){

17
edit-mode/function/restActivityLink.js

@ -1,3 +1,4 @@
let geom = [];
gantt.ajax.get({ gantt.ajax.get({
url: `${base_url}activity/${ganttId}/${proyekId}/get`, url: `${base_url}activity/${ganttId}/${proyekId}/get`,
headers: { headers: {
@ -19,6 +20,13 @@ gantt.ajax.get({
isBaselineSet = false; isBaselineSet = false;
} }
} }
geom = [];
data.data.forEach(element => {
geom.push({
"activity_id": element.id,
"geom": element.geom
})
});
gantt.silent(function () { gantt.silent(function () {
gantt.parse(data); gantt.parse(data);
}); });
@ -63,6 +71,13 @@ function refresData(id){
let obj = JSON.parse(response); let obj = JSON.parse(response);
data['data'] = obj.data.data; data['data'] = obj.data.data;
data['links'] = obj.data.links; data['links'] = obj.data.links;
geom = [];
data.data.forEach(element => {
geom.push({
"activity_id": element.id,
"geom": element.geom
})
});
gantt.silent(function () { gantt.silent(function () {
gantt.parse(data); 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({ return gantt.ajax.put({
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

Loading…
Cancel
Save